:root {
    --bg-winter: linear-gradient(135deg, #1e3c72, #2a5298);
    --bg-winter-dark: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --bg-summer: linear-gradient(135deg, #f12711, #f5af19);
    --bg-desert: linear-gradient(135deg, #ff9966, #ff5e62);
    
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-color: #ffffff;
    --brand-color: #4facfe;
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    background: var(--bg-winter);
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    transition: background 0.8s ease;
    overflow-x: hidden;
}

body.theme-winter { background: var(--bg-winter); }
body.theme-winter-dark { background: var(--bg-winter-dark); }
body.theme-summer { background: var(--bg-summer); }
body.theme-desert { background: var(--bg-desert); }

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

/* Sidebar */
.sidebar {
    width: 280px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.brand {
    text-align: center;
}

.logo {
    font-size: 3rem;
    margin-bottom: 10px;
}

.brand h1 {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nav-btn {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: 1px solid transparent;
    color: white;
    font-size: 1.1rem;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
}

.module {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 40px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.5s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.module.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

header {
    margin-bottom: 30px;
}

header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.8;
}

.module-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 1. Insulation Calc */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.material-card {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.material-card:hover {
    transform: translateY(-5px);
    background: rgba(0, 0, 0, 0.3);
}

.material-card.selected {
    border-color: #4facfe;
    background: rgba(79, 172, 254, 0.2);
}

.results-panel {
    display: flex;
    gap: 20px;
    margin-top: auto;
}

.stat-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f5576c, #f093fb);
    width: 0%;
    transition: width 0.5s ease, background 0.5s ease;
}

/* 2. AI Coach */
.ai-layout {
    flex-direction: row;
    gap: 40px;
}

.chat-interface {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 15px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 15px 20px;
    border-radius: 15px;
    max-width: 80%;
}

.ai-message {
    background: rgba(79, 172, 254, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.user-message {
    background: rgba(255, 255, 255, 0.2);
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 15px;
    border-radius: 10px;
    border: none;
    outline: none;
    background: rgba(255,255,255,0.9);
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    padding: 0 25px;
    border: none;
    border-radius: 10px;
    background: #4facfe;
    color: white;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: #00f2fe; }

.thermometer-panel {
    flex: 1;
    display: flex;
    gap: 20px;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 15px;
}

.thermo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.thermo-bar {
    width: 30px;
    height: 200px;
    background: rgba(0,0,0,0.5);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.thermo-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(0deg, #ff0844, #ffb199);
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.thermo-fill.cold {
    background: linear-gradient(0deg, #00c6ff, #0072ff);
}

/* 3. Evaporation Sim */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.2);
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
}

.sim-toggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.icecube-arena {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.sun {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    animation: pulse 2s infinite alternate;
}

.ice-cube-container {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ice-cube {
    font-size: 6rem;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.survival-time {
    margin-top: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

/* 4. Desert Modder */
.modder-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

.garment-preview {
    font-size: 8rem;
    text-align: center;
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
    padding: 50px;
    transition: all 0.5s ease;
}

.mod-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-mod {
    padding: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: white;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    text-align: left;
}

.btn-mod:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    transform: translateX(10px);
}

.btn-mod:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-mod.completed {
    background: rgba(46, 204, 113, 0.3);
    border-color: #2ecc71;
}

.cooling-status {
    grid-column: 1 / -1;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.progress-fill.cool {
    background: linear-gradient(90deg, #ff5e62, #00c6ff);
}

/* Animations */
@keyframes pulse {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.1); opacity: 1; }
}
