:root {
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-heat: #f97316;
    --accent-warning: #fbbf24;
    --accent-danger: #ef4444;
    --accent-extreme: #b91c1c;
    --accent-safe: #10b981;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --card-bg: rgba(15, 23, 42, 0.6);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: #020617;
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Aurora */
.bg-aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 20%, rgba(249, 115, 22, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(239, 68, 68, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.03) 0%, transparent 60%);
}

#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.calc-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 20px;
    position: relative;
    z-index: 10;
}

/* Header */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    transform: translateX(-4px);
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Tabs */
.tabs-header {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.tabs-header::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 12px 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.tab-btn.active {
    background: var(--accent-heat);
    border-color: var(--accent-heat);
    color: #000;
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.3);
}

/* Global Unit Toggle */
.unit-toggle-container {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.unit-toggle-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.unit-toggle-btn.active {
    background: var(--accent-heat);
    color: #000;
}

/* Main Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
}

/* Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    height: 100%;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title svg {
    width: 24px;
    height: 24px;
    color: var(--accent-heat);
}

/* Forms */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-heat);
    background: rgba(0,0,0,0.3);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.param-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 6px 0 0;
    line-height: 1.4;
    font-style: italic;
    opacity: 0.8;
}

.select-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
}

.calc-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-heat) 0%, #ea580c 100%);
    border: none;
    border-radius: 14px;
    color: #000;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(234, 88, 12, 0.4);
}

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

/* Results */
.result-panel {
    margin-top: 30px;
    padding: 24px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    border-left: 4px solid var(--accent-heat);
    display: none;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.result-value-wrap {
    text-align: left;
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    margin: 4px 0;
}

.risk-badge {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.risk-safe { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.risk-caution { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.risk-high { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.risk-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.risk-extreme { background: rgba(185, 28, 28, 0.2); color: #fca5a5; }

.recommendation-box {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.rec-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--accent-heat);
}

.rec-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Info Sidebar */
.info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
}

.info-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.info-content {
    padding: 20px;
}

.info-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-heat);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.info-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.info-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Animations */
.fade-up {
    animation: fadeInUp 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 0;
}

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

/* Formula Display */
.formula-display {
    display: inline-block;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: rgba(0,0,0,0.3);
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--accent-warning);
    font-size: 0.85rem;
    margin: 4px 0;
    border: 1px solid rgba(251, 191, 36, 0.1);
}

.formula-scroll {
    overflow-x: auto;
    background: rgba(0,0,0,0.4);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    scrollbar-width: thin;
}

.formula-scroll::-webkit-scrollbar {
    height: 4px;
}

.formula-scroll::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* Bhashini Widget Overlay Fixes */
.bhashini-widget-wrapper {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}
