:root {
    --bg-color: #e8f5e9;
    --panel-bg: rgba(255, 255, 255, 0.75);
    --panel-border: rgba(255, 255, 255, 0.5);
    --primary-color: #2E7D32;
    --primary-hover: #1B5E20;
    --secondary-color: #1565C0;
    --text-color: #2c3e50;
    --danger-color: #c0392b;
    --warning-color: #f39c12;
    --success-color: #27ae60;
    --font-family: 'Poppins', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.glass-panel-inner {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 10px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.logo p {
    font-size: 14px;
    color: #555;
}

.header-controls {
    display: flex;
    gap: 10px;
}

/* Buttons */
button {
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn-icon {
    padding: 10px 15px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.btn-icon:hover { background: var(--bg-color); }

.btn-primary {
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(46, 125, 50, 0.3);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-secondary {
    padding: 15px 25px;
    background: var(--secondary-color);
    color: white;
    font-size: 16px;
}

.btn-outline {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-small {
    padding: 5px 10px;
    background: #e0e0e0;
    color: #333;
    font-size: 14px;
}
.btn-small:hover { background: #bdbdbd; }

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    gap: 10px;
    overflow: hidden;
}

.left-panel, .right-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    flex-shrink: 0;
}
.scrollable {
    overflow-y: auto;
}

.scrollable::-webkit-scrollbar { width: 8px; }
.scrollable::-webkit-scrollbar-track { background: transparent; }
.scrollable::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }

h2 { font-size: 18px; color: var(--primary-color); border-bottom: 2px solid rgba(46,125,50,0.2); padding-bottom: 5px; margin-bottom: 10px;}

/* Controls */
.control-item {
    margin-bottom: 15px;
}
.control-item label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px;}
.control-item select, .control-item input[type="range"] {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-family: var(--font-family);
}
.pop-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.6);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.pop-info { flex: 1; font-weight: 600;}
.pop-btns { display: flex; gap: 5px; align-items: center;}
.pop-val { min-width: 40px; text-align: center; font-weight: bold;}

/* Simulation View */
.sim-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    position: relative;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background-image: url('images/grassland_background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#weather-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    transition: background 1s;
}

.sim-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.5);
    padding: 15px;
    border-radius: 10px;
}

.duration-select label { font-weight: bold; margin-right: 10px;}
.duration-select select { padding: 10px; font-size: 16px; border-radius: 6px;}

#sim-progress {
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    margin-top: 10px;
    color: var(--primary-color);
}

/* Alert Box */
.alert-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    text-align: center;
    background: rgba(255,255,255,0.95);
    border: 4px solid var(--warning-color);
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    min-width: 300px;
}
.alert-box h2 { color: var(--warning-color); font-size: 24px; border: none;}

/* Right Panel Stats */
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 15px;
}
.stat-name { display: flex; align-items: center; gap: 10px; font-weight: 600;}
.stat-val { font-weight: bold; font-family: monospace; font-size: 16px;}

.balance-indicator {
    text-align: center;
    padding: 15px;
    background: rgba(255,255,255,0.6);
    border-radius: 10px;
}
.gauge-container {
    width: 100%;
    height: 20px;
    background: #ddd;
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
    position: relative;
}
.gauge-fill {
    height: 100%;
    width: 100%;
    background: var(--success-color);
    transition: width 0.5s, background 0.5s;
}
#balance-text { font-weight: bold; }
.warning-text { color: var(--danger-color); font-weight: bold; margin-top: 10px;}

.mission-box {
    text-align: center;
}
.mission-box h3 { color: var(--secondary-color); margin-bottom: 5px;}
.mission-box p { font-size: 13px; margin-bottom: 10px;}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 15px;
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
.large-modal { max-width: 900px; }
.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}
.chart-container {
    width: 100%;
    height: 400px;
    background: white;
    padding: 10px;
    border-radius: 8px;
}

.prediction-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}
.prediction-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    border: 1px solid #ddd;
}
.prediction-options label:hover { background: #f0f0f0; }

.mission-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px;}
.btn-mission {
    padding: 15px;
    text-align: left;
    background: white;
    border: 1px solid #ccc;
    font-size: 16px;
    border-radius: 8px;
}
.btn-mission:hover { background: var(--bg-color); border-color: var(--primary-color);}

#report-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.6;
}

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; }
    .no-print { display: none !important; }
}

/* Responsive Smartboard / Tablets */
@media (max-width: 1024px) {
    .main-content { flex-direction: column; overflow-y: auto;}
    .left-panel, .right-panel { width: 100%; }
    .sim-view { min-height: 50vh; }
}
