/* ════════════════════════════════════════════
 */
:root {
    /* Brand Colors - Primary */
    --violet: #7B00FF;          /* Primary action buttons */
    --violet-bright: #8C45FF;            /* Hover state */
    --violet-pressed: #6600D6;          /* Pressed state */
    --violet-disabled: rgba(123, 0, 255, 0.4);

    /* Brand Colors - Secondary */
    --rose-energy: #BF4080;            /* RunSmart electric lime */
    --rose-energy-hover: #D0196B;             /* Darker lime for gradients */
    --lime-glow: rgba(205, 255, 0, 0.2);

    /* Neutral Palette */
    --black: #000000;
    --dark-bg: #0A0A0A;
    --dark-surface: #151515;
    --border-subtle: #1A1A1A;
    --border-medium: #2A2A2A;
    --border-strong: #3A3A3A;

    /* Text Colors - WCAG AA Compliant */
    --text-primary: #FFFFFF;
    --text-secondary: #888888;          /* 4.6:1 contrast */
    --text-tertiary: #666666;           /* 3.8:1 contrast - large text only */
    --text-quaternary: #444444;         /* UI elements only */

    /* Status Colors - HIG Semantic */
    --status-critical: #EF4444;         /* Red - Critical/High Risk */
    --status-warning: #F59E0B;          /* Orange - Warning/Medium Risk */
    --status-success: #10B981;          /* Green - Success/Low Risk */
    --status-info: #3B82F6;             /* Blue - Information */

    /* Medal/Gamification Colors */
    --gold: #FFD60A;
    --gold-gradient-end: #FF9F0A;
    --silver: #E5E5EA;
    --silver-dark: #AEAEB2;
    --bronze: #FF9F0A;

    /* Spacing System - 4px base unit */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-base: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius - Smooth, modern */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows - Liquid glass depth */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.4);

    /* Purple glow effects */
    --glow-violet-sm: 0 0 20px rgba(123, 0, 255, 0.3);
    --glow-violet-md: 0 0 40px rgba(123, 0, 255, 0.4);
    --glow-lime-sm: 0 0 20px rgba(205, 255, 0, 0.2);

    /* Typography Scale - SF Pro Display */
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-size-4xl: 48px;

    /* Font Weights */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Transitions - Apple-like easing */
    --transition-fast: 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
    --transition-base: 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ========================================
   BUTTON SYSTEM — Unified Classes
   Apple HIG: 44px min touch targets, r-md, SF Pro
   Primary: Quantum Purple #7B00FF
   Secondary: Glass (translucent, backdrop blur)
   Ghost: Minimal border
   Sage: Dewdrop product green
   ======================================== */

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px; border-radius: var(--radius-md, 12px);
    font-size: 15px; font-weight: 600;
    cursor: pointer; border: 1px solid transparent;
    text-decoration: none;
    min-height: 44px;
    font-family: var(--font-family);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.btn svg { flex-shrink: 0; }

.btn-primary {
    background: var(--violet);
    color: white;
    border: none;
}
.btn-primary:hover {
    background: var(--violet-bright);
    transform: translateY(-1px);
    box-shadow: var(--glow-violet-sm);
}
.btn-primary:active {
    background: var(--violet-pressed);
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(97, 63, 231, 0.22);
    color: var(--text-primary, #FFFFFF);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(97, 63, 231, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary, #888888);
}
.btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--text-primary, #FFFFFF);
    background: rgba(255, 255, 255, 0.04);
}

.btn-sage {
    background: #2D6A4F;
    color: white;
}
.btn-sage:hover {
    background: #52B788;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.35);
}

.btn-sm { padding: 8px 16px; font-size: var(--font-size-sm, 12px); min-height: 36px; }
.btn-lg { padding: 16px 32px; font-size: var(--font-size-md, 16px); min-height: 52px; }

   STATUS INDICATORS
   ======================================== */

.status-critical,
.risk-critical {
    color: var(--status-critical);
}

.status-warning,
.risk-high {
    color: var(--status-warning);
}

.status-success,
.risk-low {
    color: var(--status-success);
}

.status-info {
    color: var(--status-info);
}

/* Status badges */
.badge-critical {
    background: var(--status-critical);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.badge-warning {
    background: var(--status-warning);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.badge-success {
    background: var(--status-success);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

/* ========================================
   ICON SYSTEM
   ======================================== */

.icon-sm svg {
    width: 16px;
    height: 16px;
}

.icon-base svg,
.icon svg {
    width: 20px;
    height: 20px;
}

.icon-md svg {
    width: 24px;
    height: 24px;
}

.icon-lg svg {
    width: 32px;
    height: 32px;
}

.icon-xl svg {
    width: 48px;
    height: 48px;
}

/* Icon colors */
.icon-violet svg,
.icon-violet svg path {
    stroke: var(--violet);
    fill: var(--violet);
}

.icon-lime svg,
.icon-lime svg path {
    stroke: var(--lime-primary);
    fill: var(--lime-primary);
}

.icon-white svg,
.icon-white svg path {
    stroke: white;
    fill: white;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

.text-violet { color: var(--violet); }
.text-lime { color: var(--lime-primary); }
.text-critical { color: var(--status-critical); }
.text-warning { color: var(--status-warning); }
.text-success { color: var(--status-success); }

.bg-violet { background: var(--violet); }
.bg-lime { background: var(--lime-primary); }
.bg-dark { background: var(--dark-bg); }
.bg-surface { background: var(--dark-surface); }

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
    }

    .btn,
    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
        font-size: var(--font-size-sm);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus states */
button:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--violet);
    outline-offset: 2px;
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: #444444;
        --border-medium: #666666;
    }
}

/* Page Load Overlay */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease-out;
    pointer-events: none;
}

.page-loader.loaded {
    opacity: 0;
}

/* RunSmart Logo Animation */
.loader-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #7B00FF, #A0CC00);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 32px;
    color: #000;
    animation: logoFloat 1.5s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(123, 0, 255, 0.4);
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 8px 32px rgba(123, 0, 255, 0.4);
    }
    50% {
        transform: translateY(-12px) scale(1.05);
        box-shadow: 0 16px 48px rgba(123, 0, 255, 0.6);
    }
}

/* Loading Spinner */
.loader-spinner {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 3px solid rgba(123, 0, 255, 0.1);
    border-top-color: #7B00FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Content Fade In */
body {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.2s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Stagger animations for cards */
.animate-stagger > * {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Avatar Image Styling */
.photo-frame img,
.member-avatar img,
.message-avatar img,
.member-avatar-large img,
.profile-avatar img,
.conversation-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit; /* Inherits parent's border-radius */
}

/* Ensure avatars maintain aspect ratio */
.photo-frame img,
.member-avatar,
.message-avatar,
.member-avatar-large,
.profile-avatar,
.conversation-avatar {
    position: relative;
    overflow: hidden;
}

/* Fallback initials styling */
.avatar-initials {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: linear-gradient(135deg, #7B00FF, #A0CC00);
    color: #000;
}

/* Loading state shimmer effect */
.member-avatar img[loading="lazy"],
.conversation-avatar img[loading="lazy"] {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Photo Timeline */
.photo-timeline {
    background: #0A0A0A;
    border: 1px solid #1A1A1A;
    border-radius: 20px;
    padding: 20px;
}

.timeline-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.timeline-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.timeline-scroll::-webkit-scrollbar {
    display: none;
}

.photo-item {
    flex-shrink: 0;
    width: 120px;
}

.photo-frame {
    width: 120px;
    height: 160px;
    background: linear-gradient(135deg, #1A1A1A 0%, #0A0A0A 100%);
    border: 1px solid #1A1A1A;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.photo-date {
    font-size: 11px;
    color: #888;
    text-align: center;
}

