:root {
    --primary-color: #0f4c81; 
    --primary-hover: #0a365c;
    --text-main: #1e293b;
    --sidebar-bg: #16803d; 
    --sidebar-width: 175px;
    --bg-dark: #020617; 
    --box-border: rgba(34, 197, 94, 0.4); 
    --transition-smooth: cubic-bezier(0.23, 1, 0.32, 1);
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-dark);
    overflow: hidden;
    perspective: 2000px;
}

/* --- 3D KEYFRAMES --- */
@keyframes foldInLeft {
    0% { transform: rotateY(-90deg); opacity: 0; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

@keyframes holographicRise {
    0% { transform: rotateX(30deg) translateY(150px) translateZ(-300px); opacity: 0; box-shadow: 0 0 0 transparent; }
    100% { transform: rotateX(0deg) translateY(0) translateZ(0); opacity: 1; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
}

@keyframes floatUp3D {
    0% { transform: rotateX(-45deg) translateY(100px); opacity: 0; }
    100% { transform: rotateX(0deg) translateY(0); opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(74, 222, 128, 0.2); transform: translateZ(10px); }
    50% { text-shadow: 0 0 35px rgba(74, 222, 128, 0.8); transform: translateZ(20px); }
}

/* --- ERROR STATE KEYFRAMES --- */
@keyframes warningPulse {
    0% { opacity: 1; text-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }
    100% { opacity: 0.5; text-shadow: 0 0 2px rgba(239, 68, 68, 0.1); }
}

/* --- BACKGROUND --- */
#particles-js {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -5; background-color: var(--bg-dark);
    background-image: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
}
.weather-layer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: -4; }
.rain-container { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; opacity: 0; transition: opacity 3s ease; overflow: hidden; }
.show-rain { opacity: 1; }
.raindrop { position: absolute; background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(150,200,255,0.6)); width: 2px; height: 80px; bottom: 100%; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(120vh); } }

/* --- 1. 3D GREEN SIDEBAR --- */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background-color: var(--sidebar-bg);
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    padding: 2.5rem 0 3.5rem 0; 
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6); 
    box-sizing: border-box; z-index: 20;
    transform-origin: left center;
    animation: foldInLeft 1s var(--transition-bounce) forwards;
    transform-style: preserve-3d;
}
.sidebar-text {
    font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 70px; color: white; 
    line-height: 1; writing-mode: vertical-rl; text-orientation: upright; 
    letter-spacing: -15px; margin: auto 0; text-shadow: 4px 4px 10px rgba(0,0,0,0.4);
    transform: translateZ(30px);
}
.sidebar-logo { width: 120px; max-height: 130px; object-fit: contain; filter: drop-shadow(0px 8px 12px rgba(0, 0, 0, 0.4)); transform: translateZ(20px); transition: transform 0.4s var(--transition-bounce); }
.sidebar-logo:hover { transform: translateZ(40px) scale(1.1); } 

/* --- 2. 3D DASHBOARD BOXES --- */
.dashboard-grid {
    position: fixed;
    top: 40px; left: calc(var(--sidebar-width) + 40px); right: 40px; bottom: 140px; 
    display: flex; gap: 40px; z-index: 2; 
    perspective: 1500px;
}

.dash-box {
    flex: 1;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--box-border); 
    border-radius: 20px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0; 
    transform-style: preserve-3d; 
    animation: holographicRise 1s var(--transition-bounce) forwards;
    transition: transform 0.6s var(--transition-bounce), box-shadow 0.4s ease, border-color 0.4s ease;
}
.dash-box:nth-child(1) { animation-delay: 0.1s; }
.dash-box:nth-child(2) { animation-delay: 0.3s; }

.dash-content-wrapper {
    width: 100%; height: 100%; transform: translateZ(30px);
    display: flex; flex-direction: column; pointer-events: none;
}
.dash-content-wrapper > * { pointer-events: auto; }

.dash-box iframe { width: 100%; height: 100%; border: none; border-radius: 20px;}

.weather-details { 
    padding: 40px; color: white; display: flex; flex-direction: column; 
    height: 100%; box-sizing: border-box;
    transition: all 0.4s var(--transition-smooth);
}

.wd-header { font-size: 1.2rem; font-weight: 700; color: #4ade80; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 30px; transform: translateZ(10px);}

.wd-main { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.wd-temp-block { display: flex; flex-direction: column; transform: translateZ(40px); }
.wd-temp { font-size: 5rem; font-weight: 800; line-height: 1; margin-bottom: 5px; animation: pulseGlow 4s infinite; display: inline-block; transition: color 0.3s ease;}
.wd-condition { font-size: 1.5rem; color: #94a3b8; font-weight: 500; transition: color 0.3s ease;}
.wd-time-block { text-align: right; transform: translateZ(20px);}
.wd-time { font-size: 2.5rem; font-weight: 700; }
.wd-date { font-size: 1rem; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;}

.wd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: auto; transform-style: preserve-3d; }

.wd-item { 
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); 
    padding: 20px; border-radius: 16px; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; gap: 10px; text-align: center;
    transition: all 0.4s var(--transition-bounce); 
    transform: translateZ(0); 
}
.wd-item:hover {
    transform: translateZ(40px) scale(1.05); 
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.wd-item-label { font-size: 0.85rem; color: #64748b; text-transform: uppercase; font-weight: 700; letter-spacing: 1px;}
.wd-item-value { font-size: 1.5rem; font-weight: 700; color: #f8fafc;}

/* --- ERROR STATE ACTIVE CLASSES --- */
#weather-widget.error-state .wd-temp {
    color: #475569; 
    animation: none; 
    text-shadow: none;
}
#weather-widget.error-state .wd-condition {
    color: #ef4444; 
    font-weight: 700;
    animation: warningPulse 1.5s infinite alternate ease-in-out;
}

/* --- 3. 3D APP IFRAME CONTAINER --- */
.app-container {
    position: fixed; top: 0; left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width)); height: 100vh;
    z-index: 10; background: var(--bg-dark);
    visibility: hidden; opacity: 0;
    transform-origin: bottom center;
    transform: rotateX(25deg) scale(0.9) translateZ(-200px); 
    transition: all 0.7s var(--transition-bounce);
}
.app-container.active { 
    visibility: visible; opacity: 1;
    transform: rotateX(0deg) scale(1) translateZ(0); 
}
.app-frame { width: 100%; height: 100%; border: none; }

/* --- 4. FLOATING BOTTOM MENU --- */
.bottom-menu-container {
    position: fixed; bottom: -100px; 
    left: calc(var(--sidebar-width) + 25px); right: 25px; 
    height: 75px; border-radius: 20px;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    display: flex; justify-content: center; align-items: center; gap: 15px;
    transition: bottom 0.6s var(--transition-smooth); z-index: 15;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.8);
    opacity: 0;
    animation: floatUp3D 1s var(--transition-bounce) forwards;
    animation-delay: 0.6s;
    transform-style: preserve-3d;
}
.bottom-menu-container.active { bottom: 25px; } 

.bottom-tab {
    display: flex; align-items: center; gap: 8px; padding: 10px 18px;
    text-decoration: none; color: var(--primary-color);
    font-weight: 700; font-size: 0.85rem; border-radius: 12px;
    transition: all 0.4s var(--transition-bounce); background: transparent; text-transform: uppercase; cursor: pointer;
    transform: translateZ(0);
}
.bottom-tab img { width: 28px; height: 28px; object-fit: contain; transition: transform 0.4s var(--transition-bounce); }
.bottom-tab:hover, .bottom-tab.active-tab { 
    background: var(--primary-color); color: white; 
    transform: translateZ(30px) translateY(-5px);
    box-shadow: 0 15px 25px rgba(15, 76, 129, 0.4); 
}
.bottom-tab:hover img, .bottom-tab.active-tab img { filter: brightness(0) invert(1); transform: scale(1.2) rotate(-10deg); }

#closeAppBtn { display: none; background: #ef4444; color: white; }
#closeAppBtn:hover { background: #b91c1c; box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4); }

/* --- 5. TOGGLE BUTTON --- */
.toggle-menu-btn {
    position: fixed; bottom: 35px; left: calc(var(--sidebar-width) + 25px);
    z-index: 20; background: var(--primary-color); color: white;
    border: none; width: 55px; height: 55px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: all 0.5s var(--transition-bounce);
    opacity: 0;
    animation: floatUp3D 1s var(--transition-bounce) forwards;
    animation-delay: 0.8s;
}
.toggle-menu-btn svg { width: 26px; height: 26px; transition: transform 0.5s var(--transition-bounce); }
.toggle-menu-btn:hover { background: var(--primary-hover); transform: scale(1.15) translateZ(20px); box-shadow: 0 15px 35px rgba(0,0,0,0.5);}
.toggle-menu-btn.active { bottom: 125px; background: var(--primary-hover); }
.toggle-menu-btn.active svg { transform: rotate(180deg); }

.bottom-tab.disabled-link { pointer-events: none; }
.bottom-tab.disabled-link:not(.active-tab) { opacity: 0.4; filter: grayscale(100%); transition: opacity 0.3s ease; }