/*
 * Clawzempic Design System v2
 * Token system matches landing.css (the canonical reference)
 * Fonts self-hosted in css/fonts/ — no external Google Fonts links needed
 */

/* Self-hosted fonts — eliminates FOUT from external Google Fonts CDN */
@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 1 1000;
  font-stretch: 100%;
  font-display: optional;
  src: url('fonts/GoogleSansFlex-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 1 1000;
  font-stretch: 100%;
  font-display: optional;
  src: url('fonts/GoogleSansFlex-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: optional;
  src: url('fonts/JetBrainsMono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: optional;
  src: url('fonts/JetBrainsMono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== TOKENS ===== */

:root {
    /* --- Primary tokens (matching landing.css) --- */
    --font-main: "Google Sans Flex", sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    --bg-brand: #17171A;
    --bg-sidebar: #0d0d0f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-elevated: rgba(255, 255, 255, 0.05);
    --bg-active: rgba(255, 255, 255, 0.08);

    --text-white: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-subtle: rgba(255, 255, 255, 0.3);

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    /* Accent Colors */
    --green: #34D399;
    --green-hover: #6ee7b7;
    --gold: #F59E0B;
    --gold-hover: #fbbf24;
    --coral: #FF6B5A;
    --coral-hover: #ff8a7d;
    --blue: #2D32D1;
    --ocean: #38BDF8;

    /* Gradients */
    --grad-logo: linear-gradient(135deg, #FF6B5A, #F59E0B);
    --grad-green: linear-gradient(135deg, #34D399, #6ee7b7);
    --grad-gold: linear-gradient(135deg, #F59E0B, #fbbf24);
    --grad-progress: linear-gradient(90deg, #FF6B5A, #F59E0B);

    /* --- Backward-compatible aliases (used by app pages) --- */
    --font-display: var(--font-main);
    --font-body: var(--font-main);
    --bg-page: var(--bg-brand);
    --text-bright: var(--text-white);
    --text-primary: rgba(255, 255, 255, 0.87);
    --text-secondary: var(--text-muted);
}

/* ===== RESET ===== */

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

/* ===== BODY ===== */

body {
    font-family: var(--font-main);
    background: var(--bg-brand);
    color: var(--text-white);
    overflow-x: hidden;
    font-optical-sizing: auto;
    line-height: 1.5;
}

/* ===== TYPOGRAPHY ===== */

h1, h2, h3, h4 {
    font-family: var(--font-main);
    color: var(--text-white);
    line-height: 1.1;
}

code, .mono {
    font-family: var(--font-mono);
}

/* ===== GRADIENT TEXT UTILITIES ===== */

.g-grad {
    background: var(--grad-green);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gold-grad {
    background: var(--grad-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-grad {
    background: var(--grad-logo);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== SIDEBAR ===== */

.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 24px; }

.logo-text {
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: var(--grad-logo);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 9px;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.nav { flex: 1; padding: 16px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-white);
}

.nav-item.active {
    background: var(--bg-card);
    color: var(--text-white);
    border-left-color: var(--green);
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

/* Sidebar plan badge */
.plan-badge {
    margin: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.plan-badge .plan-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.usage-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.usage-bar-fill {
    height: 100%;
    transition: width 1s ease;
}

.usage-bar-fill.requests { background: var(--grad-progress); }
.usage-bar-fill.inference { background: var(--green); }

/* ===== CARDS ===== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    transition: border-color 0.15s;
}

.card:hover { border-color: var(--border-hover); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.15s;
}

.stat-card:hover { border-color: var(--border-hover); }

/* ===== BUTTONS ===== */

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: var(--font-main);
}

.btn-primary {
    background: #ffffff;
    color: #17171A;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

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

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

.btn-green {
    background: var(--green);
    color: #0a2e1c;
    font-weight: 600;
}

.btn-green:hover {
    background: var(--green-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-white);
    background: var(--bg-card);
}

/* ===== BADGES ===== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-blue { background: rgba(56, 189, 248, 0.15); color: var(--ocean); }
.badge-green { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.badge-gold { background: rgba(245, 158, 11, 0.15); color: var(--gold); }
.badge-coral { background: rgba(255, 107, 90, 0.15); color: var(--coral); }
.badge-muted { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); }

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

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px;
    max-width: calc(100vw - 240px);
}

.page-header { margin-bottom: 32px; }

.page-title {
    font-family: var(--font-main);
    font-size: 32px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

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

@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}
.mobile-header .mobile-logo { height: 16px; width: auto; }

.hamburger {
    width: 40px; height: 40px;
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 5px; padding: 8px;
}
.hamburger span {
    display: block; width: 20px; height: 2px;
    background: var(--text-muted); border-radius: 1px;
    transition: all 0.3s;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-backdrop.visible { display: block; opacity: 1; }

.user-nav-desktop { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 8px; }

/* ===== RESPONSIVE: SHARED LAYOUT ===== */

@media (max-width: 768px) {
    .mobile-header { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 72px 16px 24px;
    }

    .user-nav-desktop { display: none; }

    .page-header { margin-bottom: 20px; }
    .page-title { font-size: 24px; }
}
