/* ── Base ── */
* {
    transition-property: color, background-color, border-color, opacity, box-shadow, transform;
    transition-duration: 200ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #030712;
    position: relative;
    overflow-x: hidden;
}

/* ── Animated background orbs ── */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}
body::before {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -100px;
    background: radial-gradient(circle, rgba(234, 88, 12, 0.1) 0%, rgba(234, 88, 12, 0.03) 40%, transparent 70%);
    animation: orbFloat1 20s ease-in-out infinite;
}
body::after {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -100px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.08) 0%, rgba(249, 115, 22, 0.03) 40%, transparent 70%);
    animation: orbFloat2 25s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(15vw, 10vh) scale(1.1); }
    50% { transform: translate(5vw, 30vh) scale(0.9); }
    75% { transform: translate(-5vw, 15vh) scale(1.05); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-10vw, -15vh) scale(1.15); }
    50% { transform: translate(-20vw, -5vh) scale(0.85); }
    75% { transform: translate(-5vw, -20vh) scale(1.1); }
}

/* Third orb via main::before */
main { position: relative; flex: 1; }
main::after {
    content: '';
    position: fixed;
    width: 400px;
    height: 400px;
    top: 40%;
    left: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.05) 0%, transparent 65%);
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
    animation: orbFloat3 18s ease-in-out infinite;
}
@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    33% { transform: translate(-30%, -30%) scale(1.2); }
    66% { transform: translate(-70%, -60%) scale(0.8); }
}

body > * { position: relative; z-index: 1; }


/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #374151, #1f2937);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #4b5563, #374151); }

/* ── Selection ── */
::selection { background: rgba(249, 115, 22, 0.35); color: #fff; }

/* ── Inputs ── */
input[type="radio"] { accent-color: #f97316; }
input[type="number"]::-webkit-inner-spin-button { opacity: 1; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15), 0 0 24px rgba(249, 115, 22, 0.06);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ── Tables ── */
table { border-collapse: collapse; }

/* ── Cards ── */
.card-glow {
    position: relative;
    background: linear-gradient(160deg, rgba(17, 24, 39, 0.95) 0%, rgba(10, 15, 25, 0.9) 100%) !important;
    border-color: rgba(55, 65, 81, 0.5) !important;
    backdrop-filter: blur(12px);
}
.card-glow::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.0) 0%, rgba(249, 115, 22, 0.25) 50%, rgba(234, 88, 12, 0.0) 100%);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.card-glow:hover::before {
    opacity: 1;
    animation: borderShift 3s ease infinite;
}
.card-glow:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(249, 115, 22, 0.04);
    border-color: rgba(75, 85, 99, 0.6) !important;
}

@keyframes borderShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ── Links ── */
a { transition: color 0.2s ease, opacity 0.2s ease; }

/* ── Buttons glow ── */
.btn-fire {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%) !important;
    box-shadow: 0 2px 12px rgba(234, 88, 12, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    border: none !important;
    letter-spacing: 0.02em;
}
.btn-fire::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.btn-fire::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn-fire:hover {
    box-shadow: 0 6px 24px rgba(234, 88, 12, 0.45), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.btn-fire:hover::before { opacity: 1; }
.btn-fire:hover::after { opacity: 1; }
.btn-fire:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
    transition-duration: 80ms;
}

/* ── Nav ── */
nav {
    background: linear-gradient(180deg, rgba(3, 7, 18, 0.92) 0%, rgba(3, 7, 18, 0.8) 100%) !important;
    backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 1px 0 rgba(249, 115, 22, 0.06);
}

.nav-link {
    position: relative;
    padding-bottom: 2px;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #f97316, #ef4444);
    border-radius: 1px;
    transition: width 0.3s ease, left 0.3s ease;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
}
.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* ── Mobile menu ── */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
.mobile-menu.open {
    max-height: 400px;
    opacity: 1;
}

/* ── Hamburger ── */
.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #9ca3af;
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ── Page entrance ── */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
main > * {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}
main > *:nth-child(1) { animation-delay: 0.04s; }
main > *:nth-child(2) { animation-delay: 0.1s; }
main > *:nth-child(3) { animation-delay: 0.16s; }
main > *:nth-child(4) { animation-delay: 0.22s; }
main > *:nth-child(5) { animation-delay: 0.28s; }
main > *:nth-child(n+6) { animation-delay: 0.34s; }

/* ── Badge pulse ── */
@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.badge-pulse { animation: subtlePulse 2s ease-in-out infinite; }

/* ── Stat cards ── */
.stat-card {
    background: linear-gradient(145deg, rgba(17, 24, 39, 1) 0%, rgba(15, 20, 35, 0.8) 100%);
    border: 1px solid rgba(55, 65, 81, 0.4);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at top right, rgba(249, 115, 22, 0.08) 0%, transparent 70%);
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 30px rgba(249, 115, 22, 0.04);
    border-color: rgba(249, 115, 22, 0.15);
}

/* ── Status badges ── */
.bg-green-900\/50 {
    background: linear-gradient(135deg, rgba(20, 83, 45, 0.5) 0%, rgba(22, 101, 52, 0.3) 100%);
    box-shadow: inset 0 0 12px rgba(34, 197, 94, 0.06);
}
.bg-yellow-900\/50 {
    background: linear-gradient(135deg, rgba(113, 63, 18, 0.5) 0%, rgba(133, 77, 14, 0.3) 100%);
    box-shadow: inset 0 0 12px rgba(234, 179, 8, 0.06);
}
.bg-red-900\/50 {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.5) 0%, rgba(153, 27, 27, 0.3) 100%);
    box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.06);
}

/* ── Action buttons (toggle/delete/etc) ── */
.bg-gray-800.hover\:bg-gray-700 {
    border: 1px solid rgba(55, 65, 81, 0.5);
    position: relative;
    overflow: hidden;
}
.bg-gray-800.hover\:bg-gray-700:hover {
    border-color: rgba(75, 85, 99, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ── Brand heading glow ── */
.text-fire-500 {
    text-shadow: 0 0 30px rgba(249, 115, 22, 0.2);
}

/* ── HELLFLARE logo on auth pages ── */
h1.text-3xl.text-fire-500 {
    background: linear-gradient(135deg, #f97316 0%, #ef4444 50%, #f97316 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 4s ease infinite;
}
@keyframes gradientText {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 200% center; }
}

/* ── Code blocks (link codes) ── */
code.text-fire-400 {
    text-shadow: 0 0 20px rgba(249, 115, 22, 0.3);
}

/* ── Mobile ── */
@media (max-width: 640px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table thead { white-space: nowrap; }

    .grid-cols-1.md\:grid-cols-2,
    .grid-cols-1.md\:grid-cols-3 {
        gap: 0.75rem;
    }

    input, select, textarea {
        min-height: 44px;
        font-size: 16px !important;
    }

    button, [type="submit"], a.rounded-lg {
        min-height: 44px;
    }

    h1 { font-size: 1.375rem !important; }
    h2 { font-size: 1.125rem !important; }

    main {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 1rem;
        padding-bottom: 1.5rem;
    }

    .card-glow:hover {
        transform: none;
        box-shadow: none;
    }

    .stat-card:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* ── Footer ── */
footer {
    background: linear-gradient(180deg, transparent 0%, rgba(3, 7, 18, 0.5) 100%);
}
footer a {
    position: relative;
}
footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, #f97316, transparent);
    transition: width 0.3s ease;
}
footer a:hover::after {
    width: 100%;
}

.password-toggle {
    line-height: 1;
}

.auth-legal-bar {
    backdrop-filter: blur(16px) saturate(1.2);
}

/* ══════════════════════════════════════ */
/* ── Light Theme Overrides ──           */
/* ══════════════════════════════════════ */

[data-theme="light"] body {
    background-color: #f8fafc !important;
    color: #1e293b !important;
}
[data-theme="light"] body::before {
    background: radial-gradient(circle, rgba(249, 115, 22, 0.06) 0%, rgba(249, 115, 22, 0.02) 40%, transparent 70%);
}
[data-theme="light"] body::after {
    background: radial-gradient(circle, rgba(234, 88, 12, 0.04) 0%, rgba(249, 115, 22, 0.01) 40%, transparent 70%);
}
[data-theme="light"] main::after {
    background: radial-gradient(circle, rgba(249, 115, 22, 0.03) 0%, transparent 65%);
}

/* Backgrounds */
[data-theme="light"] .bg-gray-950 { background-color: #f8fafc !important; }
[data-theme="light"] .bg-gray-900 { background-color: #ffffff !important; }
[data-theme="light"] .bg-gray-800 { background-color: #f1f5f9 !important; }
[data-theme="light"] .bg-gray-800\/50 { background-color: rgba(241,245,249,0.6) !important; }
[data-theme="light"] .bg-gray-800\/30 { background-color: rgba(241,245,249,0.4) !important; }
[data-theme="light"] .bg-gray-950\/30 { background-color: rgba(248,250,252,0.4) !important; }

/* Borders */
[data-theme="light"] .border-gray-800 { border-color: #e2e8f0 !important; }
[data-theme="light"] .border-gray-700 { border-color: #cbd5e1 !important; }
[data-theme="light"] .border-gray-600 { border-color: #94a3b8 !important; }

/* Text */
[data-theme="light"] .text-gray-100 { color: #1e293b !important; }
[data-theme="light"] .text-white { color: #1e293b !important; }
[data-theme="light"] .text-gray-300 { color: #475569 !important; }
[data-theme="light"] .text-gray-400 { color: #64748b !important; }
[data-theme="light"] .text-gray-500 { color: #94a3b8 !important; }
[data-theme="light"] .text-gray-600 { color: #94a3b8 !important; }

/* Dividers */
[data-theme="light"] .divide-gray-800 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e2e8f0 !important;
}

/* Hover */
[data-theme="light"] .hover\:bg-gray-800:hover { background-color: #e2e8f0 !important; }
[data-theme="light"] .hover\:bg-gray-700:hover { background-color: #e2e8f0 !important; }
[data-theme="light"] .hover\:text-white:hover { color: #0f172a !important; }

/* Colored badges */
[data-theme="light"] .bg-red-900\/50 { background: rgba(254,226,226,0.8) !important; box-shadow: none; }
[data-theme="light"] .bg-green-900\/50 { background: rgba(220,252,231,0.8) !important; box-shadow: none; }
[data-theme="light"] .bg-yellow-900\/50 { background: rgba(254,249,195,0.8) !important; box-shadow: none; }
[data-theme="light"] .bg-blue-900\/50 { background-color: rgba(219,234,254,0.8) !important; }
[data-theme="light"] .bg-purple-900\/50 { background-color: rgba(237,233,254,0.8) !important; }

[data-theme="light"] .text-red-300,
[data-theme="light"] .text-red-400 { color: #dc2626 !important; }
[data-theme="light"] .text-green-400 { color: #16a34a !important; }
[data-theme="light"] .text-yellow-400,
[data-theme="light"] .text-yellow-300 { color: #ca8a04 !important; }
[data-theme="light"] .text-blue-400 { color: #2563eb !important; }
[data-theme="light"] .text-purple-400 { color: #7c3aed !important; }

[data-theme="light"] .border-red-800 { border-color: #fca5a5 !important; }

/* Inputs */
[data-theme="light"] input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]) {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}
[data-theme="light"] select {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}
[data-theme="light"] input::placeholder { color: #94a3b8 !important; }
[data-theme="light"] input:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1) !important;
}

/* Brand buttons keep white text */
[data-theme="light"] .btn-fire { color: #ffffff !important; }
[data-theme="light"] .bg-fire-600,
[data-theme="light"] button[type="submit"].bg-fire-600,
[data-theme="light"] a.bg-fire-600 { color: #ffffff !important; }

/* Hover colored buttons */
[data-theme="light"] .hover\:bg-red-900:hover { background-color: rgba(254,202,202,0.8) !important; }
[data-theme="light"] .hover\:bg-green-900:hover { background-color: rgba(187,247,208,0.8) !important; }
[data-theme="light"] .hover\:bg-yellow-900:hover { background-color: rgba(254,240,138,0.8) !important; }

/* Code & mono */
[data-theme="light"] code { color: #ea580c !important; }
[data-theme="light"] .font-mono { color: #334155 !important; }
[data-theme="light"] .select-all { color: #ea580c !important; }

/* Cards light */
[data-theme="light"] .card-glow {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%) !important;
    border-color: #e2e8f0 !important;
}
[data-theme="light"] .card-glow:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06), 0 0 60px rgba(249, 115, 22, 0.03) !important;
    border-color: rgba(249, 115, 22, 0.2) !important;
}
[data-theme="light"] .card-glow::before {
    background: linear-gradient(135deg, transparent 30%, rgba(249, 115, 22, 0.12) 100%);
}

/* Stat card light */
[data-theme="light"] .stat-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
    border-color: #e2e8f0 !important;
}
[data-theme="light"] .stat-card:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06) !important;
    border-color: rgba(249, 115, 22, 0.15) !important;
}
[data-theme="light"] .stat-card::after {
    background: radial-gradient(circle at top right, rgba(249, 115, 22, 0.05) 0%, transparent 70%);
}

/* Nav light */
[data-theme="light"] nav {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.82) 100%) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

/* Footer light */
[data-theme="light"] footer {
    background: linear-gradient(180deg, transparent 0%, rgba(241, 245, 249, 0.5) 100%);
}

/* Scrollbar light */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Selection light */
[data-theme="light"] ::selection { background: rgba(249, 115, 22, 0.2); color: #1e293b; }

/* Radio labels */
[data-theme="light"] label:has(input:checked) {
    border-color: #ea580c !important;
    background-color: rgba(255,247,237,0.5) !important;
}

/* Checkbox */
[data-theme="light"] input[type="checkbox"] {
    background-color: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

[data-theme="light"] .auth-legal-bar {
    background-color: rgba(255, 255, 255, 0.96) !important;
    border-color: #e2e8f0 !important;
}

/* Text effects light */
[data-theme="light"] .text-fire-500 { text-shadow: none; }
[data-theme="light"] code.text-fire-400 { text-shadow: none; }
[data-theme="light"] h1.text-3xl.text-fire-500 {
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 50%, #ea580c 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav underline light */
[data-theme="light"] .nav-link::after {
    background: linear-gradient(90deg, #ea580c, #dc2626);
    box-shadow: 0 0 6px rgba(234, 88, 12, 0.3);
}
[data-theme="light"] footer a::after { background: #94a3b8; }
