/**
 * INFINITE RENOVATIONS - Premium Theme
 * DEV MODE: theme.css v4.0
 * V3: Warm Cream, Terracotta & Espresso — LOCKED
 *
 * Premium dark-warm theme with textured surfaces.
 * Sharp corners, terracotta accents, espresso depths.
 * Reference: docs/DESIGN_DNA_SYSTEM.md
 */

/* ========================================
   FONTS
   Inter for premium feel, with system fallbacks
======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Font Family */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Consolas, monospace;

    /* ========================================
       GLASSMORPHISM & 3D TOKENS (Warm-Tinted)
    ======================================== */

    /* Glass surfaces — warm cream tint */
    --glass-1: rgba(250, 243, 225, 0.03);
    --glass-2: rgba(250, 243, 225, 0.06);
    --glass-3: rgba(250, 243, 225, 0.09);
    --glass-4: rgba(250, 243, 225, 0.12);

    /* Frost borders — warm cream tint */
    --stroke-glass: rgba(250, 243, 225, 0.08);
    --stroke-glass-hover: rgba(250, 243, 225, 0.14);
    --stroke-glass-active: rgba(250, 243, 225, 0.20);

    /* 3D Shadows — warm espresso base */
    --shadow-glass-sm: 0 4px 16px rgba(43, 37, 32, 0.25);
    --shadow-glass-md: 0 8px 32px rgba(43, 37, 32, 0.35);
    --shadow-glass-lg: 0 16px 48px rgba(43, 37, 32, 0.45);
    --shadow-glass-xl: 0 24px 64px rgba(43, 37, 32, 0.55);
    --shadow-inset: inset 0 1px 0 rgba(250, 243, 225, 0.06);
    --shadow-inset-strong: inset 0 1px 0 rgba(250, 243, 225, 0.12);

    /* Glow accents — terracotta */
    --glow-primary: 0 0 0 1px rgba(212, 132, 90, 0.25), 0 8px 32px rgba(212, 132, 90, 0.15);
    --glow-success: 0 0 0 1px rgba(63, 185, 80, 0.25), 0 8px 32px rgba(63, 185, 80, 0.15);
    --glow-danger: 0 0 0 1px rgba(248, 81, 73, 0.25), 0 8px 32px rgba(248, 81, 73, 0.15);
    --glow-purple: 0 0 0 1px rgba(163, 113, 247, 0.25), 0 8px 32px rgba(163, 113, 247, 0.15);

    /* Gradient accents — terracotta to peach */
    --gradient-primary: linear-gradient(135deg, #D4845A 0%, #F5D5B8 100%);
    --gradient-success: linear-gradient(135deg, #3fb950 0%, #56d4dd 100%);
    --gradient-warm: linear-gradient(135deg, #D4845A 0%, #C07248 100%);

    /* Sharp corners — Infinite DNA */
    --radius-glass-sm: 0;
    --radius-glass-md: 0;
    --radius-glass-lg: 0;
    --radius-glass-xl: 0;

    /* Font Sizes */
    --text-xs: 0.6875rem;    /* 11px */
    --text-sm: 0.75rem;      /* 12px */
    --text-base: 0.8125rem;  /* 13px */
    --text-md: 0.875rem;     /* 14px */
    --text-lg: 1rem;         /* 16px */
    --text-xl: 1.125rem;     /* 18px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */

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

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* ========================================
       COLORS - Dark Warm Theme
    ======================================== */

    /* Background Layers (warm espresso, darkest to lightest) */
    --bg-base: #1E1B18;           /* Deep espresso */
    --bg-surface: #2B2520;        /* Espresso — cards, panels */
    --bg-elevated: #352F28;       /* Warm elevated — hover states */
    --bg-overlay: #3D352E;        /* Warm overlay — dropdowns, modals */
    --bg-input: #1A1714;          /* Deep input — form fields */

    /* Sidebar specific */
    --sidebar-bg: #241F1A;
    --sidebar-border: rgba(250, 243, 225, 0.06);
    --sidebar-hover: #352F28;
    --sidebar-active: rgba(212, 132, 90, 0.15);

    /* Text Colors (warm cream spectrum) */
    --text-primary: #FAF3E1;      /* Warm cream — headings */
    --text-secondary: #C4B8A8;    /* Warm muted — body text */
    --text-tertiary: #8A8078;     /* Warm gray — labels */
    --text-muted: #6E6158;        /* Warm dim — disabled, hints */
    --text-inverse: #1E1B18;      /* Text on light backgrounds */

    /* Border Colors (warm cream-based) */
    --border-default: rgba(250, 243, 225, 0.08);
    --border-muted: rgba(250, 243, 225, 0.04);
    --border-emphasis: rgba(250, 243, 225, 0.14);

    /* Primary (Terracotta) */
    --primary: #D4845A;
    --primary-hover: #C07248;
    --primary-muted: rgba(212, 132, 90, 0.15);
    --primary-emphasis: #A8633F;

    /* Success (Green — preserved) */
    --success: #3fb950;
    --success-hover: #56d364;
    --success-muted: rgba(63, 185, 80, 0.15);

    /* Warning (Orange/Yellow — preserved) */
    --warning: #d29922;
    --warning-hover: #e3b341;
    --warning-muted: rgba(210, 153, 34, 0.15);

    /* Danger (Red — preserved) */
    --danger: #f85149;
    --danger-hover: #ff7b72;
    --danger-muted: rgba(248, 81, 73, 0.15);

    /* Info (Purple — preserved) */
    --info: #a371f7;
    --info-hover: #bc8cff;
    --info-muted: rgba(163, 113, 247, 0.15);

    /* Text colors for status (glowing variants — preserved) */
    --primary-text: #F5D5B8;
    --success-text: #56d364;
    --warning-text: #f0c554;
    --danger-text: #ff8f87;
    --info-text: #bc8cff;

    /* Border variants for design system */
    --border-primary: rgba(250, 243, 225, 0.06);
    --border-subtle: rgba(250, 243, 225, 0.04);

    /* Temperature Colors (preserved for lead scoring) */
    --temp-hot: #f85149;
    --temp-hot-text: #ff8f87;
    --temp-hot-bg: rgba(248, 81, 73, 0.15);
    --temp-hot-border: rgba(248, 81, 73, 0.4);
    --temp-warm: #d29922;
    --temp-warm-text: #f0c554;
    --temp-warm-bg: rgba(210, 153, 34, 0.15);
    --temp-warm-border: rgba(210, 153, 34, 0.4);
    --temp-cold: #D4845A;
    --temp-cold-text: #F5D5B8;
    --temp-cold-bg: rgba(212, 132, 90, 0.15);
    --temp-cold-border: rgba(212, 132, 90, 0.4);

    /* ========================================
       SEAMLESS DESIGN TOKENS (V3 Warm)
    ======================================== */

    /* Seamless borders (warm cream-based) */
    --border-seamless: rgba(250, 243, 225, 0.06);
    --border-seamless-subtle: rgba(250, 243, 225, 0.04);
    --border-seamless-emphasis: rgba(250, 243, 225, 0.12);

    /* Premium gradient backgrounds (warm espresso) */
    --gradient-panel: linear-gradient(180deg, rgba(43, 37, 32, 0.98) 0%, rgba(36, 31, 26, 0.95) 100%);
    --gradient-header: linear-gradient(180deg, rgba(53, 47, 40, 0.98) 0%, rgba(43, 37, 32, 0.95) 50%, rgba(36, 31, 26, 0.92) 100%);
    --gradient-input: linear-gradient(180deg, rgba(26, 23, 20, 0.9) 0%, rgba(30, 27, 24, 0.85) 100%);
    --gradient-kpi-strip: linear-gradient(180deg, rgba(40, 35, 30, 0.98) 0%, rgba(34, 29, 24, 0.95) 100%);
    --gradient-card-hover: linear-gradient(180deg, rgba(53, 47, 40, 0.98) 0%, rgba(45, 39, 34, 0.95) 100%);

    /* Premium button gradients (terracotta) */
    --gradient-btn-primary: linear-gradient(180deg, #D4845A 0%, #C07248 50%, #A8633F 100%);
    --gradient-btn-primary-hover: linear-gradient(180deg, #E09468 0%, #D4845A 50%, #C07248 100%);
    --gradient-btn-secondary: linear-gradient(180deg, rgba(61, 53, 46, 0.95) 0%, rgba(53, 47, 40, 0.90) 100%);
    --gradient-btn-secondary-hover: linear-gradient(180deg, rgba(71, 63, 56, 0.95) 0%, rgba(61, 53, 46, 0.90) 100%);
    --gradient-btn-success: linear-gradient(180deg, rgba(63, 185, 80, 0.3) 0%, rgba(45, 160, 60, 0.2) 100%);
    --gradient-btn-danger: linear-gradient(180deg, rgba(248, 81, 73, 0.3) 0%, rgba(220, 60, 50, 0.2) 100%);

    /* Avatar gradients (terracotta to peach) */
    --gradient-avatar: linear-gradient(135deg, #D4845A 0%, #F5D5B8 100%);

    /* Inset shadows (warm textured surfaces) */
    --shadow-inset-input: inset 0 2px 4px rgba(43, 37, 32, 0.3), inset 0 0 0 1px rgba(43, 37, 32, 0.1);
    --shadow-inset-subtle: inset 0 1px 0 rgba(250, 243, 225, 0.02);
    --shadow-inset-medium: inset 0 1px 0 rgba(250, 243, 225, 0.04);
    --shadow-inset-strong: inset 0 1px 0 rgba(250, 243, 225, 0.08);

    /* Button shadows (warm) */
    --shadow-btn: inset 0 1px 0 rgba(250, 243, 225, 0.1), inset 0 -1px 0 rgba(43, 37, 32, 0.1), 0 2px 8px rgba(43, 37, 32, 0.3);
    --shadow-btn-primary: inset 0 1px 0 rgba(250, 243, 225, 0.25), inset 0 -1px 0 rgba(43, 37, 32, 0.15), 0 4px 16px rgba(212, 132, 90, 0.4);
    --shadow-btn-primary-hover: inset 0 1px 0 rgba(250, 243, 225, 0.3), inset 0 -1px 0 rgba(43, 37, 32, 0.1), 0 6px 24px rgba(212, 132, 90, 0.5), 0 0 20px rgba(212, 132, 90, 0.25);

    /* KPI icon glows (terracotta primary, status colors preserved) */
    --shadow-icon-blue: inset 0 1px 0 rgba(212, 132, 90, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 0 16px rgba(212, 132, 90, 0.15);
    --shadow-icon-red: inset 0 1px 0 rgba(248, 81, 73, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 0 16px rgba(248, 81, 73, 0.15);
    --shadow-icon-green: inset 0 1px 0 rgba(63, 185, 80, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 0 16px rgba(63, 185, 80, 0.15);
    --shadow-icon-orange: inset 0 1px 0 rgba(210, 153, 34, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 0 16px rgba(210, 153, 34, 0.15);
    --shadow-icon-purple: inset 0 1px 0 rgba(163, 113, 247, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 0 16px rgba(163, 113, 247, 0.15);

    /* Selected state shadow (terracotta) */
    --shadow-selected: inset 0 1px 0 rgba(212, 132, 90, 0.1), inset 4px 0 0 var(--primary);

    /* Avatar shadows (terracotta glow) */
    --shadow-avatar-sm: inset 0 2px 4px rgba(250, 243, 225, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 4px 12px rgba(212, 132, 90, 0.3);
    --shadow-avatar-lg: inset 0 2px 4px rgba(250, 243, 225, 0.2), inset 0 -2px 4px rgba(43, 37, 32, 0.2), 0 8px 24px rgba(212, 132, 90, 0.35);

    /* Focus ring (terracotta) */
    --shadow-focus: 0 0 0 2px rgba(212, 132, 90, 0.15), 0 0 16px rgba(212, 132, 90, 0.1);

    /* ========================================
       SPACING
    ======================================== */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */

    /* ========================================
       LAYOUT
    ======================================== */
    --sidebar-width-expanded: 240px;
    --sidebar-width-collapsed: 64px;
    --header-height: 60px;
    --drawer-width: 380px;
    --filters-panel-width: 260px;
    --kpi-strip-height: 80px;
    --tabs-height: 52px;
    --dev-banner-height: 28px;
    --mobile-header-height: 44px;

    /* ========================================
       EFFECTS — Sharp Corners
    ======================================== */
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
    --radius-xl: 0;
    --radius-full: 0;

    --shadow-sm: 0 1px 2px rgba(43, 37, 32, 0.3);
    --shadow-md: 0 4px 6px rgba(43, 37, 32, 0.3);
    --shadow-lg: 0 10px 20px rgba(43, 37, 32, 0.4);
    --shadow-glow: 0 0 20px rgba(212, 132, 90, 0.15);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ========================================
   BASE STYLES
======================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-secondary);
    background: var(--bg-base);

    /* Premium gradient background — warm terracotta/peach/amber */
    background-image:
        radial-gradient(ellipse 1200px 600px at 15% 10%, rgba(212, 132, 90, 0.08), transparent 50%),
        radial-gradient(ellipse 900px 500px at 80% 15%, rgba(245, 213, 184, 0.06), transparent 45%),
        radial-gradient(ellipse 600px 400px at 60% 90%, rgba(192, 114, 72, 0.04), transparent 45%);
    background-attachment: fixed;
}

/* ========================================
   GLASSMORPHISM COMPONENTS (Warm)
======================================== */

/* Core glass surface — sharp corners */
.glass {
    background: linear-gradient(180deg, var(--glass-3), var(--glass-1));
    border: 1px solid var(--stroke-glass);
    border-radius: 0;
    box-shadow: var(--shadow-glass-md), var(--shadow-inset);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
}

/* Premium highlight line across top — warm tint */
.glass::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 10%, rgba(250, 243, 225, 0.15) 50%, transparent 90%);
    border-radius: inherit;
    pointer-events: none;
}

/* Strong glass (for important panels) */
.glass--strong {
    background: linear-gradient(180deg, var(--glass-4), var(--glass-2));
    border-color: var(--stroke-glass-hover);
    box-shadow: var(--shadow-glass-lg), var(--shadow-inset-strong);
}

/* Subtle glass (for nested elements) */
.glass--subtle {
    background: var(--glass-2);
    border-color: var(--stroke-glass);
    box-shadow: var(--shadow-glass-sm), var(--shadow-inset);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* 3D lift effect on hover */
.lift {
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 200ms ease,
                border-color 200ms ease;
    transform: translateY(0) translateZ(0);
}

.lift:hover {
    transform: translateY(-3px);
    border-color: var(--stroke-glass-hover);
    box-shadow: var(--shadow-glass-lg), var(--shadow-inset);
}

.lift:active {
    transform: translateY(-1px);
    transition-duration: 100ms;
}

/* Glow effects — terracotta primary */
.glow-primary { box-shadow: var(--shadow-glass-md), var(--shadow-inset), var(--glow-primary); }
.glow-success { box-shadow: var(--shadow-glass-md), var(--shadow-inset), var(--glow-success); }
.glow-danger { box-shadow: var(--shadow-glass-md), var(--shadow-inset), var(--glow-danger); }
.glow-purple { box-shadow: var(--shadow-glass-md), var(--shadow-inset), var(--glow-purple); }

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

/* ========================================
   DEV BANNER
======================================== */
.dev-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: linear-gradient(90deg, var(--warning) 0%, #e67e22 100%);
    color: var(--text-inverse);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

body.has-dev-banner {
    padding-top: 28px;
}

/* ========================================
   UTILITY CLASSES
======================================== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-muted { color: var(--text-muted); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }

.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
