html, body { overflow-x: clip; }

body {
    background-color: #f8fafc;
    background-image: 
        radial-gradient(at 0% 0%, hsla(217,100%,94%,1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(160,100%,94%,1) 0px, transparent 50%);
    font-family: system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
    body {
        background-attachment: fixed;
    }
}

.fonts-loaded body { font-family: 'Inter', sans-serif; }
.fonts-loaded h1, .fonts-loaded h2, .fonts-loaded h3, .fonts-loaded h4 { font-family: 'Poppins', sans-serif; }

/* Header Styles */
.pro-header {
    position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); width: 95%; max-width: 1200px; height: 70px;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), inset 0 0 20px rgba(255, 255, 255, 0.5);
    border-radius: 9999px; z-index: 1000; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: slideDownFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.pro-header.scrolled {
    background: rgba(255, 255, 255, 0.98); border-color: rgba(99, 102, 241, 0.2); box-shadow: 0 20px 50px -12px rgba(99, 102, 241, 0.15);
}
@media (max-width: 768px) {
    .pro-header { height: 60px; top: 0.5rem; width: 95%; }
    .pro-header.scrolled { width: 95% !important; }
}
@media (min-width: 1024px) {
    .pro-header.scrolled { width: 90% !important; }
}
@keyframes slideDownFade {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}
.header-inner { width: 100%; height: 100%; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; position: relative; }

/* Mobile Specific Overrides */
@media (max-width: 768px) {
    .header-inner { padding: 0 12px; justify-content: space-between; }
    .logo-container { position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; }
    .logo-container:hover, .logo-container:active { transform: translate(-50%, -50%) !important; }
    .logo-img { height: 50px; }
    .right-actions { gap: 8px; }
    .auth-btn { padding: 6px 16px; font-size: 0.85rem; min-width: auto; }
}

.logo-container { display: flex; align-items: center; gap: 12px; text-decoration: none; transition: transform 0.2s; z-index: 20; }
.logo-container:hover { transform: scale(1.02); }
.logo-img { height: 65px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); transition: height 0.3s ease; }

.desktop-nav { display: none; align-items: center; gap: 12px; position: absolute; left: 50%; transform: translateX(-50%); }
@media (min-width: 900px) { .desktop-nav { display: flex; } }
.nav-icon-btn { position: relative; text-decoration: none; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.nav-icon-btn:hover { transform: translateY(-4px); }
.icon-box { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: all 0.3s ease; }
.right-actions { display: flex; align-items: center; gap: 12px; z-index: 20; }

.auth-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 24px;
    background-image: linear-gradient(to right, #6366f1, #ec4899, #6366f1); background-size: 200% auto;
    color: white; border: none; border-radius: 9999px; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35); min-width: 100px; position: relative; overflow: hidden; z-index: 1;
}
.auth-btn::after {
    content: ''; position: absolute; top: 0; left: -150%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transform: skewX(-20deg); transition: left 0.5s;
}
.auth-btn:hover { background-position: right center; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(236, 72, 153, 0.45); }
.auth-btn:hover::after { left: 150%; transition: left 0.6s ease-in-out; }
.auth-btn:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.auth-btn.is-authenticated {
    padding: 4px; padding-right: 10px; gap: 6px; min-width: auto; background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid rgba(203, 213, 225, 0.5);
}
.auth-btn.is-authenticated:hover { background: white; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.auth-btn.is-authenticated::after { display: none; }

.btn-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; margin: 0; flex-shrink: 0; aspect-ratio: 1 / 1; border: 1px solid #e2e8f0; }
.dropdown-indicator { color: #64748b; font-size: 0.75rem; transition: transform 0.2s; }

@media (max-width: 768px) { 
    .auth-btn { padding: 6px 16px; font-size: 0.85rem; min-width: auto; } 
    .auth-btn.is-authenticated { padding: 3px; padding-right: 8px; gap: 4px; }
    .btn-avatar { width: 28px; height: 28px; }
}

.desktop-emergency-btn { display: none; }
@media (min-width: 768px) { .desktop-emergency-btn { display: block; } }

.auth-dropdown, .emergency-dropdown-menu {
    position: absolute; top: 130%; width: 260px; background: white; border-radius: 24px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.03); opacity: 0; visibility: hidden;
    transform: translateY(-10px) scale(0.95); transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); z-index: 1100;
}
.auth-dropdown { right: 0; transform-origin: top right; }

.auth-dropdown.active, .emergency-dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.auth-dropdown.active ~ .auth-btn .dropdown-indicator { transform: rotate(180deg); }

.mobile-nav-item { display: flex; flex-direction: column; width: 100%; }
@media (min-width: 900px) { .mobile-nav-item { display: none !important; } }
.dropdown-header { padding: 12px 16px; background: #f9fafb; border-radius: 16px; margin-bottom: 6px; }
.user-name { display: block; font-weight: 700; color: #111827; font-size: 0.9rem; }
.user-email { display: block; font-size: 0.75rem; color: #6b7280; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: #4b5563; font-size: 0.95rem; font-weight: 500; border-radius: 12px; transition: all 0.2s; }
.dropdown-item:hover { background: #f3f4f6; color: #111827; }
.dropdown-item i.regular-icon { width: 20px; text-align: center; color: #9ca3af; }
.dropdown-item:hover i.regular-icon { color: #4f46e5; }
.dropdown-logo-box { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.dropdown-divider { height: 1px; background: #f3f4f6; margin: 6px 8px; }
.logout-btn { width: 100%; text-align: left; border: none; background: none; cursor: pointer; color: #ef4444; }
.logout-btn:hover { background: #fef2f2; color: #dc2626; }

/* Page Specific Styles */
.glass-card {
    background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgba(37, 99, 235, 0.15); border-color: rgba(59, 130, 246, 0.3); }
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

#loader { position: fixed; inset: 0; background: white; z-index: 9999; display: flex; justify-content: center; align-items: center; animation: loaderFade 0.6s ease 1.8s forwards; }
@keyframes loaderFade { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.loader-hidden { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; display: none !important; }
.spinner { width: 50px; height: 50px; border: 4px solid #eef2ff; border-top: 4px solid #4f46e5; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* SOS Custom Elements */
.sos-ripple-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #ef4444; animation: ripple 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite; }

/* Modal Slide Up Animation */
@keyframes slideUpFade { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.animate-slide-up-fade { animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }