/* ========================================
   COACHMACHER.AI DESIGN SYSTEM
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Primary Colors */
    --primary: #7C3AED;
    --primary-light: #8B5CF6;
    --primary-dark: #6D28D9;
    --primary-glow: rgba(124, 58, 237, 0.2);

    /* Accent Colors */
    --accent: #DB2777;
    --accent-light: #EC4899;
    --accent-dark: #BE185D;
    --accent-glow: rgba(219, 39, 119, 0.2);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    --gradient-subtle: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(219, 39, 119, 0.08) 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);

    /* Background Colors */
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-tertiary: #E2E8F0;
    --bg-elevated: #FFFFFF;

    /* Surface Colors */
    --surface: rgba(255, 255, 255, 0.8);
    --surface-hover: rgba(241, 245, 249, 0.9);
    --surface-active: rgba(226, 232, 240, 0.9);

    /* Border Colors */
    --border: rgba(148, 163, 184, 0.3);
    --border-hover: rgba(148, 163, 184, 0.5);
    --border-focus: var(--primary);

    /* Text Colors */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #F8FAFC;

    /* Status Colors */
    --success: #15803D;
    --success-light: #22C55E;
    --warning: #B45309;
    --error: #B91C1C;
    --info: #1D4ED8;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 4px 20px var(--primary-glow);
    --shadow-glow-accent: 0 4px 20px var(--accent-glow);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 72px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-display: 'Fraunces', 'Georgia', serif;
    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 280ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 450ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-tooltip: 400;
    --z-loader: 9999;

    /* Layout */
    --nav-width: 230px;
    --mobile-header-height: 56px;
}

/* ========================================
   BASE STYLES
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(219, 39, 119, 0.06) 0%, transparent 40%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: -1;
    pointer-events: none;
}

h1, h2 {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--space-lg) 0;
}

/* ========================================
   MAIN NAVIGATION SIDEBAR
   ======================================== */

.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--nav-width);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    overflow: hidden;
}

/* Logo */
.nav-header {
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-header a {
    display: block;
    text-decoration: none;
}

.nav-header img {
    height: 30px;
    width: auto;
    display: block;
    transition: opacity var(--transition-fast);
}

.nav-header img:hover {
    opacity: 0.8;
}

/* Scrollable Menu */
.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md) var(--space-sm);
}

/* Section Groups */
.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-sm);
    display: block;
}

/* Navigation Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-link:active {
    transform: scale(0.98);
}

.nav-link.active {
    background: var(--gradient-subtle);
    color: var(--primary);
    font-weight: 600;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity var(--transition-fast);
}

.nav-link:hover svg,
.nav-link.active svg {
    opacity: 1;
}

.nav-link.active svg {
    color: var(--primary);
}

/* Coming Soon Badge */
.nav-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    margin-left: auto;
}

.nav-coming-soon {
    opacity: 0.55;
    pointer-events: none;
}

/* Subtle footer links */
.nav-link-subtle {
    font-size: 13px;
    color: var(--text-muted);
    padding: 7px 12px;
}

.nav-link-subtle:hover {
    color: var(--text-secondary);
}

.nav-logout:hover {
    color: var(--error);
}

.nav-logout:hover svg {
    color: var(--error);
}

/* Footer */
.nav-footer {
    border-top: 1px solid var(--border);
    padding: var(--space-sm);
    flex-shrink: 0;
}

/* User Info */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.nav-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

.main-content {
    margin-left: var(--nav-width);
    min-height: 100vh;
}

/* ========================================
   MOBILE HEADER
   ======================================== */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 var(--space-md);
    gap: var(--space-md);
    z-index: var(--z-sticky);
}

.mobile-menu-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-secondary);
}

.mobile-logo {
    height: 26px;
    width: auto;
}

/* Mobile Backdrop */
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: calc(var(--z-sticky) + 50);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.nav-backdrop.show {
    display: block;
    opacity: 1;
}

/* ========================================
   PAGE LOADING OVERLAY
   ======================================== */

#page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: var(--z-loader);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#page-loader::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 50% 50%, rgba(124, 58, 237, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

#page-loader .loader-logo {
    width: 80px;
    height: auto;
    margin-bottom: var(--space-xl);
    animation: loader-pulse 2s ease-in-out infinite;
}

#page-loader .loader-spinner {
    width: 44px;
    height: 44px;
    border: 2.5px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-right-color: var(--accent);
    border-radius: var(--radius-full);
    animation: loader-spin 1s linear infinite;
}

#page-loader .loader-text {
    margin-top: var(--space-lg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

@keyframes loader-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.06); }
}

/* ========================================
   GLOBAL ANIMATIONS
   ======================================== */

a, button {
    transition: all var(--transition-fast);
}

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   FORM ELEMENTS - GLOBAL
   ======================================== */

input, textarea, select {
    font-family: var(--font-sans);
    font-size: 15px;
}

input:focus, textarea:focus, select:focus {
    outline: none;
}

/* ========================================
   BUTTONS - GLOBAL
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 6px 25px var(--primary-glow);
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--border-hover);
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

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

@media (max-width: 768px) {
    .main-nav {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        z-index: calc(var(--z-sticky) + 60);
        box-shadow: var(--shadow-xl);
    }

    .main-nav.open {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding-top: var(--mobile-header-height);
    }

    body.nav-open {
        overflow: hidden;
    }
}
