/* ===== GOOGLE FONT ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    /* Light Mode - Vibrant & Modern */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-secondary: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-cool: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-neon: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
    --gradient-rainbow: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);

    /* Light Mode Backgrounds - More Vibrant */
    --bg-body: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-card: rgba(255,255,255,0.95);
    --bg-card-solid: #ffffff;
    --bg-navbar: rgba(255,255,255,0.95);
    --bg-input: #f8f9fa;
    --bg-result: linear-gradient(135deg, rgba(102,126,234,0.12), rgba(118,75,162,0.12));

    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --border-color: rgba(102,102,241,0.15);
    --border-input: #e0e7ff;

    --shadow-sm: 0 2px 8px rgba(102,102,241,0.1);
    --shadow-md: 0 4px 16px rgba(102,102,241,0.15);
    --shadow-lg: 0 8px 32px rgba(102,102,241,0.2);
    --shadow-glow: 0 0 25px rgba(99,102,241,0.4);
    --shadow-neon: 0 0 30px rgba(139,92,246,0.3), 0 0 60px rgba(139,92,246,0.1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50px;

    --transition: 0.3s ease;
}

[data-theme="dark"] {
    --bg-body: #0f0f1a;
    --bg-card: rgba(22,22,40,0.85);
    --bg-card-solid: #16162a;
    --bg-navbar: rgba(15,15,26,0.92);
    --bg-input: #1e1e36;
    --bg-result: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.15));

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;

    --border-color: rgba(255,255,255,0.08);
    --border-input: #2e2e4a;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Base body - no background here */
body {
    position: relative;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(80px, 50px) scale(1.15) rotate(180deg); }
    100% { transform: translate(-40px, 70px) scale(0.9) rotate(360deg); }
}

/* ===== NAVBAR ===== */
.navbar-custom {
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 0;
    transition: background var(--transition);
    z-index: 1000;
}

.navbar-custom .navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.navbar-custom .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    position: relative;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--primary);
    background: rgba(102,126,234,0.08);
}

.navbar-custom .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 20px; height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* Theme Toggle */
.theme-toggle {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.1rem;
}
.theme-toggle:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: rotate(30deg);
}

/* ===== HERO SECTION ===== */
.hero-section {
    padding: 4rem 0 3rem;
    text-align: center;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 900;
    background: var(--gradient-primary);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: -1.5px;
    animation: fadeInUp 0.8s ease-out, gradientShift 6s ease infinite;
}

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

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.7;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

/* ===== FEATURE CARDS ===== */
.feature-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    animation: fadeInUp 0.6s ease-out both;
}

.feature-card:nth-child(2) { animation-delay: 0.05s; }
.feature-card:nth-child(3) { animation-delay: 0.1s; }
.feature-card:nth-child(4) { animation-delay: 0.15s; }
.feature-card:nth-child(5) { animation-delay: 0.2s; }
.feature-card:nth-child(6) { animation-delay: 0.25s; }

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-neon);
    border-color: rgba(99,102,241,0.4);
    color: inherit;
    text-decoration: none;
}

.feature-icon {
    width: 64px; height: 64px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    margin: 0 auto 1.2rem;
    transition: transform var(--transition);
}
.feature-card:hover .feature-icon { transform: scale(1.1) rotate(-5deg); }

.feature-icon.aritmatika { background: var(--gradient-primary); }
.feature-icon.logika { background: var(--gradient-secondary); }
.feature-icon.konversi { background: var(--gradient-cool); }
.feature-icon.suhu { background: var(--gradient-warm); }
.feature-icon.mata-uang { background: var(--gradient-success); }
.feature-icon.bonus { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

.feature-card h5 {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}
.feature-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
}

/* ===== PAGE HEADER ===== */
.page-header {
    padding: 2.5rem 0 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.4rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== CALCULATOR CARD ===== */
.calc-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition);
    animation: fadeInUp 0.6s ease-out 0.1s both;
    position: relative;
}

.calc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.8;
}

.calc-card-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calc-card-title i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== FORM STYLES ===== */
.form-label-custom {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.form-control-custom {
    background: var(--bg-input);
    border: 2px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all var(--transition);
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102,126,234,0.15);
    background: var(--bg-card-solid);
    outline: none;
    color: var(--text-primary);
}

.form-control-custom::placeholder {
    color: var(--text-muted);
}

.form-select-custom {
    background: var(--bg-input);
    border: 2px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all var(--transition);
    cursor: pointer;
}

.form-select-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102,126,234,0.15);
    outline: none;
    color: var(--text-primary);
}

/* ===== OPERATION BUTTONS ===== */
.op-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.op-btn {
    padding: 0.7rem 0.5rem;
    border: 2px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.op-btn:hover {
    border-color: var(--primary);
    background: rgba(102,126,234,0.08);
    color: var(--primary);
}

.op-btn.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

/* ===== CALCULATE BUTTON ===== */
.btn-calculate {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 2.5rem;
    font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    width: 100%;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

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

.btn-calculate:hover::before { left: 100%; }
.btn-calculate:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-neon);
}
.btn-calculate:active { transform: translateY(0); }

.btn-calculate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== RESULT SECTION ===== */
.result-section {
    background: var(--bg-result);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 1.5rem;
    animation: fadeInUp 0.4s ease-out;
    display: none;
}

.result-section.show { display: block; }

.result-value {
    font-size: 2.2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
    word-break: break-all;
}

.result-formula {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.result-formula code {
    background: rgba(99,102,241,0.12);
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

/* Math notation styling */
.math-notation {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
    line-height: 1.8;
    overflow-x: auto;
    color: var(--text-primary);
    margin: 0.5rem 0;
}
.math-notation .highlight { color: var(--primary); font-weight: 700; }
.math-notation .dim { color: var(--text-muted); }
.math-sub { font-size: 0.7em; vertical-align: sub; }
.math-sup { font-size: 0.7em; vertical-align: super; }

/* Circuit builder */
.circuit-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.3s ease-out;
}
.circuit-row select, .circuit-row input {
    flex: 1;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-input);
    background: var(--bg-card-solid);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}
.circuit-row select:focus, .circuit-row input:focus {
    border-color: var(--primary);
    outline: none;
}
.circuit-remove {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(239,68,68,0.1);
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.circuit-remove:hover { background: var(--danger); color: #fff; }
.btn-add-gate {
    background: rgba(99,102,241,0.08);
    border: 2px dashed rgba(99,102,241,0.3);
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    margin-bottom: 1rem;
}
.btn-add-gate:hover {
    background: rgba(99,102,241,0.15);
    border-color: var(--primary);
}

/* ===== STEPS TIMELINE ===== */
.steps-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: 0.5rem;
}

.step-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px; top: 36px;
    width: 2px;
    height: calc(100% - 36px);
    background: var(--border-input);
}

.step-number {
    width: 32px; height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 1;
}

.step-content {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.5;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    background: rgba(252,129,129,0.1);
    border: 1px solid rgba(252,129,129,0.3);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-weight: 500;
    display: none;
    animation: shake 0.4s ease;
}
.error-message.show { display: flex; align-items: center; gap: 0.5rem; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== TABS (Konversi page) ===== */
.tab-nav {
    display: flex;
    gap: 0.3rem;
    background: var(--bg-input);
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tab-btn.active {
    background: var(--bg-card-solid);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* ===== HISTORY ===== */
.history-item {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.5rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition);
    animation: fadeInUp 0.4s ease-out both;
}

.history-item:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(102,126,234,0.2);
}

.history-category {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

.history-category.aritmatika { background: var(--gradient-primary); }
.history-category.logika { background: var(--gradient-secondary); }
.history-category.konversi { background: var(--gradient-cool); }
.history-category.bonus { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

.history-formula {
    font-weight: 600;
    font-size: 1rem;
    margin: 0.5rem 0 0.2rem;
}

.history-result {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-clear-history {
    background: rgba(252,129,129,0.1);
    color: var(--danger);
    border: 1px solid rgba(252,129,129,0.3);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-clear-history:hover {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== MINI HISTORY SIDEBAR ===== */
.mini-history-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mini-history-item {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.mini-history-item:last-child { border-bottom: none; }

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.animate-in { animation: fadeInUp 0.6s ease-out both; }

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .op-grid { grid-template-columns: repeat(2, 1fr); }
    .calc-card { padding: 1.5rem; }
    .result-value { font-size: 1.6rem; }
    .page-header h1 { font-size: 1.6rem; }
    .tab-nav { flex-wrap: wrap; }
    .tab-btn { font-size: 0.78rem; padding: 0.6rem 0.5rem; }
}

@media (max-width: 576px) {
    .hero-title { font-size: 1.7rem; }
    .op-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-card { padding: 1.5rem 1rem; }
    .navbar-custom .navbar-brand { font-size: 1.05rem; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ===== CRITICAL THEME OVERRIDES - MUST BE LAST ===== */
/* These ensure theme changes are immediately visible */

/* Dark Theme - Force Black Background */
html[data-theme="dark"],
html[data-theme="dark"] body,
html.theme-dark,
html.theme-dark body,
body.theme-dark {
    background: #0a0e27 !important;
    color: #00ff87 !important;
}

/* Light Theme - Force Gradient Background */
html[data-theme="light"],
html[data-theme="light"] body,
html.theme-light,
html.theme-light body,
body.theme-light {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe) !important;
    background-size: 400% 400% !important;
    animation: gradientShift 15s ease infinite !important;
    color: #1a1a2e !important;
}

/* ===== DARK MODE NAVBAR - FORCE BLACK ===== */
html[data-theme="dark"] .navbar-custom,
html.theme-dark .navbar-custom,
body.theme-dark .navbar-custom,
[data-theme="dark"] .navbar-custom {
    background: rgba(10, 14, 39, 0.98) !important;
    background-color: rgba(10, 14, 39, 0.98) !important;
    border-bottom: 2px solid #00ff87 !important;
    box-shadow: 0 0 20px rgba(0,255,135,0.3) !important;
}

html[data-theme="dark"] .navbar-custom .navbar-brand,
html.theme-dark .navbar-custom .navbar-brand,
body.theme-dark .navbar-custom .navbar-brand,
[data-theme="dark"] .navbar-custom .navbar-brand {
    color: #00ff87 !important;
    background: none !important;
    -webkit-text-fill-color: #00ff87 !important;
}

html[data-theme="dark"] .navbar-custom .nav-link,
html.theme-dark .navbar-custom .nav-link,
body.theme-dark .navbar-custom .nav-link,
[data-theme="dark"] .navbar-custom .nav-link {
    color: #8b9dc3 !important;
}

html[data-theme="dark"] .navbar-custom .nav-link:hover,
html[data-theme="dark"] .navbar-custom .nav-link.active,
html.theme-dark .navbar-custom .nav-link:hover,
html.theme-dark .navbar-custom .nav-link.active,
body.theme-dark .navbar-custom .nav-link:hover,
body.theme-dark .navbar-custom .nav-link.active,
[data-theme="dark"] .navbar-custom .nav-link:hover,
[data-theme="dark"] .navbar-custom .nav-link.active {
    color: #00ff87 !important;
    background: rgba(0,255,135,0.08) !important;
}

/* ===== LIGHT MODE NAVBAR - FORCE WHITE ===== */
html[data-theme="light"] .navbar-custom,
html.theme-light .navbar-custom,
body.theme-light .navbar-custom,
[data-theme="light"] .navbar-custom {
    background: rgba(255, 255, 255, 0.98) !important;
    background-color: rgba(255, 255, 255, 0.98) !important;
    border-bottom: 3px solid rgba(102, 102, 241, 0.5) !important;
}

html[data-theme="light"] .navbar-custom .navbar-brand,
html.theme-light .navbar-custom .navbar-brand,
body.theme-light .navbar-custom .navbar-brand,
[data-theme="light"] .navbar-custom .navbar-brand {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* ===== DARK MODE CARDS - FORCE BLACK WITH GREEN BORDER ===== */
html[data-theme="dark"] .calc-card,
html[data-theme="dark"] .feature-card,
html.theme-dark .calc-card,
html.theme-dark .feature-card,
body.theme-dark .calc-card,
body.theme-dark .feature-card,
[data-theme="dark"] .calc-card,
[data-theme="dark"] .feature-card {
    background: rgba(15, 20, 25, 0.95) !important;
    background-color: rgba(15, 20, 25, 0.95) !important;
    border: 2px solid rgba(0, 255, 135, 0.3) !important;
    border-color: rgba(0, 255, 135, 0.3) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8) !important;
}

html[data-theme="dark"] .feature-card:hover,
html.theme-dark .feature-card:hover,
body.theme-dark .feature-card:hover,
[data-theme="dark"] .feature-card:hover {
    border-color: #00ff87 !important;
    box-shadow: 0 0 30px rgba(0,255,135,0.5) !important;
}

/* ===== LIGHT MODE CARDS - FORCE WHITE WITH PURPLE BORDER ===== */
html[data-theme="light"] .calc-card,
html[data-theme="light"] .feature-card,
html.theme-light .calc-card,
html.theme-light .feature-card,
body.theme-light .calc-card,
body.theme-light .feature-card,
[data-theme="light"] .calc-card,
[data-theme="light"] .feature-card {
    background: rgba(255, 255, 255, 0.95) !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid rgba(102, 102, 241, 0.4) !important;
    border-color: rgba(102, 102, 241, 0.4) !important;
    box-shadow: 0 8px 32px rgba(102,102,241,0.3) !important;
}

/* ===== DARK MODE TEXT COLORS ===== */
html[data-theme="dark"] .calc-card-title,
html[data-theme="dark"] .feature-card h5,
html[data-theme="dark"] .hero-title,
html.theme-dark .calc-card-title,
html.theme-dark .feature-card h5,
html.theme-dark .hero-title,
body.theme-dark .calc-card-title,
body.theme-dark .feature-card h5,
body.theme-dark .hero-title,
[data-theme="dark"] .calc-card-title,
[data-theme="dark"] .feature-card h5,
[data-theme="dark"] .hero-title {
    color: #00ff87 !important;
    background: none !important;
    -webkit-text-fill-color: #00ff87 !important;
}

html[data-theme="dark"] .feature-card p,
html[data-theme="dark"] .hero-subtitle,
html.theme-dark .feature-card p,
html.theme-dark .hero-subtitle,
body.theme-dark .feature-card p,
body.theme-dark .hero-subtitle,
[data-theme="dark"] .feature-card p,
[data-theme="dark"] .hero-subtitle {
    color: #8b9dc3 !important;
}

/* ===== LIGHT MODE TEXT COLORS ===== */
html[data-theme="light"] .calc-card-title,
html[data-theme="light"] .feature-card h5,
html.theme-light .calc-card-title,
html.theme-light .feature-card h5,
body.theme-light .calc-card-title,
body.theme-light .feature-card h5,
[data-theme="light"] .calc-card-title,
[data-theme="light"] .feature-card h5 {
    color: #6366f1 !important;
}

html[data-theme="light"] .hero-title,
html.theme-light .hero-title,
body.theme-light .hero-title,
[data-theme="light"] .hero-title {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

html[data-theme="light"] .feature-card p,
html.theme-light .feature-card p,
body.theme-light .feature-card p,
[data-theme="light"] .feature-card p {
    color: #6b7280 !important;
}

/* ===== DARK MODE FORMS ===== */
html[data-theme="dark"] .form-control-custom,
html[data-theme="dark"] .form-select-custom,
html[data-theme="dark"] select,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html.theme-dark .form-control-custom,
html.theme-dark .form-select-custom,
html.theme-dark select,
html.theme-dark input[type="text"],
html.theme-dark input[type="number"],
body.theme-dark .form-control-custom,
body.theme-dark .form-select-custom,
body.theme-dark select,
body.theme-dark input[type="text"],
body.theme-dark input[type="number"],
[data-theme="dark"] .form-control-custom,
[data-theme="dark"] .form-select-custom,
[data-theme="dark"] select,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"] {
    background: rgba(0, 0, 0, 0.7) !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    border: 2px solid rgba(0, 255, 135, 0.4) !important;
    border-color: rgba(0, 255, 135, 0.4) !important;
    color: #00ff87 !important;
}

html[data-theme="dark"] .form-control-custom:focus,
html[data-theme="dark"] .form-select-custom:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] input:focus,
html.theme-dark .form-control-custom:focus,
html.theme-dark .form-select-custom:focus,
html.theme-dark select:focus,
html.theme-dark input:focus,
body.theme-dark .form-control-custom:focus,
body.theme-dark .form-select-custom:focus,
body.theme-dark select:focus,
body.theme-dark input:focus,
[data-theme="dark"] .form-control-custom:focus,
[data-theme="dark"] .form-select-custom:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] input:focus {
    border-color: #00ff87 !important;
    box-shadow: 0 0 10px rgba(0,255,135,0.5) !important;
    background: rgba(0, 0, 0, 0.8) !important;
}

/* ===== LIGHT MODE FORMS ===== */
html[data-theme="light"] .form-control-custom,
html[data-theme="light"] .form-select-custom,
html[data-theme="light"] select,
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="number"],
html.theme-light .form-control-custom,
html.theme-light .form-select-custom,
html.theme-light select,
html.theme-light input[type="text"],
html.theme-light input[type="number"],
body.theme-light .form-control-custom,
body.theme-light .form-select-custom,
body.theme-light select,
body.theme-light input[type="text"],
body.theme-light input[type="number"],
[data-theme="light"] .form-control-custom,
[data-theme="light"] .form-select-custom,
[data-theme="light"] select,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"] {
    background: rgba(255, 255, 255, 0.95) !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid rgba(102, 102, 241, 0.4) !important;
    border-color: rgba(102, 102, 241, 0.4) !important;
    color: #1a1a2e !important;
}

/* ===== DARK MODE BUTTONS ===== */
html[data-theme="dark"] .btn-calculate,
html.theme-dark .btn-calculate,
body.theme-dark .btn-calculate,
[data-theme="dark"] .btn-calculate {
    background: #000000 !important;
    background-color: #000000 !important;
    border: 3px solid #00ff87 !important;
    border-color: #00ff87 !important;
    color: #00ff87 !important;
}

html[data-theme="dark"] .btn-calculate:hover,
html.theme-dark .btn-calculate:hover,
body.theme-dark .btn-calculate:hover,
[data-theme="dark"] .btn-calculate:hover {
    background: #00ff87 !important;
    background-color: #00ff87 !important;
    color: #000000 !important;
}

html[data-theme="dark"] .op-btn,
html.theme-dark .op-btn,
body.theme-dark .op-btn,
[data-theme="dark"] .op-btn {
    background: #000000 !important;
    background-color: #000000 !important;
    border: 2px solid rgba(0,255,135,0.4) !important;
    border-color: rgba(0,255,135,0.4) !important;
    color: #00ff87 !important;
}

html[data-theme="dark"] .op-btn:hover,
html.theme-dark .op-btn:hover,
body.theme-dark .op-btn:hover,
[data-theme="dark"] .op-btn:hover {
    border-color: #00ff87 !important;
    box-shadow: 0 0 10px rgba(0,255,135,0.5) !important;
}

html[data-theme="dark"] .op-btn.active,
html.theme-dark .op-btn.active,
body.theme-dark .op-btn.active,
[data-theme="dark"] .op-btn.active {
    background: #00ff87 !important;
    background-color: #00ff87 !important;
    color: #000000 !important;
}

/* ===== LIGHT MODE BUTTONS ===== */
html[data-theme="light"] .btn-calculate,
html.theme-light .btn-calculate,
body.theme-light .btn-calculate,
[data-theme="light"] .btn-calculate {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%) !important;
    color: #ffffff !important;
}

/* ===== DARK MODE RESULTS ===== */
html[data-theme="dark"] .result-section,
html.theme-dark .result-section,
body.theme-dark .result-section,
[data-theme="dark"] .result-section {
    background: rgba(0, 0, 0, 0.8) !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid #00ff87 !important;
    border-color: #00ff87 !important;
}

html[data-theme="dark"] .result-value,
html.theme-dark .result-value,
body.theme-dark .result-value,
[data-theme="dark"] .result-value {
    color: #00ff87 !important;
    background: none !important;
    -webkit-text-fill-color: #00ff87 !important;
}

/* ===== LIGHT MODE RESULTS ===== */
html[data-theme="light"] .result-section,
html.theme-light .result-section,
body.theme-light .result-section,
[data-theme="light"] .result-section {
    background: rgba(255, 255, 255, 0.98) !important;
    background-color: rgba(255, 255, 255, 0.98) !important;
    border: 3px solid rgba(102, 102, 241, 0.5) !important;
    border-color: rgba(102, 102, 241, 0.5) !important;
}

html[data-theme="light"] .result-value,
html.theme-light .result-value,
body.theme-light .result-value,
[data-theme="light"] .result-value {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* ===== DARK MODE FEATURE ICONS ===== */
html[data-theme="dark"] .feature-icon,
html.theme-dark .feature-icon,
body.theme-dark .feature-icon,
[data-theme="dark"] .feature-icon {
    background: #000000 !important;
    border: 2px solid #00ff87 !important;
    box-shadow: 0 0 10px rgba(0,255,135,0.5) !important;
}

/* ===== DARK MODE STAT BADGES ===== */
html[data-theme="dark"] .stat-badge,
html.theme-dark .stat-badge,
body.theme-dark .stat-badge,
[data-theme="dark"] .stat-badge {
    background: rgba(0,255,135,0.1) !important;
    border: 1px solid rgba(0,255,135,0.3) !important;
    color: #00ff87 !important;
}

/* ===== BACK BUTTON ===== */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    margin-bottom: 0.5rem;
}

.btn-back:hover {
    background: rgba(102,126,234,0.08);
    color: var(--primary);
}

/* Swap button */
.btn-swap {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.2rem;
    margin: 0 auto;
}

.btn-swap:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(180deg);
}

/* Quick stats */
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}
