:root {
    /* Color Palette */
    --bg-dark: #0a0a0c;
    --bg-surface: rgba(255, 255, 255, 0.03);
    --bg-surface-hover: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(249, 115, 22, 0.3);
    
    --accent-primary: #f97316; /* Vibrant Orange */
    --accent-hover: #ea580c;
    --accent-glow: rgba(249, 115, 22, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    /* Typography */
    --font-main: 'Outfit', sans-serif;
    
    /* Spacing & Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

/* Top Bar */
.top-bar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 10;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: var(--font-main);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-highlight);
}

.lang-toggle {
    padding: 0.25rem;
    display: flex;
    gap: 0.25rem;
    border-radius: var(--radius-full);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: var(--font-main);
    font-weight: 500;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    color: var(--text-primary);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Background Effects */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: var(--accent-primary);
}

.orb-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #4338ca;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* Glassmorphism Utilities */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4), 0 0 20px rgba(249, 115, 22, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Hero Section */
.hero {
    text-align: center;
    padding-top: 2rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.icon-container {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.05));
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-glow);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero .subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 500px;
}

/* Did You Know Banner */
.did-you-know-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    margin: 2rem auto 0 auto;
    max-width: 650px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-left: 3px solid var(--accent-primary);
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.08) 0%, rgba(255,255,255,0.03) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.15);
    text-align: left;
    transition: all 0.4s ease;
}

.did-you-know-banner:hover {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.12) 0%, rgba(255,255,255,0.05) 100%);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.25);
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, 0.4);
    border-left-color: var(--accent-primary);
}

.dyk-icon-container {
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulseBulb 3s infinite ease-in-out;
}

.bulb-icon {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.8));
}

@keyframes pulseBulb {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(249, 115, 22, 0.6)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 12px rgba(249, 115, 22, 1)); }
}

.dyk-badge {
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, #f97316, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}

.dyk-divider {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.dyk-content {
    flex-grow: 1;
    overflow: hidden;
}

#fact-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    transition: opacity 0.5s ease;
}

/* Converter Section */
.converter-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.converter-left, .converter-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.converter-card {
    padding: 2.5rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    position: relative;
}

.half-width {
    flex: 1;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

input:hover, select:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
    background: rgba(0, 0, 0, 0.4);
}

input::placeholder {
    color: var(--text-tertiary);
}

.select-wrapper {
    position: relative;
}

.select-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Select dropdown specific styling for dark theme */
select option {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

.swap-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.swap-btn {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.swap-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 1.125rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Result Card */
.result-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    border-top: 2px solid var(--accent-primary);
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.05) 0%, rgba(255,255,255,0.02) 100%);
    position: relative;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    align-self: flex-end;
    margin-bottom: 0.5rem;
    z-index: 5;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.result-value {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.result-value .value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}

.result-value .unit {
    font-size: 1.75rem;
    color: var(--text-primary);
    font-weight: 500;
}

.result-equation {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

/* Reference Section */
.reference-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.reference-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.reference-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
}

.reference-card:hover {
    transform: translateY(-5px);
    background: var(--bg-surface-hover);
    border-color: var(--border-highlight);
    box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.3), 0 0 15px rgba(249, 115, 22, 0.1);
}

.ref-icon {
    font-size: 1.5rem;
    width: 52px;
    height: 52px;
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-content h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.ref-content p {
    font-size: 1rem;
    font-weight: 600;
}

/* Action Buttons (Copy, Share, Download, Fav) */
.icon-btn {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover, .icon-btn:focus-visible {
    background: var(--border-color);
    color: var(--accent-primary);
    transform: scale(1.05);
    outline: none;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* History and Favorites Tabs/Lists */
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-family: var(--font-main);
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    position: relative;
    transition: color 0.3s ease;
}

.tab-btn:hover, .tab-btn:focus-visible {
    color: var(--text-primary);
    outline: none;
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 4px;
}

.list-card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
}

/* Custom Scrollbar for lists */
.list-card::-webkit-scrollbar { width: 6px; }
.list-card::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 10px; }
.list-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-item:hover, .list-item:focus-visible {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.2);
    outline: none;
}

.list-val {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem 0;
    font-size: 0.9rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-glass);
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideUp {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Flash Animation for Result Card */
@keyframes flashUpdate {
    0% { background: linear-gradient(180deg, rgba(249, 115, 22, 0.05) 0%, rgba(255,255,255,0.02) 100%); }
    50% { background: linear-gradient(180deg, rgba(249, 115, 22, 0.2) 0%, rgba(255,255,255,0.02) 100%); transform: scale(1.02); }
    100% { background: linear-gradient(180deg, rgba(249, 115, 22, 0.05) 0%, rgba(255,255,255,0.02) 100%); }
}

.result-card.flash {
    animation: flashUpdate 0.3s ease;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem 1rem 2rem 1rem;
        gap: 2.5rem;
    }
    
    .hero h1 {
        font-size: 2.25rem;
        line-height: 1.2;
    }

    .converter-card {
        padding: 1.5rem;
    }
    
    .result-value .value {
        font-size: 2.5rem;
    }

    .result-value .unit {
        font-size: 1.25rem;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
    
    .result-actions {
        align-self: center;
        margin-bottom: 1.5rem;
    }
    
    .swap-container {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        z-index: 2;
    }
    
    .swap-btn {
        background: var(--bg-dark);
        border-color: var(--accent-primary);
    }
}

@media (min-width: 1025px) {
    .container {
        max-width: 1000px;
        gap: 2.5rem;
        padding-top: 1.5rem;
    }
    
    .hero {
        padding-top: 0.5rem;
    }
    
    .hero-header-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
    }
    
    .icon-container {
        margin-bottom: 0;
    }
    
    .did-you-know-banner {
        margin-top: 1rem !important;
    }
    
    .converter-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        max-width: 1000px;
        gap: 2rem;
        align-items: start;
    }
}
