/* ==========================================================================
   BestBlogTheme — Components (features, forms, comments, 404)
   ========================================================================== */

/* -- Back to Top ---------------------------------------------------------- */
.bbt-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bbt-btn-color, var(--bbt-color-primary));
    color: #fff;
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bbt-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bbt-back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.bbt-back-to-top--circle {
    border-radius: 50%;
}

.bbt-back-to-top--square {
    border-radius: 10px;
}

/* -- Progress Bar --------------------------------------------------------- */
.bbt-progress-bar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--bbt-progress-height, 3px);
    background: transparent;
    pointer-events: none;
}

.bbt-progress-bar--top {
    top: 0;
}

.bbt-progress-bar--bottom {
    bottom: 0;
}

/* Sticky header offset */
.bbt-header--sticky ~ .bbt-site-main .bbt-progress-bar--top,
.bbt-header--sticky + .bbt-progress-bar--top {
    top: 0;
}

.bbt-progress-bar__fill {
    height: 100%;
    width: 0%;
    background: var(--bbt-progress-color, var(--bbt-color-primary));
    transition: width 0.05s linear;
}

/* -- Loading Screen ------------------------------------------------------- */
.bbt-loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bbt-loading-bg, #ffffff);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.bbt-loading-screen.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.bbt-loading-screen__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--bbt-loading-color, var(--bbt-color-primary));
    border-radius: 50%;
    animation: bbt-spin 0.7s linear infinite;
}

@keyframes bbt-spin {
    to { transform: rotate(360deg); }
}

.bbt-loading-screen__logo {
    max-height: 60px;
    animation: bbt-pulse 1.2s ease-in-out infinite;
}

@keyframes bbt-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.95); }
}

.bbt-loading-screen__progress {
    width: 200px;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.bbt-loading-screen__progress-fill {
    height: 100%;
    background: var(--bbt-loading-color, var(--bbt-color-primary));
    animation: bbt-loading-progress 1.5s ease-in-out infinite;
}

@keyframes bbt-loading-progress {
    0% { width: 0%; margin-left: 0; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* -- Comments ------------------------------------------------------------- */
.bbt-comments {
    max-width: 780px;
    margin-inline: auto;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #f1f5f9;
}

.bbt-comments__title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.bbt-comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
}

.bbt-comment {
    margin-bottom: 1.5rem;
}

.bbt-comment__body {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bbt-color-light);
    border-radius: 10px;
}

.bbt-comment__avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.bbt-comment__content {
    flex: 1;
    min-width: 0;
}

.bbt-comment__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.bbt-comment__author {
    font-family: var(--bbt-font-primary);
    font-weight: 600;
    font-size: 0.9375rem;
}

.bbt-comment__date {
    font-size: 0.8125rem;
    color: var(--bbt-color-gray);
}

.bbt-comment__text {
    font-size: 0.9375rem;
    line-height: 1.6;
}

.bbt-comment__text p:last-child {
    margin-bottom: 0;
}

.bbt-comment__reply a {
    font-family: var(--bbt-font-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bbt-color-primary);
    margin-top: 0.5rem;
    display: inline-block;
}

/* Nested comments */
.bbt-comment-list .children {
    list-style: none;
    padding-left: 2rem;
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .bbt-comment-list .children {
        padding-left: 1rem;
    }
}

/* -- Comment Form --------------------------------------------------------- */
.bbt-comments .comment-respond {
    margin-top: 2rem;
}

.bbt-comments .comment-reply-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.bbt-comments .comment-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .bbt-comments .comment-form {
        grid-template-columns: 1fr 1fr;
    }

    .bbt-comments .comment-form-comment,
    .bbt-comments .form-submit {
        grid-column: 1 / -1;
    }
}

.bbt-comments .comment-form label {
    display: block;
    font-family: var(--bbt-font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.bbt-comments .comment-form input[type="text"],
.bbt-comments .comment-form input[type="email"],
.bbt-comments .comment-form input[type="url"],
.bbt-comments .comment-form textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: var(--bbt-font-secondary);
    font-size: 0.9375rem;
    transition: border-color 0.2s ease;
}

.bbt-comments .comment-form input:focus,
.bbt-comments .comment-form textarea:focus {
    border-color: var(--bbt-color-primary);
    outline: none;
}

.bbt-comments .comment-form textarea {
    min-height: 150px;
    resize: vertical;
}

.bbt-comments .form-submit .submit {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 1.75rem;
    background: var(--bbt-color-primary);
    color: #fff;
    font-family: var(--bbt-font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.bbt-comments .form-submit .submit:hover {
    background: var(--bbt-color-secondary);
}

.bbt-comments .form-submit .submit:active {
    transform: scale(0.98);
}

/* -- 404 ------------------------------------------------------------------ */
.bbt-404 {
    text-align: center;
    padding: 5rem 1rem;
}

.bbt-404__number {
    font-family: var(--bbt-font-primary);
    font-size: clamp(5rem, 15vw, 10rem);
    font-weight: 800;
    color: var(--bbt-color-primary);
    line-height: 1;
    opacity: 0.15;
    margin-bottom: -1rem;
}

.bbt-404__title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.bbt-404__text {
    color: var(--bbt-color-gray);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-inline: auto;
}

.bbt-404__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: var(--bbt-color-primary);
    color: #fff;
    font-family: var(--bbt-font-primary);
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.bbt-404__btn:hover {
    background: var(--bbt-color-secondary);
    color: #fff;
}

/* -- Search Form ---------------------------------------------------------- */
.search-form {
    display: flex;
    max-width: 500px;
    margin-inline: auto;
}

.search-form .search-field {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-family: var(--bbt-font-secondary);
    font-size: 0.9375rem;
}

.search-form .search-field:focus {
    border-color: var(--bbt-color-primary);
    outline: none;
}

.search-form .search-submit {
    padding: 0.65rem 1.25rem;
    background: var(--bbt-color-primary);
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
    font-family: var(--bbt-font-primary);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-form .search-submit:hover {
    background: var(--bbt-color-secondary);
}
