/* =============================================
   Burn Lab - Virtual Laboratoriya
   ============================================= */

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

:root {
    --bg-dark: #0d1117;
    --panel-bg: rgba(15, 20, 32, 0.92);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text: #f0f4ff;
    --text-dim: #8892a8;
    --orange: #f97316;
    --red: #ef4444;
    --yellow: #fbbf24;
    --cyan: #00bcd4;
    --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: "JetBrains Mono", monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 50px;
    --transition: 0.25s ease;
}

html, body {
    width: 100%; min-height: 100%;
    font-family: var(--font);
    background: var(--bg-dark);
    user-select: none;
}

/* Canvas */
#burnCanvas {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

/* Back button */
.back-btn {
    position: absolute;
    top: 16px; right: 16px;
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
    border: none; border-radius: 50%;
    color: #f0f4ff; font-size: 22px;
    cursor: pointer; text-decoration: none;
    transition: var(--transition);
}
.back-btn:hover { background: rgba(0,0,0,0.45); }

/* Info panel */
.info-panel {
    position: absolute;
    top: 16px; left: 16px;
    z-index: 100;
    width: 300px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 1px solid var(--panel-border);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.info-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
}

.flame-indicator {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #555;
    transition: background 0.5s ease, box-shadow 0.5s ease;
    flex-shrink: 0;
}

.flame-indicator.active {
    background: var(--orange);
    box-shadow: 0 0 12px rgba(249,115,22,0.7);
    animation: flame-pulse 1s ease-in-out infinite;
}

@keyframes flame-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(249,115,22,0.5); }
    50% { box-shadow: 0 0 18px rgba(249,115,22,0.9); }
}

.info-title {
    font-size: 13px; font-weight: 700;
    color: var(--text);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.info-body { padding: 14px 16px; }

.obs-row {
    display: flex; justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
}
.obs-row:last-child { border-bottom: none; }
.obs-label { color: var(--text-dim); }
.obs-value {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--text);
}
.obs-value.highlight { color: var(--yellow); }

.reaction-log {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--panel-border);
    min-height: 50px;
    max-height: 100px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--mono);
    line-height: 1.6;
}
.reaction-log::-webkit-scrollbar { width: 3px; }
.reaction-log::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

/* Left controls - heat dial */
.left-controls {
    position: absolute;
    left: 16px; bottom: 160px;
    z-index: 100;
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
}

.heat-panel {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-pill);
    padding: 10px 8px;
    border: 1px solid var(--panel-border);
}

.heat-label {
    font-size: 9px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--orange);
}

.ctrl-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 50%;
    color: var(--orange);
    font-size: 18px; font-weight: 700;
    cursor: pointer; transition: var(--transition);
}
.ctrl-btn:hover { background: rgba(249,115,22,0.15); }
.ctrl-btn:active { transform: scale(0.9); }

.heat-bar {
    width: 14px; height: 80px;
    background: rgba(255,255,255,0.06);
    border-radius: 7px;
    position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.heat-fill {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 30%;
    background: linear-gradient(to top, #ef4444, #f97316, #fbbf24);
    border-radius: 0 0 6px 6px;
    transition: height 0.4s ease;
}

.heat-value {
    font-family: var(--mono);
    font-size: 11px; font-weight: 600;
    color: var(--text);
    text-align: center;
}

/* Flame on/off toggle */
.flame-toggle {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 8px;
    border: 1px solid var(--panel-border);
    cursor: pointer;
    transition: var(--transition);
}
.flame-toggle:hover { border-color: var(--orange); }
.flame-toggle.on { border-color: var(--orange); background: rgba(249,115,22,0.1); }

.flame-toggle svg { transition: color 0.3s; }
.flame-toggle.on svg { color: var(--orange); }

.toggle-label {
    font-size: 9px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-dim);
}
.flame-toggle.on .toggle-label { color: var(--orange); }

/* Right panel - thermometer */
.right-controls {
    position: absolute;
    right: 16px; bottom: 160px;
    z-index: 100;
    display: flex; flex-direction: column;
    align-items: center; gap: 10px;
}

.thermo-panel {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-pill);
    padding: 10px 8px;
    border: 1px solid var(--panel-border);
}

.thermo-label {
    font-size: 9px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--red);
}

.thermometer {
    width: 14px; height: 100px;
    background: rgba(255,255,255,0.06);
    border-radius: 7px;
    position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.thermo-fill {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 5%;
    background: linear-gradient(to top, var(--red), var(--orange), var(--yellow));
    border-radius: 0 0 6px 6px;
    transition: height 0.6s ease;
}

.thermo-value {
    font-family: var(--mono);
    font-size: 11px; font-weight: 600;
    color: var(--text); text-align: center;
}

/* Chemical Bar */
.chemical-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(10, 14, 22, 0.96);
    border-top: 1px solid var(--panel-border);
}

.category-tabs {
    display: flex;
    padding: 10px 12px 8px;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--panel-border);
}
.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
    flex-shrink: 0;
    padding: 6px 18px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    background: rgba(255,255,255,0.05);
    color: var(--text-dim);
}
.cat-tab:hover { color: var(--text); background: rgba(255,255,255,0.09); }
.cat-tab.active {
    background: rgba(249,115,22,0.15);
    color: var(--orange);
    border: 1px solid rgba(249,115,22,0.3);
}

.chemical-list {
    display: flex; gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.chemical-list::-webkit-scrollbar { height: 4px; }
.chemical-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.chem-item {
    flex-shrink: 0;
    display: flex; flex-direction: column;
    align-items: center; gap: 5px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    cursor: pointer; transition: var(--transition);
    min-width: 72px;
}
.chem-item:hover {
    background: rgba(255,255,255,0.09);
    transform: translateY(-2px);
}
.chem-item.selected {
    border-color: var(--orange);
    background: rgba(249,115,22,0.1);
}

.chem-formula {
    font-family: var(--mono); font-size: 12px; font-weight: 700;
    color: var(--text); white-space: nowrap;
}
.chem-name {
    font-size: 9px; color: var(--text-dim);
    white-space: nowrap; text-align: center;
}
.chem-flame {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* Clear button */
.clear-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 7px 14px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius);
    color: var(--red); font-size: 11px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.clear-btn:hover { background: rgba(239,68,68,0.2); }

/* Notification */
.notification {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 200;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 14px 22px;
    color: var(--text); font-size: 13px; font-weight: 500;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: center; max-width: 360px;
}
.notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 768px) {
    .info-panel { width: 260px; }
    .left-controls { left: 8px; bottom: 148px; }
    .right-controls { right: 8px; bottom: 148px; }
}
