
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');


:root {
    --primary-color: #7c3aed; /* violet-600 */
    --primary-color-rgb: 124, 58, 237;
    --primary-hover: #6d28d9; /* violet-700 */
    --primary-light: #ede9fe; /* violet-100 */
    --primary-dark: #5b21b6; /* violet-800 */
    --secondary-color: #f3f4f6; /* gray-100 */
    --secondary-hover: #e5e7eb; /* gray-200 */
    --text-color: #111827; /* gray-900 */
    --text-light: #4b5563; /* gray-600 */
    --border-color: #d1d5db; /* gray-300 */
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.5);
    --white: #ffffff;
    --card-bg: #ffffff;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6; /* blue-500 */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 40px -10px rgba(var(--primary-color-rgb), 0.4);
    --border-radius: 0.75rem;
    --transition-speed: 0.3s;
    
    /* Dark Mode variables */
    --dark-mode-bg: #05010a; /* App Background */
    --dark-mode-bg-secondary: #0a0514; /* Slightly lighter for cards if needed without glass */
    --dark-mode-bg-secondary-hover: #150a28;
    --dark-mode-border: rgba(255, 255, 255, 0.15); /* App Border */
    --dark-mode-text: #ffffff; /* Crisp white */
    --dark-mode-text-light: #a0a0a0; /* App secondary text */
    --dark-mode-glass-bg: rgba(15, 10, 25, 0.85); /* Much more opaque for readability */
    --dark-mode-glass-border: rgba(255, 255, 255, 0.15);
}

/* --- DARK MODE STYLES --- */
html.dark-mode {
    color-scheme: dark;
    --primary-color: #8b5cf6; /* Darker violet for button backgrounds so white text is readable */
    --primary-hover: #7c3aed; 
    --primary-light: rgba(139, 92, 246, 0.15); 
    
    --secondary-color: rgba(255, 255, 255, 0.05); 
    --secondary-hover: rgba(255, 255, 255, 0.1);
    
    --text-color: var(--dark-mode-text);
    --text-light: var(--dark-mode-text-light);
    --border-color: var(--dark-mode-border);
    --glass-bg: var(--dark-mode-glass-bg);
    --glass-border: var(--dark-mode-glass-border);
    --card-bg: var(--dark-mode-glass-bg);
    
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.7);
}


html.dark-mode body {
    background-color: var(--dark-mode-bg) !important;
    font-family: 'Inter', sans-serif;
}

/* --- SATELLITE PAGES DARK MODE FIX --- */
/* These !important overrides are necessary to beat the inline <style> blocks in satellite pages */
html.dark-mode .legal-container,
html.dark-mode .article-container {
    background-color: rgba(15, 10, 25, 0.90) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--dark-mode-text) !important;
}
html.dark-mode .legal-container h1,
html.dark-mode .article-container h1,
html.dark-mode .legal-container h3,
html.dark-mode .article-container h3,
html.dark-mode .legal-container h4,
html.dark-mode .article-container h4,
html.dark-mode .legal-container strong,
html.dark-mode .article-container strong {
    color: var(--dark-mode-text) !important;
}
html.dark-mode .legal-container p,
html.dark-mode .legal-container li,
html.dark-mode .article-container p,
html.dark-mode .article-container li {
    color: var(--dark-mode-text-light) !important;
}
html.dark-mode .legal-container th {
    background-color: rgba(139, 92, 246, 0.15) !important;
    color: var(--dark-mode-text) !important;
}
html.dark-mode .legal-container td {
    color: var(--dark-mode-text-light) !important;
}


html.dark-mode .main-header {
    background-color: rgba(5, 1, 10, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 22px -16px rgba(0, 0, 0, 0.75);
}

html.dark-mode .main-footer {
    background-color: rgba(10, 5, 20, 0.9);
    border-top: 1px solid var(--dark-mode-glass-border);
    backdrop-filter: blur(10px);
}

html.dark-mode .footer-logo a {
    color: var(--dark-mode-text) !important;
}

html.dark-mode .footer-col a {
    color: var(--dark-mode-text-light);
}

html.dark-mode .footer-col a:hover {
    color: var(--primary-color);
}

html.dark-mode input:-webkit-autofill,
html.dark-mode input:-webkit-autofill:hover,
html.dark-mode input:-webkit-autofill:focus,
html.dark-mode input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--dark-mode-bg-secondary) inset !important;
    -webkit-text-fill-color: var(--dark-mode-text) !important;
}

html.dark-mode .password-strength li { color: #f87171; /* red-400 */ }
html.dark-mode .password-strength li.valid { color: #4ade80; } /* green-400 */

html.dark-mode ::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

html.dark-mode .btn-submit:disabled {
    opacity: 0.6;
}
html.dark-mode .btn-secondary {
    border-color: var(--dark-mode-border);
}
html.dark-mode .btn-secondary:hover {
    border-color: var(--text-light);
}
html.dark-mode .mrz-display {
    background-color: var(--dark-mode-bg-secondary);
    color: #a5b4fc;
}

html.dark-mode .verification-notice {
    background-color: #422006;
    color: #fef3c7;
    border-bottom-color: #b45309;
}
html.dark-mode .verification-notice .resend-btn {
    background-color: #fefce8;
    border-color: #facc15;
    color: #854d0e;
}
html.dark-mode .verification-notice .resend-btn:hover {
    color: #a16207;
    background-color: #fef9c3;
    border-color: #f59e0b;
}

/* IMPROVEMENT: Make "Install App" button more visible in dark mode */
html.dark-mode .nav-btn.nav-btn-outline {
    background-color: rgba(237, 233, 254, 0.1); /* Subtle violet glass effect */
    color: #c4b5fd; /* Lighter violet (violet-300) for text & icon */
    border-color: #a78bfa; /* Brighter violet (violet-400) for border */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

html.dark-mode .nav-btn.nav-btn-outline:hover {
    background-color: rgba(237, 233, 254, 0.2); /* Increase opacity on hover */
    border-color: #c4b5fd; /* Make border match the bright text color */
    transform: translateY(-2px); /* Re-apply transform for consistency */
    box-shadow: var(--shadow-glow); /* Add a nice glow on hover */
}

/* IMPROVEMENT: Make final CTA section less harsh in dark mode */
html.dark-mode #cta {
    background: var(--dark-mode-bg);
    color: #f9fafb; /* Use a brighter white for the main heading */
}
html.dark-mode #cta p {
    color: var(--dark-mode-text); /* Use the softer off-white for paragraph */
}


/* --- END DARK MODE --- */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    background-color: var(--secondary-color);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* --- LIQUID GLASS UTILITY --- */
.liquid-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

html.dark-mode .liquid-glass {
    background: var(--dark-mode-glass-bg); /* Use the opaque glass bg */
    border: 1px solid var(--dark-mode-glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.container-wrapper {
     max-width: 1280px;
     margin-left: auto;
     margin-right: auto;
     padding-left: 1.5rem;
     padding-right: 1.5rem;
}

/* --- PAGE LOADER --- */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}
#page-loader.loader-hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: breathe 2s ease-in-out infinite;
}
.loader-content .logo-text { font-size: 2rem; font-weight: 800; }
.loading-dots { display: flex; gap: 0.3rem; }
.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes pulse {
    0%, 100% { transform: scale(0.2); opacity: 0.5; }
    50% { transform: scale(1); opacity: 1; }
}

/* --- HEADER --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    box-shadow: 0 8px 22px -16px rgba(15, 23, 42, 0.24);
    z-index: 100;
    padding: 1rem 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, box-shadow var(--transition-speed);
    transform: translateZ(0); /* Force GPU compositing layer to fix fixed position bugs */
}
.main-header.header-hidden {
    transform: translateY(-100%);
}
.main-header.scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
}
.main-header .container-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-header.home-main-header .container-wrapper {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(300px, 430px) minmax(170px, 1fr);
    align-items: center;
    gap: 1.5rem;
}
.logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--text-color); }
.main-header .logo { justify-self: start; }
.logo-icon { width: 40px; height: 40px; object-fit: contain; }
.logo-text { font-size: 1.5rem; font-weight: 800; }
.main-nav { display: flex; align-items: center; gap: 0.5rem; justify-self: end; min-width: 0; }
#nav-items-container { display: flex; align-items: center; gap: 0.5rem; }
#logged-out-nav, #logged-in-nav { display: flex; align-items: center; gap: 0.5rem; }
.nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.2, 0.8, 0.2, 1);
    text-decoration: none;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}
.nav-btn-icon {
    width: 20px;
    height: 20px;
}

/* --- Global Search in Navbar --- */
.global-search-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-self: center;
    width: 100%;
    max-width: 430px;
    z-index: 1;
}
.search-form-desktop {
    display: none;
    width: 100%;
}
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.search-input-wrapper input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0.65rem 1.1rem 0.65rem 2.8rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-color);
    font-size: 0.9rem;
    color: var(--text-color);
    transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
    text-overflow: ellipsis;
}
.search-input-wrapper input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Search prompts should read as hints, not as pre-filled user input. */
.search-input-wrapper #global-search-input::placeholder,
#encyclopedia-search::placeholder,
.article-search input::placeholder {
    color: var(--text-light);
    font-weight: 400;
    opacity: 0.62;
}
.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.14), 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* Search focus layer shared by the main site and Encyclopedia pages. */
.global-search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(15, 23, 42, 0.52);
    /* Avoid a filtered full-viewport surface while the search dialog is open. */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
body.search-overlay-open .global-search-backdrop {
    opacity: 1;
    pointer-events: auto;
}
/* Keep the active search header above the dimming layer. */
body.search-overlay-open .main-header,
body.search-overlay-open .article-header {
    z-index: 200;
}
body.search-overlay-closing .main-header,
body.search-overlay-closing .article-header {
    z-index: 200;
}
.global-search-container.search-focus-active,
.global-search-container.mobile-search-active {
    z-index: 201;
}
.search-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--secondary-color);
    color: var(--text-color);
    cursor: pointer;
}
.search-close-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.search-close-btn svg { width: 18px; height: 18px; }

/* Static, crawlable article directory: visible without JavaScript and useful to readers. */
.encyclopedia-directory {
    margin-top: 1.5rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    box-shadow: var(--shadow);
}
.encyclopedia-directory-header h2 {
    margin: 0 0 0.5rem;
}
.encyclopedia-directory-header p {
    margin: 0 0 1.25rem;
    color: var(--text-light);
}
.encyclopedia-directory-group {
    border-top: 1px solid var(--border-color);
}
.encyclopedia-directory-group:last-child {
    border-bottom: 1px solid var(--border-color);
}
.encyclopedia-directory-group summary {
    cursor: pointer;
    padding: 1rem 0;
    font-weight: 750;
    color: var(--text-color);
}
.encyclopedia-directory-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 0.65rem 1.25rem;
    margin: 0;
    padding: 0 0 1.25rem;
    list-style: none;
}
.encyclopedia-directory-links a {
    display: inline-block;
    color: var(--primary-color);
    line-height: 1.45;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
.encyclopedia-directory-links a:hover {
    text-decoration: underline;
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}
#mobile-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
}
@media (min-width: 900px) {
    .search-form-desktop { display: block; }
    #mobile-search-toggle { display: none; }
}

@media (min-width: 900px) and (max-width: 1180px) {
    .main-header.home-main-header .container-wrapper {
        grid-template-columns: auto minmax(250px, 340px) auto;
        gap: 0.75rem;
    }
}

@media (min-width: 992px) and (max-width: 1250px) {
    .home-main-header #logged-in-nav .nav-btn .nav-btn-text {
        display: none;
    }
    .home-main-header #logged-in-nav .nav-btn {
        padding: 0.6rem;
    }
}

@media (max-width: 899px) {
    .main-header.home-main-header .container-wrapper {
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
    }
    .main-header.home-main-header .logo {
        flex: 1 1 auto;
        min-width: 0;
    }
    .global-search-container {
        width: 42px;
        max-width: 42px;
        flex: 0 0 42px;
        margin-left: 0;
        justify-self: auto;
    }
    .main-header.home-main-header .main-nav {
        flex: 0 0 auto;
        margin-left: 0;
    }
    .main-header.home-main-header #nav-items-container,
    .main-header.home-main-header #logged-out-nav,
    .main-header.home-main-header #logged-in-nav,
    .main-header.home-main-header .nav-inline-right {
        gap: 0.35rem;
    }
    .main-header.home-main-header .nav-btn-avatar,
    .main-header.home-main-header #mobile-search-toggle {
        width: 40px;
        height: 40px;
    }
    .global-search-container.mobile-search-active {
        width: 0;
        max-width: 0;
        flex-basis: 0;
        overflow: visible;
    }
    .global-search-container.mobile-search-active .search-form-desktop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 202;
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        height: 72px;
        padding: 0.75rem max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
        background: var(--card-bg);
        border-bottom: 1px solid var(--primary-color);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
    }
    .global-search-container.mobile-search-active .search-input-wrapper {
        flex: 1 1 auto;
        min-width: 0;
    }
    .global-search-container.mobile-search-active .search-input-wrapper input {
        width: 100%;
        height: 42px;
        background: var(--secondary-color);
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16);
    }
    .global-search-container.mobile-search-active #mobile-search-toggle {
        opacity: 0;
        pointer-events: none;
    }
    .global-search-container.mobile-search-active .search-close-btn {
        display: flex;
    }
}
html.dark-mode .search-input-wrapper input {
    background-color: var(--card-bg);
    border-color: var(--dark-border);
}
html.dark-mode .global-search-backdrop {
    background: rgba(0, 0, 0, 0.68);
}
html.dark-mode .global-search-container.mobile-search-active .search-form-desktop {
    background: var(--dark-mode-bg-secondary);
}

/* A softer header edge keeps the glass surface from reading like a rectangle. */
html.dark-mode .article-header {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 22px -16px rgba(0, 0, 0, 0.75);
}
@media (max-width: 899px) {
    .main-header,
    .article-header {
        border-bottom-color: transparent;
        box-shadow: 0 8px 18px -15px rgba(15, 23, 42, 0.24);
    }
    html.dark-mode .main-header,
    html.dark-mode .article-header {
        border-bottom-color: transparent;
        box-shadow: 0 8px 18px -15px rgba(0, 0, 0, 0.8);
    }
}

/*
 * Header surfaces should not render as outlined rectangles.  The liquid-glass
 * utility is also used by cards, so scope this reset to the two page headers
 * and leave only a directional shadow to separate the header from the page.
 * This avoids OS/browser-specific corner compositing (especially on macOS).
 */
.main-header.liquid-glass,
.article-header {
    border: 0;
    border-color: transparent;
    box-shadow: 0 12px 24px -22px rgba(15, 23, 42, 0.55);
}

html.dark-mode .main-header.liquid-glass,
html.dark-mode .article-header {
    border: 0;
    border-color: transparent;
    box-shadow: 0 12px 24px -22px rgba(0, 0, 0, 0.95);
}

@media (max-width: 899px) {
    .main-header.liquid-glass,
    .article-header {
        border: 0;
        box-shadow: 0 10px 20px -20px rgba(15, 23, 42, 0.48);
    }

    html.dark-mode .main-header.liquid-glass,
    html.dark-mode .article-header {
        border: 0;
        box-shadow: 0 10px 20px -20px rgba(0, 0, 0, 0.9);
    }
}

/* Always-visible right cluster (messages + profile) */
.nav-inline-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn.nav-btn-secondary { background-color: transparent; color: var(--text-light); }
.nav-btn.nav-btn-secondary:hover { color: var(--text-color); background-color: var(--secondary-color); }
.nav-btn.nav-btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}
html.dark-mode .nav-btn.nav-btn-primary {
    color: #fff; /* Ensure contrast on dark button */
}

.nav-btn.nav-btn-primary:hover { 
    background-color: var(--primary-hover); 
    transform: translateY(-2px); 
    box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.3);
}

.nav-btn-avatar {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    width: 44px;
    height: 44px;
    transition: border-color var(--transition-speed);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-btn-avatar:hover {
    border-color: var(--primary-color);
}
.nav-btn-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#unread-messages-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background-color: var(--danger);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--white);
    transform: scale(1);
    transition: transform 0.2s ease-in-out;
}
#unread-messages-badge.popping {
    transform: scale(1.2);
}

/* --- MAIN CONTENT & VIEW TRANSITIONS --- */
main {
    padding-top: 74px; /* Matches header height */
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease-in 0.3s;
}
body.loaded main {
    opacity: 1;
}
main:has(> .legal-container) {
    opacity: 1;
}

/* --- MICRO ANIMATIONS --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.floating-element {
    animation: floating 6s ease-in-out infinite;
}
@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* --- GRADIENT TEXT --- */
.gradient-text {
    background: linear-gradient(135deg, var(--text-color) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}
html.dark-mode .gradient-text {
    background: linear-gradient(135deg, #ffffff 0%, #e2b6ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(226, 182, 255, 0.3);
}

/* --- BUTTON UPGRADES --- */
.liquid-glass-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 50px; /* More pill-shaped */
}
.liquid-glass-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}
.liquid-glass-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(45deg) translateY(-100%);
    transition: transform 0.6s ease;
}
.liquid-glass-btn:hover::after {
    transform: rotate(45deg) translateY(100%);
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }
.view-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.view-fade-out { animation: fadeOut 0.4s ease-in forwards; }

.section { padding: 4rem 0; }
@media (min-width: 768px) { .section { padding: 6rem 0; } }

/* Hero Section */
#hero {
    padding-top: 6rem;
    padding-bottom: 6rem;
    background-color: #f9fafb; /* gray-50 */
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
}
html.dark-mode #hero {
    background-color: var(--dark-mode-bg);
}
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
#hero .container-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 4rem;
    text-align: center;
    position: relative;
    z-index: 1;
    width: 100%;
    transform: translateY(-2.5rem); /* Đẩy nhẹ nội dung lên trên một chút cho cân đối */
}
@media (min-width: 992px) {
    #hero .container-wrapper { grid-template-columns: 1fr 1fr; text-align: left; }
}
#hero h1 { 
    font-size: clamp(2.5rem, 6vw, 4rem); 
    font-weight: 800; 
    line-height: 1.1; 
    color: var(--text-color); 
    margin: 0 0 1.5rem; 
    letter-spacing: -0.05em;
}
#hero h1 .highlight { 
    background: linear-gradient(45deg, var(--primary-color), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
#hero .subtitle { font-size: 1.25rem; color: var(--text-light); max-width: 550px; margin: 0 0 2.5rem; line-height: 1.7; }
@media (max-width: 991px) {
    #hero h1, #hero .subtitle { margin-left: auto; margin-right: auto; }
}
#hero .cta-button { padding: 1rem 2.5rem; font-size: 1.1rem; }

.highlight-link {
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    transition: color 0.2s, background-color 0.2s;
}
.highlight-link:hover {
    color: var(--primary-hover);
    background-color: var(--primary-light);
    border-radius: 4px;
    text-decoration: none;
}

.card-visual-wrapper { perspective: 2000px; cursor: pointer; }
.aid-card-visual {
    width: 100%; max-width: 450px; aspect-ratio: 1.586; margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card-flipper.is-flipped {
    transform: rotateY(180deg);
}
.card-front, .card-back {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    border-radius: 1rem; overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15), 0 0 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.card-front img, .card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-back {
    transform: rotateY(180deg);
}

/* --- Why AIDCard (Sticky Scroll Section) --- */
.sticky-scroll-section {
    height: 300vh; /* 3 slides = 300vh */
    position: relative;
    background-color: var(--card-bg);
}
html.dark-mode .sticky-scroll-section {
    background-color: var(--dark-mode-bg-secondary);
}

/* Dynamic Backgrounds */
.dynamic-bg-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    overflow: hidden;
}
.dynamic-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    transform: scale(1.05); /* Ẩn viền mờ do filter blur tạo ra */
}
.dynamic-bg.active {
    opacity: 1;
}


.sticky-container {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    z-index: 1;
}
.sticky-track {
    position: relative;
    width: 100%;
    height: 100%;
}
.sticky-slide {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    pointer-events: none;
}
.sticky-slide.active-slide {
    pointer-events: auto;
    z-index: 10;
}
.sticky-slide .snap-image,
.sticky-slide .snap-text {
    opacity: 0;
    transform: translateY(60px);
    transition: all 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
    visibility: hidden;
}
.sticky-slide .snap-text {
    transition-delay: 0.15s;
}
.sticky-slide.active-slide .snap-image,
.sticky-slide.active-slide .snap-text {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}
.snap-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    text-align: center;
    width: 100%;
}
@media (min-width: 992px) {
    .snap-content {
        flex-direction: row;
        text-align: left;
        gap: 4rem;
    }
    .snap-image, .snap-text {
        flex: 1;
    }
}
.snap-image {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.snap-image img {
    width: 100%;
    max-width: 100%;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
}
@media (min-width: 992px) {
    .snap-image img {
        max-height: 60vh;
    }
}
.image-placeholder {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-weight: bold;
}
html.dark-mode .image-placeholder {
    background-color: var(--dark-mode-bg);
}
.snap-text h2 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    transition: color 0.3s ease;
}
.snap-text .subtitle-highlight {
    color: #f97316; /* orange-500 */
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
html.dark-mode .snap-text .subtitle-highlight {
    color: #fb923c; /* orange-400 */
}
.snap-text p {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.7;
    margin: 0;
    transition: color 0.3s ease;
}

/* Force white text when dynamic dark backgrounds are active (specifically for Light mode readability) */
#why-aidcard.dark-bg-active .snap-text h2,
#why-aidcard.dark-bg-active .snap-text p {
    color: #ffffff;
}

/* --- Ecosystem Links Section (New) --- */
#ecosystem-links {
    background-color: var(--secondary-color);
}
.ecosystem-links-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 768px) {
    .ecosystem-links-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.ecosystem-link-card {
    display: flex;
    flex-direction: column; 
    text-align: center;
    gap: 1.5rem; 
    padding: 2rem; 
    text-decoration: none;
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    transition: all 0.3s ease-in-out;
}
.ecosystem-link-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(var(--primary-color-rgb), 0.3);
}
.ecosystem-link-card img {
    width: 80px; height: 80px; object-fit: contain; border-radius: 0.75rem; 
    margin: 0 auto;
}
.ecosystem-link-card-content { flex-grow: 1; display: flex; flex-direction: column; }
.ecosystem-link-card-content h4 {
    margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 700; color: var(--text-color);
}
.ecosystem-link-card-content p {
    margin: 0; font-size: 0.95rem; color: var(--text-light); line-height: 1.6; flex-grow: 1;
}

/* Section Header */
.section-header { text-align: center; margin-bottom: 4rem; max-width: 700px; margin-left: auto; margin-right: auto; }
.section-header .eyebrow { color: var(--primary-color); font-weight: 700; margin-bottom: 0.5rem; display: block; letter-spacing: 0.1em; }
.section-header h2 { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; margin: 0 0 1rem; letter-spacing: -0.03em; }
.section-header p { font-size: 1.1rem; color: var(--text-light); line-height: 1.7; }

/* Features Section */
#ecosystem { background-color: var(--card-bg); }
.features-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem; 
}
.feature-card {
    background: var(--glass-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.feature-card:hover { 
    transform: translateY(-8px) scale(1.02); 
    box-shadow: var(--shadow-lg), var(--shadow-glow); 
    border-color: rgba(var(--primary-color-rgb), 0.3);
}
.feature-card .icon { 
    display: inline-flex; justify-content: center; align-items: center; 
    width: 56px; height: 56px; 
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white); 
    border-radius: 0.75rem; margin-bottom: 1.5rem; 
    box-shadow: 0 4px 10px rgba(var(--primary-color-rgb), 0.3);
}
.feature-card h3 { font-size: 1.3rem; margin: 0 0 0.75rem; font-weight: 700; }
.feature-card p { color: var(--text-light); line-height: 1.7; margin: 0; font-size: 1rem; }

/* --- Vision Section (New Timeline Design) --- */
#vision {
    background-color: #f9fafb;
    position: relative;
    overflow: hidden;
}
html.dark-mode #vision {
    background-color: var(--dark-mode-bg);
}
#vision-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.5;
}
#vision .container-wrapper {
    position: relative;
    z-index: 1;
}

.vision-timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}
.vision-timeline::after {
    content: ''; position: absolute; width: 4px; top: 0; bottom: 0; left: 50%; margin-left: -2px; border-radius: 2px;
    background: linear-gradient(to bottom, var(--primary-light), var(--primary-color), var(--primary-light));
}
.timeline-item {
    padding: 1rem 3rem; position: relative; background-color: inherit; width: 50%;
}
.timeline-item:nth-child(odd) { left: 0; padding-right: 50px; }
.timeline-item:nth-child(even) { left: 50%; padding-left: 50px; }
.timeline-item::after {
    content: ''; position: absolute; width: 24px; height: 24px; right: -12px; background-color: var(--card-bg);
    border: 4px solid var(--primary-color); top: 30px; border-radius: 50%; z-index: 1;
    transition: transform 0.3s, background-color 0.3s;
}
.timeline-item:nth-child(even)::after { left: -12px; }
.timeline-item:hover::after { transform: scale(1.2); background-color: var(--primary-light); }
.timeline-content {
    padding: 2rem; background: var(--glass-bg); position: relative; border-radius: var(--border-radius);
    border: 1px solid var(--glass-border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow); transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.timeline-item:hover .timeline-content {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(var(--primary-color-rgb), 0.3);
}
.timeline-icon {
    width: 50px; height: 50px; background-color: var(--primary-light); color: var(--primary-color);
    border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem;
}
.timeline-content h3 { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5rem; }
.timeline-content p { color: var(--text-light); line-height: 1.6; margin: 0; font-size: 0.95rem; }

@media screen and (max-width: 768px) {
    .vision-timeline::after { left: 20px; }
    .timeline-item { width: 100%; padding-left: 50px; padding-right: 1rem; }
    .timeline-item:nth-child(odd), .timeline-item:nth-child(even) { left: 0; padding-left: 60px; }
    .timeline-item::after, .timeline-item:nth-child(even)::after, .timeline-item:nth-child(odd)::after { left: 8px; }
}

/* Trust Section */
#trust { background-color: var(--card-bg); text-align: center; }
#trust h3 { color: var(--text-light); font-weight: 600; margin-bottom: 3rem; letter-spacing: 0.1em; }
.logos { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4rem; }
.logos img { max-height: 40px; filter: grayscale(1) brightness(1.5); opacity: 0.8; transition: all 0.3s; }
.logos img:hover { filter: grayscale(0) brightness(1); opacity: 1; transform: scale(1.1); }
html.dark-mode .logos img { filter: grayscale(1) brightness(3); opacity: 0.6; }
html.dark-mode .logos img:hover { filter: grayscale(0) brightness(1); opacity: 1; }

/* CTA Section */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes aurora-flow-1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(100px, 80px) scale(1.1); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes aurora-flow-2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-120px, -60px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

#cta {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-hover), #a855f7, var(--primary-color));
    background-size: 300% 300%;
    animation: gradient-shift 15s ease infinite;
    color: var(--white);
    text-align: center;
    position: relative;
    overflow: hidden;
}
html.dark-mode #cta {
    color: #fff;
}

#cta::before, #cta::after {
    content: ''; 
    position: absolute; 
    border-radius: 50%; 
    filter: blur(120px);
}
#cta::before {
    width: 500px; 
    height: 500px; 
    background: rgba(255, 255, 255, 0.15); 
    top: -200px; 
    left: -200px;
    animation: aurora-flow-1 20s ease-in-out infinite alternate;
}
#cta::after {
    width: 400px; 
    height: 400px; 
    background: rgba(167, 139, 250, 0.25); 
    bottom: -200px; 
    right: -150px;
    animation: aurora-flow-2 25s ease-in-out infinite alternate;
}

#cta .container-wrapper { max-width: 700px; position: relative; z-index: 1; }
#cta h2 { font-size: 2.8rem; font-weight: 800; margin: 0 0 1rem; }
#cta p { font-size: 1.1rem; opacity: 0.9; margin: 0 0 2rem; }
#cta .cta-button {
    background-color: var(--card-bg); color: var(--primary-color);
    padding: 1rem 2.5rem; font-size: 1.1rem;
}
html.dark-mode #cta .cta-button {
    background-color: #fff;
    color: var(--primary-color);
}
#cta .cta-button:hover { background-color: #f5f3ff; transform: scale(1.05); }

/* Footer */
.main-footer {
    background-color: var(--text-color);
    color: #9ca3af;
    padding: 4rem 0 2rem;
}
.footer-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid #374151;
}
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(5, 1fr); } }
.footer-col h4 { font-size: 1rem; font-weight: 600; color: var(--white); margin: 0 0 1.25rem; }
html.dark-mode .footer-col h4 { color: #fff; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.75rem; }
.footer-col a { color: inherit; text-decoration: none; transition: color 0.2s; }
.footer-col a:hover { color: var(--primary-color); }
.footer-bottom { text-align: center; padding-top: 2rem; font-size: 0.9rem; }


/* --- DASHBOARD & OTHER VIEWS (Mostly unchanged) --- */
#dashboard-view { padding: 2rem 0 4rem; }
#dashboard-view .container-wrapper { max-width: 1024px; }
.profile-toolbar { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; padding: 2rem; background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 2rem; box-shadow: var(--shadow); }
@media (min-width: 768px) { .profile-toolbar { flex-direction: row; align-items: center; } }
.profile-avatar-container { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.profile-avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 4px solid var(--white); box-shadow: var(--shadow); }
html.dark-mode .profile-avatar-img { border-color: var(--dark-mode-bg); }
.avatar-upload-btn { position: absolute; bottom: 5px; right: 5px; width: 36px; height: 36px; background-color: var(--primary-color); color: var(--white); border: 2px solid var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition-speed); box-shadow: var(--shadow); }
html.dark-mode .avatar-upload-btn { border-color: var(--dark-mode-bg); color: #fff;}
.avatar-upload-btn:hover { background-color: var(--primary-hover); transform: scale(1.1); }
.avatar-upload-btn svg { width: 20px; height: 20px; }
.profile-nav-container { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 100%; }
@media (min-width: 768px) { .profile-nav-container { align-items: flex-start; } }
#profile-display-name { margin: 0; font-size: 1.75rem; font-weight: 700; }
.profile-nav-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.profile-nav-tab { padding: 0.6rem 1.2rem; font-weight: 600; border-radius: 0.5rem; border: 1px solid transparent; background-color: transparent; color: var(--text-light); cursor: pointer; transition: all var(--transition-speed); text-decoration: none; }
.profile-nav-tab:hover { background-color: var(--secondary-hover); color: var(--text-color); }
.profile-nav-tab.active { background-color: var(--primary-light); color: var(--primary-color); font-weight: 700; }
.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; animation: fadeIn 0.5s ease-out; }
.dashboard-card { background-color: var(--card-bg); padding: 1.5rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.dashboard-card-header { border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.dashboard-card h2 { margin: 0; font-size: 1.25rem; }
.guide-link { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text-light); text-decoration: none; font-weight: 500; font-size: 0.9rem; transition: color 0.2s; }
.guide-link:hover { color: var(--primary-color); text-decoration: underline; }
.pet-list-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 1rem; border-radius: 0.5rem; transition: background-color 0.2s; border-bottom: 1px solid var(--border-color); gap: 1rem; }
.pet-list-item:last-child { border-bottom: none; }
.pet-list-item:hover { background-color: var(--secondary-color); }
.pet-list-item p { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.status-badge { padding: 0.25rem 0.6rem; font-size: 0.8rem; font-weight: 600; border-radius: 999px; }
.status-badge.pending { background-color: var(--warning); color: var(--white); }
.status-badge.approved { background-color: var(--success); color: var(--white); }
.status-badge.rejected { background-color: var(--danger); color: var(--white); }
.status-badge.info { background-color: var(--info); color: var(--white); }

/* --- PENDING PET REQUESTS BANNER --- */
.pending-requests-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(251, 191, 36, 0.06));
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    animation: pendingSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes pendingSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.pending-requests-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}
.pending-requests-header svg {
    flex-shrink: 0;
    color: var(--warning);
}
.pending-requests-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--warning);
}
.pending-requests-header .pending-count-badge {
    background-color: var(--warning);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    margin-left: auto;
}
.pending-request-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all var(--transition-speed);
}
.pending-request-item:last-child { margin-bottom: 0; }
.pending-request-item:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}
.pending-request-item .pending-pet-name {
    font-weight: 600;
    color: var(--text-color);
    flex-grow: 1;
}
.pending-request-item .pending-pet-detail {
    font-size: 0.875rem;
    color: var(--text-light);
}
.pending-request-item .status-badge {
    flex-shrink: 0;
}

html.dark-mode .pending-requests-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(251, 191, 36, 0.04));
    border-color: rgba(245, 158, 11, 0.2);
}
html.dark-mode .pending-requests-header {
    border-bottom-color: rgba(245, 158, 11, 0.1);
}
html.dark-mode .pending-request-item {
    background-color: var(--dark-mode-bg);
}

/* --- CHECK ELIGIBILITY BUTTON --- */
.btn-check-eligibility {
    background-color: transparent;
    color: var(--warning);
    border: 1.5px solid var(--warning);
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}
.btn-check-eligibility:hover {
    background-color: var(--warning);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25);
}

/* --- ELIGIBILITY CHECKLIST POPUP --- */
.eligibility-checklist-container {
    text-align: left;
}
.eligibility-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.eligibility-progress-bar {
    flex-grow: 1;
    height: 8px;
    background-color: var(--secondary-color);
    border-radius: 999px;
    overflow: hidden;
}
.eligibility-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), var(--success));
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.eligibility-progress-text {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}
.eligibility-group {
    margin-bottom: 1rem;
}
.eligibility-group:last-child {
    margin-bottom: 0;
}
.eligibility-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}
.eligibility-group-title svg {
    color: var(--primary-color);
    flex-shrink: 0;
}
.eligibility-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.eligibility-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    margin-bottom: 0.15rem;
}
.eligibility-item:hover {
    background-color: var(--secondary-color);
}
.eligibility-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}
.eligibility-label {
    font-size: 0.9rem;
    color: var(--text-color);
}
.eligibility-item.completed .eligibility-label {
    color: var(--text-light);
    text-decoration: line-through;
    text-decoration-color: var(--success);
}
.eligibility-item.missing .eligibility-label {
    font-weight: 500;
    color: var(--text-color);
}
html.dark-mode .eligibility-item:hover {
    background-color: var(--dark-mode-bg);
}

/* --- MODALS & FORMS --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(17, 24, 39, 0.6); display: flex; justify-content: center; align-items: flex-start; opacity: 0; pointer-events: none; visibility: hidden; transition: opacity var(--transition-speed) ease, visibility 0s linear var(--transition-speed); z-index: 999; overflow-y: auto; padding: 2rem 1rem; }
.modal-overlay.show { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity var(--transition-speed) ease; }
.modal-content { background: var(--card-bg); padding: 2.5rem; border-radius: var(--border-radius); width: 100%; max-width: 500px; opacity: 0; transform: scale(0.95) translateY(10px); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease; }
.modal-overlay.show .modal-content { opacity: 1; transform: scale(1) translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { margin: 0; font-size: 1.5rem; }
.close-modal { font-size: 2rem; font-weight: 300; color: var(--text-light); cursor: pointer; border: none; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: flex; justify-content: center; align-items: center; line-height: 1; padding-bottom: 4px; transition: background-color 0.2s, color 0.2s; }
.close-modal:hover { background-color: var(--secondary-hover); color: var(--text-color); }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--card-bg);
    color: var(--text-color);
}
.form-group input[readonly], .form-group textarea[readonly], .form-group select:disabled { background-color: var(--secondary-color); cursor: default; color: var(--text-light); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-light); }
.form-group textarea { resize: vertical; min-height: 80px; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active { -webkit-box-shadow: 0 0 0 30px var(--white) inset !important; -webkit-text-fill-color: var(--text-color) !important; }
.password-strength { list-style: none; padding: 0; margin-top: 0.5rem; font-size: 0.85rem; }
.password-strength li { color: var(--danger); transition: color 0.3s; }
.password-strength li.valid { color: var(--success); text-decoration: line-through; }
#captcha-group { display: flex; align-items: center; gap: 1rem; }
#captcha-question { font-weight: 700; padding: 0.75rem; background: var(--secondary-color); border-radius: 0.5rem; }
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-weight: 700; cursor: pointer; transition: all 0.2s; text-decoration: none; box-sizing: border-box; border: none; text-align: center; }
.btn-submit { width: 100%; padding: 0.8rem; background-color: var(--primary-color); color: var(--white); border: none; border-radius: 0.5rem; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.2s; }
html.dark-mode .btn-submit { color: #fff; }
.btn-submit:hover { background-color: var(--primary-hover); box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3); transform: translateY(-2px); }
.btn-submit:disabled { background-color: #a78bfa; cursor: not-allowed; }

/* --- BUTTON LOADING STATE --- */
.btn-submit.loading, .btn.loading { color: transparent !important; pointer-events: none; position: relative; }
.btn-submit.loading::after, .btn.loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin-left: -12px; margin-top: -12px; border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: var(--white); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-secondary { background-color: var(--secondary-color); color: var(--text-color); border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: var(--secondary-hover); border-color: #9ca3af; }
.btn-danger { background-color: var(--danger); color: var(--white); }
.btn-danger:hover { background-color: #dc2626; }
.btn-warning { background-color: var(--warning); color: var(--white); }
.btn-warning:hover { background-color: #d97706; }
.auth-method-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: .55rem; }
.auth-method-option { position: relative; display: flex; align-items: center; gap: .7rem; min-height: 66px; padding: .75rem .85rem; border: 1px solid var(--border-color); border-radius: .8rem; background: var(--secondary-color); cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .2s, transform .2s; }
.auth-method-option:hover { border-color: var(--primary-color); transform: translateY(-1px); }
.auth-method-option:focus-within { outline: 2px solid color-mix(in srgb, var(--primary-color) 45%, transparent); outline-offset: 2px; }
.auth-method-option:has(input:checked) { border-color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 12%, var(--secondary-color)); box-shadow: 0 0 0 1px var(--primary-color), 0 8px 22px rgba(124, 58, 237, .14); }
.auth-method-option input { position: absolute; opacity: 0; pointer-events: none; }
.auth-method-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--primary-color) 18%, transparent); color: var(--primary-color); font-size: 1.05rem; font-weight: 800; }
.auth-method-icon.google-icon { background: #fff; color: #4285f4; font-family: Arial, sans-serif; }
.auth-method-copy { display: flex; min-width: 0; flex-direction: column; gap: .15rem; }
.auth-method-copy strong { color: var(--text-color); font-size: .95rem; }
.auth-method-copy small { color: var(--text-light); font-size: .76rem; line-height: 1.25; }
.auth-method-check { display: grid; place-items: center; width: 20px; height: 20px; margin-left: auto; border: 1px solid var(--border-color); border-radius: 50%; color: transparent; font-size: .75rem; font-weight: 800; }
.auth-method-option:has(input:checked) .auth-method-check { border-color: var(--primary-color); background: var(--primary-color); color: #fff; }
.link-button { margin-top: .45rem; padding: 0; border: 0; background: none; color: var(--primary-color); cursor: pointer; font: inherit; font-weight: 600; }
.link-button:hover { text-decoration: underline; }
@media (max-width: 600px) { .auth-method-options { grid-template-columns: 1fr; } }
.modal-form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { #pet-modal .modal-content, #record-modal .modal-content { max-width: 800px; } .modal-form-grid { grid-template-columns: repeat(2, 1fr); } }

/* --- OTHER VIEWS (Unchanged, keep original styles) --- */
#crop-container { flex-grow: 1; min-height: 0; display: flex; justify-content: center; align-items: center; background-color: var(--secondary-color); border-radius: var(--border-radius); overflow: hidden; width: 100%; }
#image-to-crop { display: block; max-width: 100%; }
.cropper-view-box { box-shadow: 0 0 0 1px #3875ff; border-radius: 4px; outline: 5000px solid rgba(0, 0, 0, 0.5); outline-color: rgba(0, 0, 0, 0.5); }
.cropper-face { background-color: transparent !important; }
#admin-view { padding: 2rem 0 4rem; }
.admin-tabs { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 2rem; }
.admin-tab { padding: 1rem 1.5rem; cursor: pointer; font-weight: 600; color: var(--text-light); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color .2s, border-color .2s; }
.admin-tab.active, .admin-tab:hover { color: var(--primary-color); }
.admin-tab.active { border-bottom-color: var(--primary-color); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; animation: fadeIn 0.5s; }
.admin-sub-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.admin-sub-tab { padding: 0.6rem 1rem; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--text-light); border: none; background: none; border-bottom: 3px solid transparent; transition: color .2s, background-color .2s, border-color .2s; }
.admin-sub-tab:hover { color: var(--primary-color); background-color: var(--secondary-color); }
.admin-sub-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.admin-search-form { display: flex; gap: 1rem; margin-bottom: 2rem; max-width: 600px; }
.admin-search-form input { flex-grow: 1; }
.admin-list-item { background: var(--card-bg); border: 1px solid var(--border-color); padding: 1.5rem; border-radius: var(--border-radius); margin-bottom: 1rem; box-shadow: var(--shadow); transition: opacity 0.3s; }
.admin-list-item h3 { margin-top: 0; }
.admin-list-item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.user-list-item { display: flex; justify-content: space-between; align-items: center; }
/* --- MESSAGING VIEW STYLES (MOBILE-FIRST & RESPONSIVE) --- */
#messages-view {
    height: calc(100vh - 74px); /* Full height minus header */
    height: calc(100dvh - 74px); /* Follow the visible viewport when the mobile keyboard opens */
    width: 100%;
}
.messages-layout {
    position: relative; /* Container for absolute positioning */
    height: 100%;
    width: 100%;
    background: var(--card-bg);
    overflow: hidden; /* Hides the off-screen panel */
}
/* --- Conversations List Panel --- */
.conversations-list {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    transform: translateX(0); /* Starts in view */
    z-index: 2;
    background-color: var(--card-bg); /* Ensure it has a background */
}
/* Slide out when a chat is active */
.messages-layout.chat-active .conversations-list {
    transform: translateX(-100%);
}
.conversations-header { padding: 1rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; }
.conversations-header h2 { margin: 0; font-size: 1.5rem; }
#new-message-btn { background: none; border: none; padding: 0.5rem; cursor: pointer; border-radius: 50%; color: var(--text-color); display: flex; align-items: center; justify-content: center; }
#new-message-btn:hover { background-color: var(--secondary-color); }
.conversations-body { overflow-y: auto; flex-grow: 1; }
.conversation-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; cursor: pointer; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s; }
.conversation-item:hover { background-color: var(--secondary-color); }
.conversation-item.active { background-color: var(--primary-light); }
.conversation-item-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.conversation-item-details { flex-grow: 1; overflow: hidden; }
.conversation-item-details .name { font-weight: 600; white-space: nowrap; }
.conversation-item-details .last-message { color: var(--text-light); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item-unread { width: 12px; height: 12px; background-color: var(--primary-color); border-radius: 50%; flex-shrink: 0; }
.new-message-policy-note {
    margin: 0.55rem 0 0;
    color: var(--text-light);
    font-size: 0.84rem;
    line-height: 1.5;
}
/* --- Chat Window Panel --- */
.chat-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--secondary-color);
    transition: transform 0.3s ease-in-out;
    transform: translateX(100%); /* Starts off-screen */
    z-index: 1;
}
/* Slide in when a chat is active */
.messages-layout.chat-active .chat-window {
    transform: translateX(0);
    z-index: 3;
}
.chat-window-placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: var(--text-light); text-align: center; padding: 2rem; }
.chat-window-placeholder svg { width: 80px; height: 80px; margin-bottom: 1rem; color: var(--border-color); }
.chat-header { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background-color: var(--card-bg); border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.chat-header-back-btn {
    display: flex; /* Visible on mobile */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
}
.chat-messages { flex-grow: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; }
.message-bubble { display: inline-block; max-width: clamp(260px, 70%, 640px); padding: 0.75rem 1rem; border-radius: 1.25rem; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.message-bubble-container { display: flex; margin-bottom: 0.25rem; width: 100%; }
.message-bubble-container.sent { justify-content: flex-end; }
.message-bubble-container.received { justify-content: flex-start; align-items: flex-end; gap: 0.5rem; }
.chat-message-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; transition: visibility 0.1s; }
.message-bubble.sent { background-color: var(--primary-color); color: var(--white); border-bottom-right-radius: 0.5rem; }
html.dark-mode .message-bubble.sent { color: #fff; }
.message-bubble.received { background-color: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color); border-bottom-left-radius: 0.5rem; }
.message-form { display: flex; gap: 0.5rem; padding: 1rem; background-color: var(--card-bg); border-top: 1px solid var(--border-color); flex-shrink: 0; align-items: flex-end; }
textarea#message-input { flex-grow: 1; border: 1px solid var(--border-color); border-radius: 22px; padding: 0.6rem 1rem; font-size: 1rem; font-family: inherit; line-height: 1.5; resize: none; overflow-y: auto; max-height: 7.2rem; }
textarea#message-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-light); }
#send-message-btn { background: var(--primary-color); border: none; color: white; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.2s; flex-shrink: 0; }
#send-message-btn:hover { background-color: var(--primary-hover); }
.load-more-container { text-align: center; padding: 0.5rem 0; }
.load-more-btn { background-color: var(--secondary-hover); color: var(--text-color); border: none; padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer; font-weight: 600; transition: background-color 0.2s; }
.load-more-btn:hover { background-color: var(--border-color); }
.load-more-btn.loading { color: transparent !important; pointer-events: none; position: relative; }
.load-more-btn.loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin-left: -10px; margin-top: -10px; border: 2px solid rgba(0, 0, 0, 0.2); border-top-color: var(--primary-color); border-radius: 50%; animation: spin 0.8s linear infinite; }
html.dark-mode .load-more-btn.loading::after { border-color: rgba(255,255,255,0.2); border-top-color: var(--primary-color); }
.message-content-wrapper { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.message-bubble-container.sent .message-content-wrapper { align-items: flex-end; }
.message-bubble-container.received .message-content-wrapper { align-items: flex-start; }
.message-line { display: flex; align-items: flex-end; gap: 0.3rem; max-width: 100%; }
.message-bubble-container.sent .message-line { justify-content: flex-end; }
.chat-time-divider {
    align-self: center;
    margin: 0.8rem 0 0.65rem;
    color: var(--text-light);
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
}
.message-delivery-status {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    margin-bottom: 0.15rem;
    color: var(--text-light);
}
.message-delivery-status svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.message-delivery-status.pending { opacity: 0.78; }
.message-delivery-status.sent { color: var(--primary-color); }
.message-delivery-status.sent .delivery-fill { fill: currentColor; stroke: none; }
.message-delivery-status.sent .delivery-check-solid { fill: none; stroke: #fff; stroke-width: 1.8; }
.message-delivery-status.failed { color: var(--danger); }
/* --- RESPONSIVE DESKTOP STYLES FOR MESSAGING --- */
@media (min-width: 992px) {
    .messages-layout {
        display: flex; /* Revert to flexbox layout */
        position: static;
        overflow: visible;
    }
    .conversations-list {
        position: static;
        width: 35%;
        max-width: 380px;
        transform: none !important; /* Override mobile transform */
        flex-shrink: 0;
        z-index: auto;
    }
    .chat-window {
        position: static;
        width: auto;
        flex-grow: 1;
        transform: none !important; /* Override mobile transform */
        z-index: auto;
    }
    .chat-header-back-btn {
        display: none !important; /* Hide back button on desktop */
    }
}
#pet-profile-view { padding: 2rem 0 4rem; }
.pet-profile-header { position: sticky; top: 77px; z-index: 100; background: var(--card-bg); display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; padding: 1rem 0; border-bottom: 1px solid var(--border-color); }
.pet-profile-header h1 { margin: 0; font-size: 2rem; font-weight: 800; flex-grow: 1; }
#pet-profile-back-btn { background: none; border: none; cursor: pointer; padding: 0.5rem; border-radius: 50%; color: var(--text-color); display: flex; align-items: center; justify-content: center; }
#pet-profile-back-btn:hover { background-color: var(--secondary-color); }
.pet-profile-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 992px) { .pet-profile-layout { grid-template-columns: 400px 1fr; } }
.pet-profile-images { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.pet-profile-image-box { position: relative; border-radius: var(--border-radius); overflow: hidden; background-color: var(--secondary-color); border: 1px solid var(--border-color); }
.pet-profile-image-box.main-avatar { aspect-ratio: 3 / 4; }
.pet-profile-image-box.ident-photo { aspect-ratio: 4 / 5; }
.pet-profile-image-box img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s; }
.pet-profile-image-box .placeholder-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30%; height: 30%; color: var(--border-color); }
.upload-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(17, 24, 39, 0); color: rgba(255, 255, 255, 0); display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; transition: all 0.3s; opacity: 0; }
.pet-profile-image-box:hover .upload-overlay { background-color: rgba(17, 24, 39, 0.6); color: rgba(255, 255, 255, 1); opacity: 1; }
.upload-overlay.loading { background-color: rgba(17, 24, 39, 0.8); opacity: 1; pointer-events: none; }
.upload-overlay.loading::after { content: ''; width: 40px; height: 40px; border: 4px solid rgba(255, 255, 255, 0.3); border-top-color: var(--white); border-radius: 50%; animation: spin 1s linear infinite; }
.upload-overlay .upload-icon { width: 48px; height: 48px; margin-bottom: 0.5rem; }
.upload-overlay.loading .upload-icon, .upload-overlay.loading span { display: none; }
.pet-profile-details { background-color: var(--card-bg); padding: 2rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); align-self: flex-start; }
.pet-profile-details-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .pet-profile-details-grid { grid-template-columns: repeat(2, 1fr); } }
.detail-item { font-size: 1rem; }
.detail-item strong { display: block; color: var(--text-light); font-weight: 500; margin-bottom: 0.25rem; }
.detail-item span { font-size: 1.1rem; font-weight: 600; color: var(--text-color); }
#pet-profile-mrz-container { grid-column: 1 / -1; }
#pet-profile-mrz { font-family: monospace; background-color: var(--secondary-color); padding: 1rem; border-radius: 0.5rem; white-space: pre; overflow-x: auto; font-size: 1rem; line-height: 1.6; }
.pet-profile-admin-actions { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); display: flex; flex-wrap: wrap; gap: 1rem; }
.health-records-section { margin-top: 2rem; background-color: var(--card-bg); padding: 2rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.health-records-section h2 { margin-top: 0; margin-bottom: 1.5rem; font-size: 1.5rem; font-weight: 700; }
.health-records-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.health-records-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.health-records-tab { padding: 0.6rem 1.2rem; font-weight: 600; border-radius: 0.5rem; border: 1px solid transparent; background-color: transparent; color: var(--text-light); cursor: pointer; transition: all var(--transition-speed); }
.health-records-tab:hover { background-color: var(--secondary-hover); color: var(--text-color); }
.health-records-tab.active { background-color: var(--primary-light); color: var(--primary-color); font-weight: 700; }
#add-record-btn { width: auto; padding: 0.6rem 1.2rem; font-size: 0.9rem; }
.health-records-table-wrapper { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
.health-records-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.health-records-table th, .health-records-table td { border: 1px solid var(--border-color); padding: 0.75rem; text-align: left; vertical-align: top; white-space: nowrap; }
.health-records-table th { background-color: var(--secondary-color); font-weight: 600; }
.health-records-table td { color: var(--text-light); white-space: normal; }
.record-actions { display: flex; gap: 0.5rem; align-items: center; }
.record-actions .btn { padding: 0.3rem 0.6rem; font-size: 0.8rem; font-weight: 600; }
.no-records-message { text-align: center; color: var(--text-light); padding: 2rem; background-color: var(--secondary-color); border-radius: var(--border-radius); margin-top: 1rem; }

/* --- UTILITIES --- */
body.modal-open { overflow: hidden; }
body.mobile-menu-open { overflow: hidden; }
.hidden { display: none !important; }
.toast-notification { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(calc(100% + 20px)); padding: 1rem 1.5rem; border-radius: 0.5rem; color: var(--white); font-weight: 500; box-shadow: var(--shadow-lg); transition: transform 0.5s ease-in-out; z-index: 1000; }
html.dark-mode .toast-notification { color: #fff !important; }
.toast-notification.show { transform: translateX(-50%) translateY(0); }
.toast-notification.success { background-color: var(--success); }
.toast-notification.error { background-color: var(--danger); }
.verification-notice { background-color: #fefce8; color: #a16207; padding: 1rem 0; border-bottom: 1px solid #fde047; display: none; }
.verification-notice.show { display: block; animation: fadeIn 0.5s ease-out; }
.verification-notice .container-wrapper { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.verification-notice p { margin: 0; line-height: 1.6; flex-grow: 1; }
.verification-notice .resend-btn { font-weight: 600; text-decoration: none; cursor: pointer; background-color: var(--card-bg); border: 1px solid #facc15; color: #854d0e; padding: 0.6rem 1.2rem; font-size: 0.9rem; border-radius: 0.5rem; transition: all 0.2s ease-in-out; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.verification-notice .resend-btn:hover { color: #a16207; background-color: #fef9c3; border-color: #f59e0b; transform: translateY(-1px); box-shadow: var(--shadow); }

/* --- MOBILE NAVIGATION (ICON BUTTONS) --- */
@media (max-width: 991px) {
    #logged-in-nav .nav-btn .nav-btn-text {
        display: none;
    }
    #logged-in-nav .nav-btn {
        padding: 0.6rem; /* Make it more square-like */
    }
    .main-nav, #nav-items-container, .nav-inline-right {
        gap: 0.25rem; /* Reduce gap to fit more icons */
    }
}

/* --- SCROLL ANIMATIONS --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}
.scroll-animate { opacity: 0; transform: translateY(40px); transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.scroll-animate.is-visible { opacity: 1; transform: translateY(0); }
.scroll-animate.stagger-1 { transition-delay: 0.15s; }
.scroll-animate.stagger-2 { transition-delay: 0.3s; }
.scroll-animate.stagger-3 { transition-delay: 0.45s; }

/* --- LANDING PAGE SPECIFIC --- */
.hero-cta-group { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
@media (max-width: 991px) { .hero-cta-group { justify-content: center; } }
#install-app-wrapper { position: relative; }
.nav-btn.nav-btn-outline { background-color: rgba(255,255,255,0.8); color: var(--primary-color); border: 1px solid var(--primary-color); display: flex; align-items: center; gap: 0.5rem; }
.nav-btn.nav-btn-outline:hover { background-color: var(--card-bg); transform: translateY(-2px); box-shadow: var(--shadow); }
.install-dropdown-menu { position: absolute; top: calc(100% + 10px); left: 0; min-width: 220px; background-color: var(--card-bg); border-radius: var(--border-radius); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); z-index: 10; padding: 0.5rem; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; }
.install-dropdown-menu.active { opacity: 1; transform: translateY(0); pointer-events: auto; }
.install-dropdown-menu .dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.5rem; cursor: pointer; transition: background-color 0.2s; color: var(--text-color); font-weight: 500; }
.install-dropdown-menu .dropdown-item:hover { background-color: var(--secondary-color); }
#install-modal-body h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-color); margin-top: 1.5rem; margin-bottom: 0.5rem; }
#install-modal-body ol { padding-left: 1.5rem; }
#install-modal-body li { margin-bottom: 0.75rem; }
#install-modal-body kbd { background-color: var(--secondary-color); border: 1px solid var(--border-color); border-radius: 4px; padding: 2px 6px; font-family: monospace; font-size: 0.9em; color: var(--text-color); }
.social-login-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0; color: var(--text-light); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.social-login-divider::before, .social-login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-color); }
.social-login-group { display:flex; flex-direction:column; gap:0.75rem; }
.social-btn { width:100%; display:inline-flex; align-items:center; justify-content:center; gap:0.5rem; padding:0.75rem 1rem; border:1px solid var(--border-color); border-radius:0.5rem; background:var(--card-bg); color:var(--text-color); font-weight:700; cursor:pointer; transition:background-color .2s, box-shadow .2s, transform .1s; }
.social-btn:hover { background-color: var(--secondary-color); }
.social-btn:active { transform: translateY(1px); }
.social-btn svg { flex:0 0 20px; }
.social-btn-google { border-color: var(--border-color); }
.social-btn[disabled] { opacity: .7; pointer-events: none; }
.social-btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; display: inline-block; animation: spin .9s linear infinite; }
.copy-btn { display: inline-flex; align-items: center; justify-content: center; margin-left: 6px; padding: 2px 6px; font-size: 0.8rem; border: 1px solid var(--primary-color); border-radius: 4px; background: transparent; color: var(--primary-color); cursor: pointer; transition: background 0.2s, color 0.2s; }
.copy-btn:hover { background: var(--primary-color); color: #fff; }
.copy-btn:active { transform: scale(0.95); }
.payment-details { text-align: left !important; margin: 0 auto; max-width: 360px; line-height: 1.65; color: var(--text-color); font-size: 0.95rem; }
.payment-details .price-line { margin: 0 0 0.25rem; }
.payment-details .bank-line { margin: 0.25rem 0 0.25rem; color: var(--text-light); }
.payment-details .meta-grid { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 0.35rem 0.75rem; margin-top: 0.5rem; }
.payment-details .meta-grid .label { color: var(--text-light); font-weight: 600; }
.payment-details .meta-grid .value { display: inline-flex; align-items: center; gap: 0.4rem; word-break: break-all; }
.payment-details .copy-btn { border: 1px solid var(--border-color); background: var(--card-bg); border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.8rem; cursor: pointer; }
.payment-details .copy-btn:hover { background: var(--secondary-color); }
.payment-details .reminder { margin-top: 0.9rem; padding: 0.6rem 0.75rem; border-left: 3px solid var(--info); background: #eff6ff; color: #1e3a8a; border-radius: 0.25rem; font-size: 0.9rem; }
@media (max-width: 480px) { .payment-details .meta-grid { grid-template-columns: 1fr; } }
.payment-modal { max-width: 600px !important; width: 90%; text-align: center; }
.payment-details { max-width: 500px; margin: 0 auto; }
.payment-details .value span { white-space: nowrap; }
.qr-box { position: relative; width: 100%; max-width: 500px; margin: 0 auto 1rem; }
.qr-box img#payment-qr-image { display: none; width: 100%; height: auto; border-radius: 0.5rem; }
.qr-skeleton { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 0.5rem; background: #f3f4f6; overflow: hidden; display: grid; place-items: center; margin-bottom: 1rem; }
html.dark-mode .qr-skeleton { background-color: #374151; }
.qr-shimmer { position: absolute; inset: 0; background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%); background-size: 200% 100%; animation: qrShimmer 1.2s infinite linear; opacity: 0.7; }
html.dark-mode .qr-shimmer { background: linear-gradient(90deg, #374151 0%, #4b5563 50%, #374151 100%); }
.qr-loading-text { position: relative; z-index: 1; color: var(--text-light); font-weight: 600; }
@keyframes qrShimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.qr-error { display: flex; align-items: center; gap: 0.5rem; justify-content: center; color: var(--danger); margin-top: 0.5rem; }
#open-healthbook-btn { display: none; }
@media (max-width: 991px) { #open-healthbook-btn { display: block; width: 100%; margin-top: 1rem; } #health-records-container { display: none; } }
@media (min-width: 992px) { #open-healthbook-btn { display: none; } }
@media (max-width: 991px) { #healthbook-modal #health-records-container { display: block !important; } }
.modal-overlay { z-index: 1000; }
#healthbook-modal { z-index: 900; }
.modal-overlay.stack-top { z-index: 1100; }
.qr-download-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.75rem; padding: 0.6rem 1rem; width: 100%; background: var(--primary-color); color: #fff; font-weight: 600; border: none; border-radius: 0.5rem; cursor: pointer; transition: background 0.25s ease, transform 0.15s ease; }
.qr-download-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.qr-download-btn:active { transform: translateY(0); }
.btn-submit.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-submit.is-loading:hover { transform: none; }
.btn-submit.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: aid-spin 0.8s linear infinite; will-change: transform; }
@keyframes aid-spin { to { transform: rotate(360deg); } }

#home-btn-nav { display: none !important; }

/* --- COMPREHENSIVE MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    /* Main Layout */
    .section { padding: 2.5rem 0; }
    
    /* Admin & User Lists layout */
    .admin-actions, .card-actions, .pet-profile-admin-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    .admin-actions .btn, .card-actions .btn, .pet-profile-admin-actions .btn {
        width: 100% !important;
        text-align: center;
    }
    
    /* Scrollable Tabs (admin, sub-tabs, health records) */
    .admin-tabs, .admin-sub-tabs, .health-records-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem; /* Room for scrollbar if visible */
        justify-content: flex-start;
    }
    /* Hide scrollbar for a cleaner look */
    .admin-tabs::-webkit-scrollbar, .admin-sub-tabs::-webkit-scrollbar, .health-records-tabs::-webkit-scrollbar {
        display: none;
    }
    .admin-tabs, .admin-sub-tabs, .health-records-tabs {
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }

    /* Profile nav tabs: stack vertically on mobile */
    .profile-nav-tabs {
        flex-direction: column;
        width: 100%;
    }
    .profile-nav-tabs .profile-nav-tab {
        width: 100%;
        text-align: center;
        white-space: normal;
    }
    
    /* Header nav tweaks */
    .main-nav { gap: 0.25rem; }
    .nav-btn { padding: 0.4rem 0.6rem; }

    /* Lists to stack */
    .user-list-item, .pet-list-item { 
        flex-direction: column; 
        align-items: flex-start; 
    }
    .user-list-item > div {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    .user-list-item .view-user-btn {
        width: 100% !important;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    /* Modals Padding */
    .modal-content {
        padding: 1.5rem !important;
    }
    
    /* Title and Header */
    #hero h1 { font-size: 2.2rem; }
    
    /* Logo adjustments */
    .logo-text { display: none; }
    
    /* Forms & Searh Bars */
    .admin-search-form { 
        flex-direction: column; 
    }
    .admin-search-form input, .admin-search-form select {
        width: 100%;
    }
    
    /* Pet Profile Detail Grid Spacing */
    .pet-profile-details {
        padding: 1rem;
    }
    .detail-item {
        font-size: 0.95rem;
    }
    
    /* Feature & Ecosystem cards padding */
    .feature-card, .ecosystem-link-card {
        padding: 1.5rem;
    }
}
