/*
 * All Authors Page - Modern Redesign
 * Mobile-first, dark theme, ADA compliant
 */

@layer pages {

    /* ============================================================
       CSS VARIABLES - Using site tokens
       ============================================================ */
    .aa-page {
        /* RGB versions for use with rgba() */
        --header-green-rgb: 140, 149, 0;
        --btn-yellow-rgb: 237, 173, 1;
        --aa-blue-rgb: 49, 134, 255;
    }

    /* ============================================================
       PAGE LAYOUT
       ============================================================ */
    .aa-page {
        min-height: calc(100vh - 200px);
        background: linear-gradient(180deg, #0a0a0a 0%, #111 100%);
    }

    /* ============================================================
       HERO SECTION
       ============================================================ */
    .aa-hero {
        padding: 40px 16px 16px;
        background:
            radial-gradient(ellipse 60% 50% at 20% 80%, rgba(var(--header-green-rgb), 0.08) 0%, transparent 50%),
            radial-gradient(ellipse 50% 40% at 85% 20%, rgba(var(--aa-blue-rgb), 0.06) 0%, transparent 50%),
            transparent;
    }

    .aa-hero-inner {
        max-width: min(1080px, 100%);
        margin: 0 auto;
        text-align: center;
    }

    .aa-hero h1 {
        font: 700 clamp(28px, 5vw, 42px)/1.2 "Jost", sans-serif;
        color: var(--white);
        margin: 0 0 12px;
    }

    .aa-intro {
        font: 400 16px/1.6 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.7);
        margin: 0 auto 24px;
        max-width: 600px;
    }

    /* Search Box */
    .aa-search-wrap {
        position: relative;
        max-width: 400px;
        margin: 0 auto;
    }

    .aa-search-icon {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        color: rgba(255, 255, 255, 0.4);
        pointer-events: none;
        z-index: 1;
    }

    .aa-search-input {
        width: 100%;
        height: 50px;
        padding: 0 16px 0 46px;
        font: 400 16px/1 "Jost", sans-serif;
        color: var(--white);
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        outline: none;
        transition: all 0.2s ease;
    }

    .aa-search-input::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }

    .aa-search-input:focus {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(var(--header-green-rgb), 0.5);
    }

    /* ============================================================
       A-Z NAVIGATION
       ============================================================ */
    .aa-az-nav {
        position: sticky;
        top: 0;
        z-index: 100;
        padding: 12px 16px;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .aa-az-inner {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
        max-width: 580px; /* Narrower to force 2-row wrapping */
        margin: 0 auto;
    }

    .aa-az-link {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        height: 32px;
        padding: 0 6px;
        font: 600 14px/1 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        background: rgba(255, 255, 255, 0.16);
        border-radius: 6px;
        transition: all 0.15s ease;
    }

    .aa-az-link:hover,
    .aa-az-link:focus-visible {
        color: var(--white);
        background: rgba(var(--header-green-rgb), 0.25);
        text-decoration: none;
    }

    .aa-az-link:focus-visible {
        outline: 2px solid var(--header-green);
        outline-offset: 2px;
    }

    .aa-az-link.aa-az-active {
        color: var(--white);
        background: var(--header-green);
    }

    /* ============================================================
       CURRENT LETTER INDICATOR
       ============================================================ */
    .aa-current-letter {
        padding: 20px 16px 20px 0px;
        max-width: min(1080px, 100%);
        margin: 0 auto;
    }

    .aa-current-letter-text {
        font: 400 15px/1.5 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.6);
        margin: 0;
    }

    .aa-current-letter-text strong {
        color: var(--header-green);
        font-weight: 600;
    }

    /* ============================================================
       AUTHORS LIST - Compact cards
       ============================================================ */
    .aa-authors {
        padding: 20px 16px 40px;
    }

    .aa-authors-inner {
        max-width: min(1080px, 100%);
        margin: 0 auto;
    }

    .aa-author-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 0;
        margin: 0;
    }

    .aa-author-item {
        list-style: none;
        margin: 0;
    }

    .aa-author-link {
        display: block;
        padding: 10px 12px;
        font: 400 15px/1.3 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.85);
        text-decoration: none;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 8px;
        transition: all 0.15s ease;
    }

    .aa-author-link:hover,
    .aa-author-link:focus-visible {
        color: var(--white);
        background: rgba(var(--header-green-rgb), 0.12);
        border-color: rgba(var(--header-green-rgb), 0.3);
        text-decoration: none;
    }

    .aa-author-link:focus-visible {
        outline: 2px solid var(--header-green);
        outline-offset: 2px;
    }

    /* No Results */
    .aa-no-results {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 20px;
        text-align: center;
    }

    .aa-no-results i {
        font-size: 48px;
        color: rgba(255, 255, 255, 0.2);
        margin-bottom: 16px;
    }

    .aa-no-results p {
        font: 400 18px/1.5 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.5);
        margin: 0;
    }

    /* ============================================================
       PAGINATION
       ============================================================ */
    .aa-pagination {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
        padding: 30px 16px;
        margin: 0 auto;
        max-width: min(1080px, 100%);
        list-style: none;
    }

    .aa-pagination li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .aa-pagination a,
    .aa-pagination span {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        height: 40px;
        padding: 0 12px;
        font: 500 14px/1 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 8px;
        transition: all 0.15s ease;
    }

    .aa-pagination a:hover,
    .aa-pagination a:focus-visible {
        color: var(--white);
        background: rgba(var(--header-green-rgb), 0.2);
        border-color: rgba(var(--header-green-rgb), 0.4);
        text-decoration: none;
    }

    .aa-pagination a:focus-visible {
        outline: 2px solid var(--header-green);
        outline-offset: 2px;
    }

    .aa-pagination .aa-page-active,
    .aa-pagination span.aa-page-active {
        color: var(--white);
        background: var(--header-green);
        border-color: var(--header-green);
    }

    .aa-pagination .aa-page-ellipsis {
        background: transparent;
        border-color: transparent;
        color: rgba(255, 255, 255, 0.4);
        cursor: default;
    }

    /* ============================================================
       BESTSELLERS SECTION
       ============================================================ */
    .aa-bestsellers {
        padding: 50px 16px 60px;
        background:
            radial-gradient(ellipse 70% 50% at 80% 30%, rgba(var(--btn-yellow-rgb), 0.06) 0%, transparent 50%),
            radial-gradient(ellipse 50% 40% at 15% 70%, rgba(var(--aa-blue-rgb), 0.05) 0%, transparent 50%),
            linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .aa-bestsellers-inner {
        max-width: min(1080px, 100%);
        margin: 0 auto;
    }

    .aa-bestsellers-heading {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        font: 700 clamp(24px, 4vw, 32px)/1.2 "Jost", sans-serif;
        color: var(--white);
        margin: 0 0 10px;
        text-align: center;
    }

    .aa-bestsellers-heading i {
        color: var(--btn-yellow-bg);
    }

    .aa-bestsellers-intro {
        font: 400 16px/1.6 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.6);
        margin: 0 0 30px;
        text-align: center;
    }

    /* Style the dynamically generated bestsellers HTML */
    .aa-bestsellers-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .aa-bestsellers-grid .allcategories {
        display: block;
        width: 100%;
        float: none;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        padding: 20px;
        transition: all 0.2s ease;
    }

    .aa-bestsellers-grid .allcategories:hover {
        background: rgba(255, 255, 255, 0.10);
        border-color: rgba(255, 255, 255, 0.18);
    }

    .aa-bestsellers-grid .allcategories-list {
        display: block;
        max-width: 100%;
    }

    .aa-bestsellers-grid .allcategories-header {
        margin-bottom: 12px;
    }

    .aa-bestsellers-grid .allcategories-header a {
        text-decoration: none;
    }

    .aa-bestsellers-grid .allcategories-header a:hover {
        text-decoration: none;
    }

    .aa-bestsellers-grid .allcategories-header h3 {
        font: 600 18px/1.3 "Jost", sans-serif;
        color: var(--btn-yellow-bg);
        margin: 0;
        transition: color 0.15s ease;
    }

    .aa-bestsellers-grid .allcategories-header a:hover h3 {
        color: var(--white);
    }

    .aa-bestsellers-grid .allcategories-box {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .aa-bestsellers-grid .allcategories-link {
        display: block;
        font: 400 14px/1.5 "Jost", sans-serif;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        list-style: none;
        transition: all 0.15s ease;
    }

    .aa-bestsellers-grid .allcategories-link:last-child {
        border-bottom: none;
    }

    .aa-bestsellers-grid .allcategories-link:hover {
        color: var(--white);
        padding-left: 8px;
    }

    /* ============================================================
       RESPONSIVE - TABLET (min-width: 600px)
       ============================================================ */
    @media (min-width: 600px) {
        .aa-authors {
            padding: 30px 24px 50px;
        }

        .aa-author-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
        }

        .aa-bestsellers-grid {
            grid-template-columns: repeat(2, 1fr);
        }

        .aa-az-link {
            min-width: 36px;
            height: 36px;
        }
    }

    /* ============================================================
       RESPONSIVE - DESKTOP (min-width: 900px)
       ============================================================ */
    @media (min-width: 900px) {
        .aa-hero {
            padding: 60px 24px 20px;
        }

        .aa-intro {
            font-size: 17px;
        }

        .aa-az-nav {
            padding: 10px 24px 30px 24px;
        }

        .aa-az-inner {
            gap: 6px;
        }

        .aa-az-link {
            min-width: 38px;
            height: 38px;
            font-size: 15px;
        }

        .aa-authors {
            padding: 20px 24px 40px;
        }

        .aa-author-grid {
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }

        .aa-bestsellers {
            padding: 60px 24px 80px;
        }

        .aa-bestsellers-grid {
            grid-template-columns: repeat(3, 1fr);
            gap: 24px;
        }

        .aa-bestsellers-grid .allcategories {
            padding: 24px;
        }
    }

    /* ============================================================
       RESPONSIVE - LARGE DESKTOP (min-width: 1100px)
       ============================================================ */
    @media (min-width: 1100px) {
        .aa-author-grid {
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
        }

        .aa-bestsellers-grid {
            grid-template-columns: repeat(4, 1fr);
        }
    }

} /* end @layer pages */

/* ============================================================
   JQUERY UI AUTOCOMPLETE STYLING
   (Outside @layer to override jQuery UI default styles)
   ============================================================ */
.all-authors-page .ui-autocomplete {
    background: #1a1a1a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    max-height: 300px;
    overflow-y: auto;
    padding: 6px !important;
    z-index: 1000 !important;
}

.all-authors-page .ui-autocomplete .ui-menu-item {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    list-style: none !important;
}

.all-authors-page .ui-autocomplete .ui-menu-item a,
.all-authors-page .ui-autocomplete .ui-menu-item-wrapper {
    display: block;
    padding: 10px 14px !important;
    font: 400 15px/1.4 "Jost", sans-serif !important;
    color: rgba(255, 255, 255, 0.85) !important;
    background: transparent !important;
    border-radius: 6px !important;
    margin: 2px 0 !important;
    transition: background 0.15s ease !important;
    text-decoration: none !important;
}

.all-authors-page .ui-autocomplete .ui-menu-item a:hover,
.all-authors-page .ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.all-authors-page .ui-autocomplete .ui-menu-item-wrapper:hover {
    background: rgba(140, 149, 0, 0.2) !important;
    color: #fff !important;
}

.all-authors-page .ui-autocomplete .ss-author-result {
    display: flex;
    align-items: center;
    gap: 8px;
}

.all-authors-page .ui-autocomplete .ss-author-result b {
    color: #8C9500;
}

.all-authors-page .ui-autocomplete .ss-author-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: auto;
}
