/* ============================================
   CTRL+F FÍSICO — DESIGN SYSTEM v3.0
   Apple · Tesla · Starlink · Premium Dark
   ============================================ */

/* ── Tokens ── */
:root {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --primary-subtle: rgba(99, 102, 241, 0.08);
    --accent: #8b5cf6;
    --success: #10b981;
    --success-dim: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.10);
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.10);

    --bg: #000000;
    --bg-raised: #050505;
    --surface: rgba(255, 255, 255, 0.02);
    --card-bg: rgba(255, 255, 255, 0.04);
    --glass: rgba(10, 10, 10, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.18);

    --text-main: #f5f5f7;
    --text-dim: #86868b;
    --text-muted: #48484a;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 32px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--primary-glow);

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;

    --transition-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    font-size: 15px;
    overflow-x: hidden;
    position: relative;
}

/* ── Animated Background Orbs (Apple/Starlink style) ── */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    z-index: -1;
    animation: orbFloat 20s ease-in-out infinite alternate;
}

body::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
    top: -20%;
    left: -10%;
}

body::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent 70%);
    bottom: -15%;
    right: -10%;
    animation-delay: -10s;
    animation-direction: alternate-reverse;
}

@keyframes orbFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -40px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    100% {
        transform: translate(10px, -10px) scale(1.05);
    }
}

/* ── Typography (Apple-inspired) ── */
h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

h4 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h4.logo-premium {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.logo-premium:hover {
    opacity: 0.8;
}

.logo-svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.4));
}

.logo-text {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--text-main);
    text-transform: uppercase;
}

.logo-subtext {
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0;
}

/* ── Splash Screen (Tesla-style) ── */
.splash-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s var(--transition-smooth), visibility 1s;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-logo {
    width: 80px;
    height: 80px;
    color: var(--primary);
    filter: drop-shadow(0 0 20px var(--primary-glow));
    animation: splashPulse 2.5s ease-in-out infinite;
}

@keyframes splashPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
        filter: drop-shadow(0 0 30px var(--primary-glow));
    }
}

.splash-loader {
    width: 140px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    margin-top: 40px;
    position: relative;
    overflow: hidden;
}

.splash-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: loaderSlide 2s infinite;
}

@keyframes loaderSlide {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

a {
    color: inherit;
    text-decoration: none;
}

.gradient-text {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #f0abfc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Navbar (Tesla-style: clean, transparent→blur on scroll) ── */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-xl);
    height: 56px;
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.4s, border-color 0.4s;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.logo {
    font-weight: 700;
    font-size: 1.05rem;
    background: linear-gradient(135deg, #f5f5f7, #a1a1aa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2px;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.82rem;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    letter-spacing: -0.01em;
}

.nav-links a:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

/* ── Container ── */
.container {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-xl);
    width: 100%;
}

/* ── Cards (Premium Glass) ── */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    transition: transform 0.5s var(--transition-smooth),
        box-shadow 0.5s var(--transition-smooth),
        border-color 0.4s;
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border-hover);
}

/* ── Buttons (Apple-inspired: clean, weight, subtle glow) ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--text-main);
    color: var(--bg);
    padding: 12px 24px;
    border-radius: 980px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);

    opacity: 0;
    transition: opacity 0.3s;
}

/* --- Bounding Box Highlight --- */
.bbox-highlight {
    position: absolute;
    left: calc(var(--left) * 100%);
    top: calc(var(--top) * 100%);
    width: calc(var(--width) * 100%);
    height: calc(var(--height) * 100%);
    border: 2px solid var(--primary);
    border-radius: 4px;
    box-shadow: 0 0 12px var(--primary-glow);
    animation: pulse 2s infinite;
    pointer-events: none;
}

.btn:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--glass-border-hover);
    box-shadow: none;
    transform: scale(1.02);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 0.95rem;
}

/* ── Forms (Apple style) ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 980px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

.badge-success {
    background: var(--success-dim);
    color: #6ee7b7;
}

.badge-warning {
    background: var(--warning-dim);
    color: #fcd34d;
}

.badge-danger {
    background: var(--danger-dim);
    color: #fca5a5;
}

/* ── Grid ── */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ── Flash Messages ── */
.flash-messages {
    margin-bottom: var(--space-md);
}

.flash {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
}

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    gap: var(--space-md);
    flex-wrap: wrap;
}

.page-header h1,
.page-header h2 {
    margin: 0;
}

.page-subtitle {
    color: var(--text-dim);
    font-size: 0.88rem;
    margin-top: 6px;
    letter-spacing: -0.01em;
}

/* ── Stat Card ── */
.stat-card {
    padding: var(--space-xl) var(--space-lg);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--stat-color, var(--primary)), transparent);
    opacity: 0.5;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.stat-value {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    margin-top: 8px;
    line-height: 1;
    letter-spacing: -0.03em;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    grid-column: 1 / -1;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-state p {
    color: var(--text-dim);
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Scroll Reveal Animations ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

    100% {
        background-position: 200% center;
    }
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 0 12px transparent;
    }
}

/* Scroll-triggered reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--transition-smooth),
        transform 0.8s var(--transition-smooth);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

.reveal-delay-4 {
    transition-delay: 0.4s;
}

/* Legacy fade-up (instant) */
.fade-up {
    animation: fadeUp 0.6s var(--transition-smooth) both;
}

.fade-up-1 {
    animation-delay: 0.08s;
}

.fade-up-2 {
    animation-delay: 0.16s;
}

.fade-up-3 {
    animation-delay: 0.24s;
}

.fade-up-4 {
    animation-delay: 0.32s;
}

/* ── Divider ── */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
    margin: var(--space-2xl) 0;
}

/* ── Mobile Navigation ── */
.mobile-nav {
    display: none;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.58rem;
    font-weight: 600;
    gap: 3px;
    padding: 4px 0;
    transition: color 0.2s;
    letter-spacing: 0.02em;
}

.mobile-nav-item.active {
    color: var(--text-main);
}

.mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-icon svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-item.active .mobile-nav-icon svg {
    transform: scale(1.1);
    stroke: var(--primary);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.4));
}

.center-scan {
    position: relative;
    top: -12px;
    background: var(--primary);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: white !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
    border: 3px solid rgba(0, 0, 0, 0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.center-scan:active {
    transform: scale(0.9) translateY(2px);
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.center-scan .mobile-nav-icon svg {
    width: 28px;
    height: 28px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar {
        padding: 0 var(--space-md);
        height: 48px;
    }

    .nav-links {
        display: none;
    }

    .mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(30px) saturate(1.8);
        -webkit-backdrop-filter: blur(30px) saturate(1.8);
        border-top: 1px solid rgba(255, 255, 255, 0.04);
        justify-content: space-around;
        padding: 6px 4px;
        z-index: 1000;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }

    .container {
        padding: var(--space-lg) var(--space-md);
        padding-bottom: 5rem;
    }

    .card {
        padding: var(--space-md);
        border-radius: var(--radius-lg);
    }

    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- BENTO GRID SYSTEM (Apple style) --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: var(--space-lg);
    margin: var(--space-2xl) 0;
}

.bento-item {
    position: relative;
    overflow: hidden;
    height: 100%;
}

.bento-p-2 {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-h-2 {
    grid-column: span 2;
}

.bento-v-2 {
    grid-row: span 2;
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 140px;
    }

    .bento-p-2,
    .bento-h-2 {
        grid-column: span 2;
    }
}

/* --- DYNAMIC ISLAND (Apple style) --- */
.island-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.dynamic-island {
    background: #000;
    color: white;
    border-radius: 980px;
    padding: 8px 12px;
    min-width: 120px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: auto;
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
}

.dynamic-island.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.dynamic-island.expanded {
    padding: 16px 24px;
    border-radius: 36px;
    min-width: 320px;
}

.island-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- TELEMETRY HUD (Tesla style) --- */
.hud-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-left: 2px solid var(--primary);
}

.hud-data {
    margin-bottom: 4px;
    display: flex;
    gap: 8px;
}

.hud-val {
    color: white;
    font-weight: bold;
}

/* --- SMART CHIPS (Google style) --- */
.chip-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px;
    margin: var(--space-md) 0;
    scrollbar-width: none;
}

.chip-container::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 980px;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border-hover);
}

.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}