/* ===== BASE CSS - Variables, Reset, Typography ===== */

:root {
    /* Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #0ea5e9;
    --accent-warm: #f59e0b;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --card: #ffffff;
    --muted: #4b5563;
    --muted-light: #6b7280;
    --text: #0f172a;
    --text-secondary: #334155;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 3px 10px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.04), 0 20px 48px rgba(15, 23, 42, 0.10);
    --shadow-colored: 0 4px 14px rgba(37, 99, 235, 0.18), 0 1px 3px rgba(37, 99, 235, 0.10);

    /* Radius */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --radius-xl: 24px;

    /* Layout */
    --sidebar-width: 272px;

    /* Typography */
    --font-display: 'Outfit', system-ui, sans-serif;
    --font-body: 'Figtree', system-ui, sans-serif;

    /* Spacing scale */
    --s-1: 4px;
    --s-2: 6px;
    --s-3: 8px;
    --s-4: 10px;
    --s-5: 12px;
    --s-6: 14px;
    --s-7: 16px;
    --s-8: 18px;
    --s-9: 20px;
    --s-10: 24px;
    --s-11: 28px;
    --s-12: 32px;
    --s-13: 36px;
    --s-14: 40px;
    --s-15: 48px;
    --s-16: 56px;
    --s-17: 64px;
}

/* Reset */
* {
    box-sizing: border-box;
}

input,
textarea,
select,
button {
    font-family: inherit;
}

body.app-body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 100% 60% at 50% 0%, rgba(37, 99, 235, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(14, 165, 233, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-display);
}

h1 {
    margin: 0 0 10px 0;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
    line-height: 1.2;
}

h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.1px;
}

.eyebrow {
    color: var(--primary);
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    opacity: 0.9;
}

.lead {
    color: var(--muted);
    max-width: 720px;
    line-height: 1.65;
    font-size: 16px;
}

.muted {
    color: var(--muted);
}

/* Utilities */
.hidden {
    display: none;
}

.text-link {
    color: var(--primary-dark);
    cursor: pointer;
}

.w-full {
    width: 100%;
}

.stack {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== RESPONSIVE BASE ===== */
@media (max-width: 768px) {
    h1 { font-size: 26px; }
    h2 { font-size: 20px; }
    h3 { font-size: 16px; }
    .lead { font-size: 0.9rem; }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    h1 { font-size: 22px; letter-spacing: -0.3px; }
    h2 { font-size: 18px; }
    h3 { font-size: 15px; }
    .lead { font-size: 0.85rem; }
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    button, .btn, .chip, .nav-item, .tab, a {
        min-height: 44px;
    }
    .btn.small { min-height: 38px; }
}

/* Inline "10+" para textos de marketing (landing, home, create, etc.) */
.ten-plus {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}
.ten-plus__num {
    font-weight: 800;
    color: inherit;
}
.ten-plus__plus {
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    font-size: 0.88em;
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 45%, #c026d3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(99, 102, 241, 0.25));
}

/* ============ LOADING STATE (global) ============ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    width: 100%;
}
.loading-state .loading-spinner-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    animation: loadingPulse 1.8s ease-in-out infinite;
}
.loading-state .loading-spinner-wrap i {
    font-size: 1.3rem;
    color: #3b82f6;
}
.loading-state p {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
}
@keyframes loadingPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.7; }
}

/* ===== GLOBAL MOBILE FIXES ===== */
@media (max-width: 768px) {
    body.app-body {
        overflow-x: hidden;
    }
    
    /* Tab bars scroll horizontally */
    .results-tabs,
    .sessions-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    .results-tabs::-webkit-scrollbar,
    .sessions-tabs::-webkit-scrollbar {
        display: none;
    }
    
    /* Cards full width */
    .card, .stat-card {
        min-width: 0;
    }
    
    /* Avoid horizontal overflow from wide elements */
    pre, code {
        overflow-x: auto;
        max-width: 100%;
    }
    
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
    
    /* Fix long words breaking layout */
    h1, h2, h3, h4, p {
        overflow-wrap: break-word;
        word-break: break-word;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
