:root {
    --primary-purple: #702082;
    --dark-purple: #2e1052;
    --light-purple: #faf3fc;
    --border-purple: #eedcf5;
    --text-dark: #2c2c2c;
    --text-muted: #666666;
    --bg-light: #f7f3fb;
    --card-border: #f0e2f5;
}

.baby-names-page-wrapper,
.category-page-wrapper {
    color: var(--text-dark);
    background-color: #ffffff;
    line-height: 1.6;
    padding-bottom: 0px;
}

/* Hero Banner */
.banner-wrapper {
    width: 100%;
    background: #faf3fc;
    border-bottom: 1px solid var(--border-purple);
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.banner-wrapper img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

/* ========================================================
   HEADINGS & CMS CONTENT ALIGNMENT
   ======================================================== */
.page-header-section {
    padding: 35px 0 20px 0;
    width: 100%;
}

.page-header-section h1,
.category-header-title {
    color: var(--dark-purple);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.page-header-section h2,
.category-subheading {
    color: var(--primary-purple);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* Dynamic Classes from CMS attribute */
.cms-heading-left {
    text-align: left !important;
}

.cms-heading-center,
.cms-heading-middle {
    text-align: center !important;
}

.cms-heading-right {
    text-align: right !important;
}

/* CMS Rich Editor Content Rules */
.rich-content-block {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.8;
    text-align: left; /* Default base text is left */
}

.rich-content-block p {
    margin-bottom: 14px;
    text-align: inherit;
}

.rich-content-block h1,
.rich-content-block h2,
.rich-content-block h3,
.rich-content-block h4,
.rich-content-block h5,
.rich-content-block h6 {
    color: var(--dark-purple);
    font-weight: 700;
    margin-top: 25px;
    margin-bottom: 12px;
}

/* Explicitly honor inline alignments generated by the CMS editor */
.rich-content-block [style*="text-align: center"],
.rich-content-block [style*="text-align:center"],
.rich-content-block [align="center"] {
    text-align: center !important;
}

.rich-content-block [style*="text-align: right"],
.rich-content-block [style*="text-align:right"],
.rich-content-block [align="right"] {
    text-align: right !important;
}

.rich-content-block [style*="text-align: left"],
.rich-content-block [style*="text-align:left"],
.rich-content-block [align="left"] {
    text-align: left !important;
}

.rich-content-block ul,
.rich-content-block ol {
    margin: 10px 0 15px 25px;
    padding-left: 0;
    text-align: left;
}

/* ========================================================
   LANDING PAGE CATEGORY TABLE
   ======================================================== */
.religion-gender-table-section {
    padding: 30px 0 45px 0;
    width: 100%;
}

.religion-section-title {
    color: var(--dark-purple);
    font-size: 26px;
    font-weight: 700;
    text-align: center !important;
    margin-bottom: 32px; /* Generous gap between heading and table */
}

.religion-table-box {
    background: #ffffff;
    border: 1px solid var(--border-purple);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(112, 32, 130, 0.04);
}

.religion-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.religion-table thead tr {
    background-color: var(--light-purple);
    border-bottom: 2px solid var(--border-purple);
}

.religion-table th {
    padding: 16px 22px;
    font-size: 15px;
    font-weight: 700;
    color: var(--dark-purple);
    text-align: left;
}

.religion-table td {
    padding: 18px 22px;
    border-bottom: 1px solid #f1e4f5;
    font-size: 15px;
    text-align: left;
}

.religion-table tr:last-child td {
    border-bottom: none;
}

.religion-name-cell {
    font-weight: 600;
    color: var(--dark-purple);
    width: 25%;
    text-align: left;
}

.category-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
    background-color: #faf5fc;
    border: 1px solid #ecd8f2;
}

.category-link-btn:hover {
    background-color: var(--primary-purple);
    color: #ffffff;
    border-color: var(--primary-purple);
    text-decoration: none;
}

/* ========================================================
   CATEGORY DIRECTORY (EQUAL HEIGHT ON DESKTOP)
   ======================================================== */
.category-layout {
    display: flex;
    gap: 24px;
    align-items: stretch;
    padding: 15px 0 35px 0;
    position: relative;
}

.alphabet-sidebar {
    width: 22%;
    background: #ffffff;
    border: 1px solid var(--border-purple);
    border-radius: 16px;
    padding: 20px 18px;
    box-shadow: 0 4px 20px rgba(112, 32, 130, 0.04);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.alphabet-sidebar-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dark-purple);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    flex: 1;
    align-content: space-between;
}

.letter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 42px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background-color: #ffffff;
    color: var(--dark-purple);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.letter-btn:hover {
    background-color: var(--light-purple);
    border-color: var(--primary-purple);
    color: var(--primary-purple);
    transform: translateY(-2px);
}

.letter-btn.active {
    background: linear-gradient(135deg, var(--primary-purple), var(--dark-purple));
    border-color: var(--primary-purple);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(112, 32, 130, 0.25);
}

.names-content-area {
    width: 78%;
    position: relative;
    min-height: 400px;
}

.ajax-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    border-radius: 12px;
}

.ajax-loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid var(--light-purple);
    border-top: 3.5px solid var(--primary-purple);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.names-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.name-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px 18px;
    position: relative;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    text-align: left;
}

.name-card:hover {
    border-color: #d8b8e8;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(112, 32, 130, 0.08);
}

.name-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.name-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark-purple);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.gender-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    background-color: var(--light-purple);
    color: var(--primary-purple);
    border: 1px solid #ebd3f2;
    flex-shrink: 0;
}

.name-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
    text-align: left;
}

.name-meaning {
    font-size: 13px;
    color: #4a4a4a;
    line-height: 1.4;
    margin: 0;
    text-align: left;
}

/* ========================================================
   PAGINATION (BRAND PURPLE THEME)
   ======================================================== */
.custom-pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #f0e6f5;
}

.pagination-summary-text {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
    text-align: left;
}

.pagination-links-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slide-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-purple);
    background-color: #ffffff;
    border: 1.5px solid var(--border-purple);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(112, 32, 130, 0.04);
    flex-shrink: 0;
}

.slide-page-btn:hover:not(.disabled) {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
    background-color: var(--light-purple);
}

.slide-page-btn.active {
    background: linear-gradient(135deg, var(--primary-purple), var(--dark-purple));
    border-color: var(--primary-purple);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(112, 32, 130, 0.3);
}

.slide-page-btn.disabled {
    color: #cccccc;
    background-color: #fcf9fd;
    border-color: #f1e4f5;
    cursor: not-allowed;
}

/* ========================================================
   FAQ SECTION
   ======================================================== */
.faq-section {
    background-color: var(--bg-light);
    padding: 40px 0 45px 0;
    margin-top: 25px;
}

.faq-title {
    color: #2b1846;
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 25px;
    text-align: center !important;
}

.faq-accordion-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: #ffffff;
    border: 1.5px solid #d4bfe8;
    border-radius: 50px;
    overflow: hidden;
    transition: border-radius 0.3s ease, box-shadow 0.3s ease;
}

.faq-item.active {
    border-radius: 26px;
    box-shadow: 0 4px 18px rgba(112, 32, 130, 0.08);
}

.faq-question-btn {
    width: 100%;
    text-align: left;
    padding: 16px 28px;
    background: #ffffff;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #2b1846;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-chevron {
    width: 18px;
    height: 18px;
    stroke: #5d3587;
    transition: transform 0.35s ease;
    flex-shrink: 0;
}

.faq-item.active .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer-panel {
    max-height: 0;
    overflow: hidden;
    background-color: #eee3f5;
    border-top: 1px solid transparent;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
}

.faq-item.active .faq-answer-panel {
    border-top-color: #d8c3ea;
}

.faq-answer-content {
    padding: 20px 28px;
    color: #2c2c2c;
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
}

.content-section-wrapper {
    padding: 20px 0 25px 0;
    text-align: left;
}

.last-content-section {
    padding: 25px 0 15px 0;
    margin-bottom: 0;
    text-align: left;
}

.last-content-section .rich-content-block p:last-child,
.last-content-section .rich-content-block ul:last-child {
    margin-bottom: 0;
}

/* ========================================================
   TABLET & MOBILE RESPONSIVENESS
   ======================================================== */
@media (max-width: 1200px) {
    .names-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    .category-layout {
        flex-direction: column;
        gap: 24px;
        align-items: stretch;
    }
    .alphabet-sidebar {
        width: 100%;
        display: block;
        padding: 18px;
    }
    .alphabet-grid {
        grid-template-columns: repeat(13, 1fr);
        display: grid;
        gap: 6px;
    }
    .letter-btn {
        height: 40px;
    }
    .names-content-area {
        width: 100%;
    }
    .names-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-header-section h1 { font-size: 24px; }
    .page-header-section h2 { font-size: 18px; }

    .religion-gender-table-section h2 { font-size: 20px; }
    .religion-table th, .religion-table td { padding: 12px 14px; font-size: 13px; text-align: left; }
    .category-link-btn { font-size: 12px; padding: 6px 10px; }

    .alphabet-sidebar {
        width: 100%;
        display: block;
    }
    .alphabet-grid {
        grid-template-columns: repeat(7, 1fr);
        display: grid;
        gap: 6px;
    }
    .letter-btn {
        height: 38px;
        min-height: unset;
    }

    .names-card-grid { grid-template-columns: 1fr; }

    .custom-pagination-wrapper {
        flex-direction: column;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 12px;
        padding-top: 18px;
    }

    .pagination-summary-text {
        text-align: center !important;
        width: 100%;
    }

    .pagination-links-container {
        width: auto;
        max-width: 100%;
        justify-content: center !important;
        margin: 0 auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .pagination-links-container::-webkit-scrollbar {
        display: none;
    }

    .slide-page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 6px;
    }

    .faq-item { border-radius: 28px; }
    .faq-question-btn { padding: 14px 20px; font-size: 14px; text-align: left; }
    .faq-answer-content { padding: 16px 20px; text-align: left; }
}

@media (max-width: 480px) {
    .alphabet-grid { grid-template-columns: repeat(6, 1fr); }
    .letter-btn { height: 38px; font-size: 13px; }
}