:root {
    /* Color Palette - Cold Arctic & Cyber Slate */
    --bg-dark: #06090e;
    --bg-deep: #030508;
    --bg-surface: #0a111c;
    --bg-panel: rgba(10, 18, 30, 0.7);
    --bg-panel-elevated: rgba(14, 25, 42, 0.85);
    
    /* Cold Frost Borders */
    --border-glass: rgba(140, 190, 245, 0.1);
    --border-glass-focus: rgba(0, 229, 255, 0.45);
    --border-glass-hover: rgba(56, 189, 248, 0.3);
    --border-frost-top: 1px solid rgba(255, 255, 255, 0.12);
    
    /* Text Hierarchy */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --text-dim: #334155;
    
    /* Cold Brand Accents */
    --accent-cyan: #00e5ff;
    --accent-cyan-rgb: 0, 229, 255;
    --accent-blue: #2563eb;
    --accent-blue-rgb: 37, 99, 235;
    --accent-ice: #7dd3fc;
    --accent-emerald: #00f5a0;
    --accent-emerald-rgb: 0, 245, 160;
    --accent-amber: #f59e0b;
    --accent-rose: #ff3366;
    --accent-rose-rgb: 255, 51, 102;
    
    /* Gradients */
    --grad-primary: linear-gradient(135deg, #0077ff 0%, #00e5ff 100%);
    --grad-primary-hover: linear-gradient(135deg, #0088ff 0%, #38bdf8 100%);
    --grad-panel: linear-gradient(145deg, rgba(12, 22, 38, 0.75) 0%, rgba(6, 12, 22, 0.85) 100%);
    --grad-glow: radial-gradient(circle at 50% 0%, rgba(0, 229, 255, 0.12) 0%, transparent 70%);
    --grad-cold-subtle: linear-gradient(180deg, rgba(56, 189, 248, 0.05) 0%, transparent 100%);

    /* Transitions & Fonts */
    --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Outfit', var(--font-sans);
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Base resets & layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Cold Aurora Mesh & Technical Dots */
    background-image: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 229, 255, 0.12), transparent 70%),
        radial-gradient(ellipse 60% 40% at 90% 90%, rgba(37, 99, 235, 0.08), transparent 60%),
        radial-gradient(circle at 10% 80%, rgba(0, 245, 160, 0.04), transparent 50%),
        radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 100% 100%, 28px 28px;
    background-position: 0 0, 0 0, 0 0, 0 0;
}

/* Header design */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 2rem;
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    background-color: rgba(6, 9, 14, 0.75);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 260px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--grad-primary);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: #03060a;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.35);
    letter-spacing: 0.04em;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: rotate(45deg);
    animation: shine 4s infinite;
}

.logo-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, var(--accent-ice) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Center Nav Bar (Segment Pill style) */
.nav-tabs {
    display: flex;
    background: rgba(10, 18, 30, 0.7);
    border: 1px solid var(--border-glass);
    padding: 0.25rem;
    border-radius: 12px;
    gap: 0.25rem;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.15rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
    background: rgba(0, 229, 255, 0.08);
    color: var(--accent-cyan);
    border-color: rgba(0, 229, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.12);
}

/* Right Nav actions container */
.nav-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 260px;
    gap: 0.75rem;
}

/* Live Telemetry Pill */
.telemetry-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    background: rgba(0, 245, 160, 0.06);
    border: 1px solid rgba(0, 245, 160, 0.2);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-emerald);
    letter-spacing: 0.02em;
}

.telemetry-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px rgba(0, 245, 160, 0.7);
    animation: livePulse 2s infinite ease-in-out;
}

/* Grid Containers */
.main-container {
    max-width: 1240px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
    flex-grow: 1;
    align-items: stretch;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 960px) {
    .main-container {
        grid-template-columns: 420px 1fr;
    }
}

/* Minimal Frosted Glass Card */
.card {
    background: var(--grad-panel);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 
        0 16px 40px -10px rgba(0, 10, 25, 0.65),
        0 0 0 1px rgba(140, 190, 245, 0.05);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.4), transparent);
    opacity: 0.7;
    pointer-events: none;
}

.card:hover {
    border-color: var(--border-glass-hover);
    box-shadow: 
        0 20px 50px -10px rgba(0, 20, 45, 0.75),
        0 0 25px rgba(0, 229, 255, 0.06);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 1;
}

.card-title svg {
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.45));
}

/* Inputs & Form layout */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
}

.form-control {
    width: 100%;
    background: rgba(6, 11, 20, 0.75);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0.85rem 1.15rem 0.85rem 2.85rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    transition: var(--transition-smooth);
}

.form-control::placeholder {
    color: var(--text-muted);
    font-family: var(--font-sans);
    letter-spacing: normal;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15), 0 0 20px rgba(0, 229, 255, 0.1);
    background: rgba(6, 11, 20, 0.95);
}

.form-control:focus + .input-icon,
.input-container:focus-within .input-icon {
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.5));
}

/* Quick Recent Searches Pill Row */
.recent-searches-box {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.recent-searches-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.recent-searches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.recent-search-chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.recent-search-chip:hover {
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.25);
    color: var(--accent-cyan);
    transform: translateY(-1px);
}

/* Buttons */
.btn-submit {
    width: 100%;
    background: var(--grad-primary);
    color: #03060a;
    border: none;
    border-radius: 12px;
    padding: 0.95rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.btn-submit:hover:not(:disabled)::before {
    left: 100%;
}

.btn-submit:hover:not(:disabled) {
    background: var(--grad-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 229, 255, 0.4);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.55rem 1.15rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(140, 190, 245, 0.25);
    color: var(--text-primary);
}

/* Tables and debt results */
.debt-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.debt-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
}

.debt-table td {
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.debt-table tr:hover td {
    background: rgba(0, 229, 255, 0.025);
    color: var(--text-primary);
}

.amount-highlight {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-rose);
    font-size: 1.05rem;
    text-shadow: 0 0 12px rgba(255, 51, 102, 0.25);
}

/* Badges */
.debt-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.debt-badge.has-debt {
    background: rgba(255, 51, 102, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(255, 51, 102, 0.25);
    box-shadow: 0 0 12px rgba(255, 51, 102, 0.12);
}

.debt-badge.no-debt {
    background: rgba(0, 245, 160, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(0, 245, 160, 0.25);
    box-shadow: 0 0 12px rgba(0, 245, 160, 0.12);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 150%; }
}

/* Modern Orbital Loading Animation */
.loading-pulse {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1.5rem;
    flex-grow: 1;
    text-align: center;
}

.orbital-spinner {
    position: relative;
    width: 64px;
    height: 64px;
    margin-bottom: 1.5rem;
}

.orbital-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent-cyan);
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.orbital-ring:nth-child(2) {
    width: 78%;
    height: 78%;
    top: 11%;
    left: 11%;
    border-top-color: transparent;
    border-right-color: var(--accent-emerald);
    animation: spinReverse 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 245, 160, 0.3);
}

.orbital-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: livePulse 1.5s infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes spinReverse {
    to { transform: rotate(-360deg); }
}

/* Result panel components */
.result-header {
    background: rgba(10, 18, 30, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 1.35rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.result-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.35), transparent);
}

.result-meta-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.result-meta-val {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Minimalist Cyber Radar Placeholder */
.placeholder-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    flex-grow: 1;
    color: var(--text-muted);
}

.radar-glyph {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 255, 0.15);
}

.radar-circle.c1 { width: 100%; height: 100%; }
.radar-circle.c2 { width: 65%; height: 65%; border-color: rgba(0, 229, 255, 0.25); }
.radar-circle.c3 { 
    width: 30%; 
    height: 30%; 
    background: rgba(0, 229, 255, 0.08); 
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.radar-crosshair-h {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(0, 229, 255, 0.12);
}

.radar-crosshair-v {
    position: absolute;
    height: 100%;
    width: 1px;
    background: rgba(0, 229, 255, 0.12);
}

.radar-sweep {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 0;
    right: 0;
    background: conic-gradient(from 0deg at 0% 100%, rgba(0, 229, 255, 0.25), transparent 60%);
    border-radius: 0 100% 0 0;
    transform-origin: 0% 100%;
    animation: radarSweep 3.5s linear infinite;
}

@keyframes radarSweep {
    to { transform: rotate(360deg); }
}

/* Status Indicator Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    transition: var(--transition-smooth);
}

.status-dot.running {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px rgba(0, 245, 160, 0.6);
    animation: livePulse 2s infinite;
}

.status-dot.stopped {
    background-color: var(--accent-rose);
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.6);
}

@keyframes livePulse {
    0% { transform: scale(0.95); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.6; }
}

/* Toast container */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    background: rgba(8, 14, 24, 0.95);
    color: var(--text-primary);
    padding: 0.95rem 1.35rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    animation: toast-slide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 320px;
    font-size: 0.88rem;
}

@keyframes toast-slide {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.error { 
    border-left: 4px solid var(--accent-rose); 
    box-shadow: 0 10px 25px rgba(255, 51, 102, 0.15);
}

.toast.info { 
    border-left: 4px solid var(--accent-cyan); 
    box-shadow: 0 10px 25px rgba(0, 229, 255, 0.15);
}

.toast.success { 
    border-left: 4px solid var(--accent-emerald); 
    box-shadow: 0 10px 25px rgba(0, 245, 160, 0.15);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-glass);
    margin-top: auto;
    background-color: rgba(3, 5, 8, 0.5);
    letter-spacing: 0.04em;
    backdrop-filter: blur(10px);
}
