/* --- NAVBAR --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    border-bottom: 1px solid transparent;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition:
        background-color 0.3s,
        border-color 0.3s,
        box-shadow 0.3s ease,
        transform 0.3s ease;
}

.navbar.scrolled {
    border-bottom-color: var(--card-border);
    box-shadow: var(--navbar-shadow);
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transition: padding 0.28s ease, gap 0.28s ease;
}

.navbar.scrolled .navbar-inner {
    padding: 8px 20px 10px;
    gap: 8px;
}

.logo {
    height: 132px;
    width: auto;
    transform-origin: center;
    transition:
        transform 0.28s ease,
        filter 0.22s ease,
        height 0.28s ease;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.08));
}

.logo:hover {
    transform: scale(1.035);
}

.navbar.scrolled .logo {
    height: 82px;
}

[data-theme="dark"] .logo {
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.32));
}

/* --- SEARCH FORM --- */
.search-form {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    transition: gap 0.28s ease, transform 0.28s ease;
}

.navbar.scrolled .search-form {
    gap: 10px;
}

.search-input {
    padding: 12px 15px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition:
        width 0.24s ease,
        border-color 0.2s,
        background-color 0.3s,
        color 0.3s,
        box-shadow 0.2s,
        transform 0.18s ease;
}

.search-input:hover {
    transform: translateY(-1px);
}

.search-input:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 4px var(--focus-ring);
    transform: translateY(-1px) scale(1.015);
}

.name-input {
    width: 260px;
}

.name-input:focus {
    width: 290px;
}

.age-input,
#kidAge {
    width: 100px;
}

.age-input:focus,
#kidAge:focus {
    width: 112px;
}

.location-input {
    width: 180px;
}

.location-input:focus {
    width: 210px;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-wrapper:focus-within {
    z-index: 1200;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    z-index: 1100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.autocomplete-item {
    width: 100%;
    padding: 10px 15px;
    cursor: pointer;
    border: 0;
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    text-align: left;
    font: inherit;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: var(--carousel-bg);
}

.city-name {
    font-weight: bold;
    color: var(--text-color);
    font-size: 16px;
}

.state-name {
    color: var(--author-em-color);
    font-size: 14px;
}

.search-btn {
    padding: 12px 24px;
    background-color: var(--brand-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.22);
    transition:
        transform 0.18s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        padding 0.28s ease;
}

.search-btn:hover {
    background-color: var(--brand-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(255, 107, 107, 0.28);
}

.search-btn:active {
    transform: translateY(0);
}

.navbar.scrolled .search-btn {
    padding: 10px 20px;
}

/* --- KID CARDS --- */
.kid-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px var(--shadow-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.kid-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px var(--shadow-color);
}

.yelp-header {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 10px;
}

.parent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--carousel-bg);
    object-fit: cover;
}

.yelp-header-text {
    font-size: 0.85em;
    color: var(--text-color);
    line-height: 1.3;
}

.time-ago {
    display: block;
    color: var(--author-em-color);
    font-size: 0.9em;
}

.yelp-image-container {
    width: 100%;
    height: 160px;
    background-color: var(--carousel-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

.kid-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yelp-content {
    padding: 12px;
    flex-grow: 1;
}

.yelp-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: var(--text-color);
}

.yelp-content .snippet {
    font-size: 0.9em;
    color: var(--text-color);
    margin: 0;
    line-height: 1.4;
}

.read-more {
    color: var(--link-color);
    text-decoration: none;
    font-weight: bold;
}

.read-more:hover {
    text-decoration: underline;
}

.yelp-footer {
    display: flex;
    justify-content: space-between;
    padding: 10px 8px;
    border-top: 1px solid var(--card-border);
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--author-color);
    padding: 6px 8px;
    border-radius: 20px;
    transition: all 0.2s ease;
    filter: grayscale(100%);
    opacity: 0.6;
}

.reaction-btn:hover {
    background-color: var(--carousel-bg);
    opacity: 0.9;
}

.reaction-btn.active {
    filter: none;
    opacity: 1;
    color: var(--text-color);
    background-color: #ffebed;
}

[data-theme="dark"] .reaction-btn.active {
    background-color: #3b2020;
}

.stars {
    font-size: 1.2em;
    margin-bottom: 8px;
    display: block;
}

/* --- MODAL --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1200;
    inset: 0;
    padding: 28px;
    place-items: center;
    background:
        radial-gradient(circle at top, rgba(255, 107, 107, 0.18) 0%, rgba(255, 107, 107, 0) 36%),
        var(--modal-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-shell {
    width: min(100%, 680px);
}

.modal-content {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 100%),
        var(--modal-bg);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    color: var(--text-color);
}

.modal-content::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #ff8a8a 0%, #ff6b6b 35%, #d94d75 100%);
}

.modal-header,
.modal-body,
.modal-footer {
    padding-left: 30px;
    padding-right: 30px;
}

.modal-header {
    padding-top: 34px;
    padding-bottom: 18px;
}

.modal-body {
    padding-top: 4px;
    padding-bottom: 10px;
}

.modal-footer {
    padding-top: 10px;
    padding-bottom: 24px;
    border-top: 1px solid var(--card-border);
}

.modal-kicker {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand-color);
}

.modal-title {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.modal-copy {
    margin: 0;
    max-width: 56ch;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--author-color);
}

.modal-section-title {
    margin: 24px 0 14px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-color);
}

.modal-footnote {
    margin: 0;
    color: var(--author-color);
    font-size: 0.92rem;
}

.close-button {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--author-color);
    font-size: 28px;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-color);
    transform: translateY(-1px);
}

.charity-list {
    list-style: none;
    display: grid;
    gap: 12px;
    padding: 0;
    margin: 0;
}

.charity-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(76, 175, 80, 0.18);
    background:
        linear-gradient(135deg, rgba(76, 175, 80, 0.18) 0%, rgba(76, 175, 80, 0.08) 100%),
        var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 12px 26px rgba(76, 175, 80, 0.14);
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.charity-list a::after {
    content: "Open";
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--charity-green);
}

.charity-list a:hover {
    transform: translateY(-1px);
    border-color: rgba(76, 175, 80, 0.34);
    box-shadow: 0 16px 34px rgba(76, 175, 80, 0.18);
}

.admin-access-content .modal-copy {
    max-width: 60ch;
}

.admin-access-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.admin-access-card {
    display: grid;
    gap: 10px;
    padding: 22px;
    border-radius: 22px;
    border: 1px solid var(--card-border);
    background:
        linear-gradient(180deg, rgba(255, 107, 107, 0.08) 0%, rgba(255, 255, 255, 0) 100%),
        var(--card-bg);
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 14px 30px var(--shadow-color);
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-access-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 107, 107, 0.32);
    box-shadow: 0 20px 36px var(--shadow-color);
}

.admin-access-label {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.admin-access-copy {
    line-height: 1.6;
    color: var(--author-color);
}

/* --- THEME TOGGLE --- */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.theme-label {
    font-weight: bold;
    font-size: 0.9em;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: 0.4s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
}

input:checked+.slider {
    background-color: var(--brand-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--brand-color);
}

input:checked+.slider::before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round::before {
    border-radius: 50%;
}

/* --- RESPONSIVE COMPONENTS --- */
@media (max-width: 768px) {
    .navbar-inner {
        padding: 12px 14px 16px;
        gap: 12px;
    }

    .logo {
        height: 104px;
    }

    .navbar.scrolled .logo {
        height: 78px;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .search-form input,
    .search-form button,
    .autocomplete-wrapper,
    .name-input,
    .location-input,
    .age-input,
    #kidAge {
        width: 100%;
        max-width: 100%;
    }

    .name-input:focus,
    .age-input:focus,
    #kidAge:focus,
    .location-input:focus {
        width: 100%;
        transform: translateY(-1px);
    }

    .modal-content {
        border-radius: 22px;
    }

    .modal {
        padding: 16px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .modal-header {
        padding-top: 28px;
    }

    .modal-footer {
        padding-bottom: 20px;
    }

    .admin-access-grid {
        grid-template-columns: 1fr;
    }
}

/* --- TOP BAR --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: rgba(18, 18, 18, 0.68);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .topbar {
    background: rgba(10, 10, 10, 0.76);
}

.topbar-inner {
    max-width: 1360px;
    margin: 0 auto;
    min-height: 76px;
    padding: 14px 22px;
    display: grid;
    grid-template-columns: auto minmax(420px, 760px) auto;
    align-items: center;
    gap: 20px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-text-link {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-decoration: none;
    color: #fff;
}

.brand-text-title,
.brand-text-subtitle {
    display: block;
}

.brand-text-title {
    font-size: 1.6rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.brand-text-kid {
    color: #ffd6d6;
}

.brand-text-rater {
    color: #fff;
}

.brand-text-subtitle {
    font-size: 0.78rem;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.01em;
}

.brand-text-emphasis {
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.topbar-logo {
    height: 42px;
    width: auto;
    display: block;
    object-fit: contain;
}

.topbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.mobile-search-toggle {
    display: none;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.mobile-search-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
}

.compact-toggle {
    margin-top: 0;
    gap: 8px;
}

.compact-toggle .theme-label {
    color: #fff;
    font-size: 0.85rem;
}

/* --- HORIZONTAL SEARCH --- */
.topbar-search {
    display: grid;
    grid-template-columns: minmax(220px, 1.8fr) 110px minmax(180px, 1.2fr) auto;
    align-items: center;
    gap: 0;
    width: 100%;
    border-radius: 14px;
    overflow: visible;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.topbar-search .search-input {
    height: 50px;
    border: none;
    border-right: 1px solid #e7e7e7;
    border-radius: 0;
    background: #fff;
    color: #222;
    box-shadow: none;
    transform: none;
    padding: 0 16px;
    font-size: 15px;
}

.topbar-search .search-input:focus {
    box-shadow: inset 0 0 0 2px var(--brand-color);
    transform: none;
}

.topbar-search .search-input:hover {
    transform: none;
}

.topbar-search .search-btn {
    height: 50px;
    border-radius: 0;
    padding: 0 22px;
    box-shadow: none;
}

.topbar-search .search-name {
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}

.topbar-search .search-btn {
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}

.topbar-search .search-btn:hover {
    transform: none;
}

.search-age {
    text-align: left;
}

.search-location-wrap {
    width: 100%;
}

.search-location-wrap .search-location {
    width: 100%;
    border-right: 1px solid #e7e7e7;
}

.autocomplete-dropdown {
    top: calc(100% + 8px);
    border-radius: 12px;
    overflow: hidden;
}

/* --- THEME SWITCH REUSE --- */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.theme-label {
    font-weight: 700;
    font-size: 0.9em;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.45);
    transition: 0.4s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
}

input:checked+.slider {
    background-color: var(--brand-color);
}

input:checked+.slider::before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round::before {
    border-radius: 50%;
}

/* --- DARK MODE: TOPBAR SEARCH --- */
[data-theme="dark"] .topbar-search {
    background: #1f1f1f;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .brand-text-kid {
    color: #ffb3b3;
}

[data-theme="dark"] .brand-text-rater {
    color: #fff3f3;
}

[data-theme="dark"] .topbar-search .search-input {
    background: #1f1f1f;
    color: #f1f1f1;
    border-right: 1px solid #343434;
}

[data-theme="dark"] .topbar-search .search-input::placeholder {
    color: #a8a8a8;
}

[data-theme="dark"] .topbar-search .search-input:focus {
    box-shadow: inset 0 0 0 2px var(--brand-color);
}

[data-theme="dark"] .search-location-wrap .search-location {
    border-right: 1px solid #343434;
}

/* --- DARK MODE: AUTOCOMPLETE DROPDOWN --- */
[data-theme="dark"] .autocomplete-dropdown {
    background: #242424;
    border: 1px solid #343434;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .autocomplete-item {
    background: #242424;
    border-bottom: 1px solid #343434;
}

[data-theme="dark"] .autocomplete-item:hover {
    background: #2f2f2f;
}

[data-theme="dark"] .city-name {
    color: #f1f1f1;
}

[data-theme="dark"] .state-name {
    color: #a8a8a8;
}

@media (max-width: 860px) {
    [data-theme="dark"] .topbar-search {
        background: transparent;
        box-shadow: none;
    }

    [data-theme="dark"] .topbar-search .search-input {
        background: #1f1f1f;
        border: 1px solid #343434;
    }
}
