/* =====================================================
   FOTOSYNTEZA – SCHEMAT PROCESU
   ===================================================== */

:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8eef4;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #8b5cf6;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
    --canvas-bg: #0d1b2a;
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
    --canvas-bg: #060d14;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

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

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 100;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls { display: flex; gap: 0.5rem; }

.control-btn {
    width: 40px; height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.control-btn:hover { background: var(--accent-primary); color: white; }
.control-btn svg { width: 20px; height: 20px; }

.moon-icon, .compress-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }
.fullscreen-active .expand-icon { display: none; }
.fullscreen-active .compress-icon { display: block; }

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 270px 1fr 310px;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
    min-height: 0;
}

/* Panels */
.controls-panel, .info-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.controls-panel h2, .info-panel h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.control-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.control-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.control-section h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

/* Mode Buttons */
.mode-buttons { display: flex; flex-direction: column; gap: 0.4rem; }

.mode-btn {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: 'Inter', sans-serif;
}
.mode-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.mode-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

/* Value Display */
.value-display {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}
.value-display .value { font-size: 2rem; font-weight: 700; color: var(--accent-primary); }
.value-display .unit { font-size: 1rem; color: var(--text-muted); }

/* Range */
input[type="range"] {
    width: 100%; height: 6px;
    -webkit-appearance: none; appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px;
    background: var(--accent-gradient);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 6px rgba(139,92,246,0.4);
    transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px;
    background: var(--accent-gradient);
    border-radius: 50%; cursor: pointer; border: none;
}

/* Speed Buttons */
.speed-buttons { display: flex; gap: 0.25rem; }
.speed-btn {
    flex: 1; padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.78rem; font-weight: 500;
    cursor: pointer; transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.speed-btn:hover { border-color: var(--accent-primary); }
.speed-btn.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

/* Checkbox */
.checkbox-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: var(--text-secondary);
    cursor: pointer; margin-bottom: 0.5rem;
}
.checkbox-label input { display: none; }
.checkmark {
    width: 18px; height: 18px; flex-shrink: 0;
    border: 2px solid var(--border-color);
    border-radius: 4px; position: relative;
    transition: var(--transition);
}
.checkbox-label input:checked + .checkmark { background: var(--accent-primary); border-color: var(--accent-primary); }
.checkbox-label input:checked + .checkmark::after {
    content: '✓'; position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    color: white; font-size: 0.7rem; font-weight: 700;
}

/* Action Buttons */
.action-buttons { display: flex; gap: 0.4rem; }
.action-btn {
    flex: 1; padding: 0.6rem;
    border: none; border-radius: var(--radius-md);
    font-size: 0.78rem; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.3rem;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.action-btn.start { background: var(--accent-gradient); color: white; }
.action-btn.start:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(139,92,246,0.4); }
.action-btn.pause { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.action-btn.reset { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.action-btn.reset:hover { background: var(--accent-primary); color: white; }
.btn-icon { font-size: 0.85rem; }

/* Equation Box */
.equation-box {
    background: linear-gradient(135deg, rgba(34,197,94,0.1), rgba(139,92,246,0.1));
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.8;
    text-align: center;
    font-weight: 500;
}
.eq-arrow { color: var(--accent-primary); font-weight: 700; }

/* Simulation Container */
.simulation-container { display: flex; flex-direction: column; min-height: 0; }
.simulation-box {
    flex: 1;
    background: var(--canvas-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
    min-height: 0;
}
#photoCanvas { width: 100%; height: 100%; display: block; }

/* Info Cards */
.info-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.85rem;
}
.info-card:last-child { margin-bottom: 0; }
.info-card h3 { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.75rem; }

.stage-card {
    background: linear-gradient(135deg, rgba(34,197,94,0.1) 0%, rgba(139,92,246,0.1) 100%);
    border: 1px solid rgba(34,197,94,0.25);
}
.stage-card p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.6; }

/* Values grid */
.values-grid { display: flex; flex-direction: column; gap: 0.4rem; }
.value-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}
.value-item:last-child { border-bottom: none; }
.value-item .label { color: var(--text-secondary); }
.value-item .data { font-weight: 700; color: var(--accent-primary); font-family: 'Courier New', monospace; }

/* Balance grid */
.balance-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: start;
    font-size: 0.78rem;
}
.bal-title { font-weight: 600; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; margin-bottom: 0.35rem; }
.bal-item { color: var(--text-secondary); margin-bottom: 0.25rem; }
.bal-item b { color: var(--accent-primary); }
.balance-arrow { color: var(--accent-primary); font-size: 1.2rem; font-weight: 700; padding-top: 1.2rem; }
.in-col .bal-title { color: #0ea5e9; }
.out-col .bal-title { color: #22c55e; }

/* Formulas */
.formula-list { display: flex; flex-direction: column; gap: 0.4rem; }
.formula {
    padding: 0.5rem 0.65rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--text-primary);
    border-left: 3px solid var(--accent-primary);
    font-weight: 500;
}

.physics-info p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.6; }

/* Scrollbar */
.controls-panel::-webkit-scrollbar,
.info-panel::-webkit-scrollbar { width: 5px; }
.controls-panel::-webkit-scrollbar-track,
.info-panel::-webkit-scrollbar-track { background: transparent; }
.controls-panel::-webkit-scrollbar-thumb,
.info-panel::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* Responsive */
@media (max-width: 1200px) {
    .main-content { grid-template-columns: 240px 1fr 280px; }
}
@media (max-width: 992px) {
    .main-content { grid-template-columns: 1fr; overflow-y: auto; }
    .controls-panel, .info-panel { max-height: 220px; }
    .controls-panel { order: 1; }
    .simulation-container { order: 2; min-height: 400px; }
    .info-panel { order: 3; }
}
