/**
 * Modern Dating App UI - Mobile-First Design
 * Version: 2.0
 * 
 * Features:
 * - Bottom navigation bar for mobile (app-like)
 * - Glassmorphism effects
 * - Smooth animations
 * - Better touch targets
 * - Modern typography
 */

/* ============================================
   CSS Variables - Brand & Theme
   ============================================ */
:root {
    /* Brand Colors */
    --brand-primary: #C41C63;
    --brand-primary-light: #E91E8C;
    --brand-primary-dark: #9A1550;
    --brand-gradient: linear-gradient(135deg, #C41C63 0%, #E91E8C 50%, #FF6B9D 100%);
    --brand-gradient-vibrant: linear-gradient(135deg, #FF416C 0%, #FF4B2B 100%);
    
    /* Neutral Colors */
    --neutral-50: #FAFAFA;
    --neutral-100: #F5F5F5;
    --neutral-200: #EEEEEE;
    --neutral-300: #E0E0E0;
    --neutral-400: #BDBDBD;
    --neutral-500: #9E9E9E;
    --neutral-600: #757575;
    --neutral-700: #616161;
    --neutral-800: #424242;
    --neutral-900: #212121;
    
    /* Status Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    
    /* Online Status */
    --online-color: #22C55E;
    --away-color: #F59E0B;
    --offline-color: #9CA3AF;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Typography */
    --font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(196, 28, 99, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-bottom-nav: 1000;
    --z-top-nav: 1001;
    
    /* Layout */
    --header-height: 56px;
    --bottom-nav-height: 64px;
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   Base Styles Reset
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--neutral-900);
    background-color: var(--neutral-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Authenticated body padding adjustments */
body.authenticated {
    padding-top: var(--header-height);
    padding-bottom: 0;
}

/* Mobile: Add bottom padding for bottom nav */
@media (max-width: 767.98px) {
    body.authenticated {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom));
    }
    
    body.authenticated.messenger {
        padding-bottom: 0;
    }
}

/* ============================================
   TOP NAVBAR - Modern Header
   ============================================ */
.navbar-modern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: var(--z-top-nav);
    transition: all var(--transition-base);
}

.navbar-modern.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar-modern .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    max-width: 1400px;
    margin: 0 auto;
}

/* Brand/Logo */
.navbar-brand-modern {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: var(--font-size-xl);
    color: var(--brand-primary);
    transition: transform var(--transition-fast);
}

.navbar-brand-modern:hover {
    transform: scale(1.02);
}

.navbar-brand-modern img {
    height: 32px;
    width: auto;
}

/* Desktop Navigation Links */
.navbar-nav-modern {
    display: none;
    align-items: center;
    gap: var(--space-xs);
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 768px) {
    .navbar-nav-modern {
        display: flex;
    }
}

.nav-item-modern {
    position: relative;
}

.nav-link-modern {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    color: var(--neutral-600);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link-modern:hover {
    color: var(--brand-primary);
    background: rgba(196, 28, 99, 0.08);
}

.nav-link-modern.active {
    color: var(--brand-primary);
    background: rgba(196, 28, 99, 0.12);
}

.nav-link-modern svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Badge on nav items */
.nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    border-radius: var(--radius-full);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* User Profile Dropdown */
.navbar-profile-modern {
    position: relative;
}

.navbar-profile-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.navbar-profile-trigger:hover {
    border-color: var(--brand-primary);
    background: rgba(196, 28, 99, 0.05);
}

.navbar-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.navbar-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.navbar-profile-avatar svg {
    width: 20px;
    height: 20px;
}

/* Dropdown Menu */
.dropdown-menu-modern {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

.dropdown-menu-modern.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item-modern {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--neutral-700);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
}

.dropdown-item-modern:hover {
    background: var(--neutral-100);
    color: var(--brand-primary);
}

.dropdown-item-modern svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-item-modern.premium {
    color: var(--warning);
}

.dropdown-divider-modern {
    height: 1px;
    background: var(--neutral-200);
    margin: var(--space-xs) 0;
}

/* Credits Display */
.credits-display {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: var(--neutral-900);
    border-radius: var(--radius-full);
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.credits-display:hover {
    background: var(--brand-primary);
    transform: scale(1.05);
}

.credits-display svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   BOTTOM NAVIGATION - Mobile App Style
   ============================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom));
    padding-bottom: var(--safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    z-index: var(--z-bottom-nav);
    overflow: visible;
}

@media (max-width: 767.98px) {
    .bottom-nav {
        display: block;
        overflow: visible;
    }
}

.bottom-nav-container {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: var(--bottom-nav-height);
    max-width: 500px;
    margin: 0 auto;
    overflow: visible;
    padding: 0 4px;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-xs) 2px;
    color: var(--neutral-500);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all var(--transition-fast);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
    min-width: 0;
}

.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 48px;
    height: 3px;
    background: var(--brand-primary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    transition: transform var(--transition-base);
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

.bottom-nav-item.active {
    color: var(--brand-primary);
}

.bottom-nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.bottom-nav-icon {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    overflow: visible;
}

.bottom-nav-item.active .bottom-nav-icon {
    background: rgba(196, 28, 99, 0.12);
}

.bottom-nav-icon svg {
    width: 22px;
    height: 22px;
    transition: all var(--transition-fast);
}

.bottom-nav-item.active .bottom-nav-icon svg {
    transform: scale(1.1);
}

/* Bottom Nav Badge */
.bottom-nav-badge {
    position: absolute;
    top: -6px;
    right: -12px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: var(--radius-full);
    border: 2px solid white;
    animation: bounce-in 0.3s ease-out;
    box-sizing: border-box;
    overflow: visible;
    white-space: nowrap;
    z-index: 10;
}

@keyframes bounce-in {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Bottom Nav Dot Indicator */
.bottom-nav-dot {
    position: absolute;
    top: 0;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: var(--radius-full);
    border: 2px solid white;
}

/* ============================================
   NON-AUTHENTICATED NAVBAR (Landing Pages)
   ============================================ */
.navbar-landing {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: transparent;
    z-index: var(--z-top-nav);
    transition: all var(--transition-slow);
}

.navbar-landing.scrolled {
    background: rgba(196, 28, 99, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.navbar-landing .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-landing .navbar-brand-modern {
    color: white;
}

.navbar-landing .navbar-brand-modern img {
    filter: brightness(0) invert(1);
}

/* ============================================
   NON-AUTHENTICATED NAVBAR (Public Pages - Help, Support, etc.)
   ============================================ */
.navbar-public {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--brand-primary);
    z-index: var(--z-top-nav);
    box-shadow: var(--shadow-md);
}

.navbar-public .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-public .navbar-brand-modern {
    color: white;
}

.navbar-public .navbar-brand-modern img {
    filter: brightness(0) invert(1);
}

/* Public page body styling */
body.public-page {
    padding-top: var(--header-height);
    background: var(--neutral-50);
}

/* Language Selector */
.lang-selector {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.lang-selector:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lang-selector svg {
    width: 16px;
    height: 16px;
}

/* Auth buttons */
.btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    gap: 6px;
}

.btn-auth-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.btn-auth-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    color: white;
}

.btn-auth-solid {
    background: white;
    color: var(--brand-primary);
    border: 2px solid white;
}

.btn-auth-solid:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: var(--brand-primary);
}

/* Ensure consistent spacing in navbar auth buttons */
.navbar-auth-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 767.98px) {
    .btn-auth {
        padding: 6px 14px;
        font-size: 13px;
    }
    
    .navbar-auth-buttons {
        gap: 8px;
    }
}

/* ============================================
   FOOTER STYLES
   ============================================ */
   
/* Non-authenticated Footer */
.footer-landing {
    background: var(--neutral-900);
    color: var(--neutral-400);
    padding: var(--space-xl) 0;
}

.footer-landing .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-links a {
    color: var(--neutral-400);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: white;
}

.footer-copyright {
    font-size: var(--font-size-sm);
    color: var(--neutral-500);
}

/* Authenticated Footer - Hidden on mobile (bottom nav replaces it) */
.footer-auth {
    background: white;
    border-top: 1px solid var(--neutral-200);
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
}

@media (max-width: 767.98px) {
    .footer-auth {
        display: none;
    }
}

.footer-auth .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.footer-auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-auth-links a {
    color: var(--neutral-500);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.footer-auth-links a:hover {
    color: var(--brand-primary);
}

/* ============================================
   MESSENGER PAGE SPECIFIC STYLES
   ============================================ */
body.messenger .bottom-nav {
    display: none !important;
}

body.messenger .navbar-modern {
    /* Keep header on messenger but minimal */
}

/* Hide desktop nav on messenger mobile */
@media (max-width: 767.98px) {
    body.messenger .navbar-nav-modern {
        display: none;
    }
}

/* ============================================
   PWA INSTALL BANNER
   ============================================ */
.pwa-install-modern {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom) + var(--space-md));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--brand-gradient);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
    z-index: calc(var(--z-bottom-nav) - 1);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.pwa-install-modern.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.pwa-install-modern:hover {
    transform: translateX(-50%) translateY(-2px);
}

.pwa-install-modern svg {
    width: 20px;
    height: 20px;
}

@media (min-width: 768px) {
    .pwa-install-modern {
        bottom: var(--space-lg);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hide-mobile {
    display: none !important;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: flex !important;
    }
    
    .hide-desktop {
        display: none !important;
    }
}

/* ============================================
   FLOATING ACTION BUTTONS (FAB)
   Position above bottom nav on mobile
   ============================================ */
.floating-action,
.btn-float,
.floating,
[class*="floating"],
.fab {
    z-index: calc(var(--z-bottom-nav) - 1);
}

@media (max-width: 767.98px) {
    /* Any fixed/absolute positioned element at bottom needs spacing */
    .floating-action,
    .btn-float,
    .floating,
    [style*="position: fixed"][style*="bottom"],
    [style*="position:fixed"][style*="bottom"] {
        bottom: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom) + 16px) !important;
    }
    
    /* Generic floating chat/action buttons */
    .chat-float-btn,
    .floating-chat,
    .btn-floating {
        bottom: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom) + 16px) !important;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-up {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in var(--transition-base) ease-out;
}

.animate-slide-up {
    animation: slide-up var(--transition-slow) ease-out;
}

.animate-slide-down {
    animation: slide-down var(--transition-slow) ease-out;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* ============================================
   TOUCH FEEDBACK
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .nav-link-modern:active,
    .dropdown-item-modern:active,
    .btn-auth:active {
        opacity: 0.7;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
