/* Professional Stylesheet for Climate Advisory Web Application */

:root {
    /* Color System */
    --primary-color: #2c5f2d;
    --primary-dark: #1e4220;
    --primary-light: #3d7c3f;
    --secondary-color: #97bc62;
    --accent-color: #f4a261;

    /* Semantic Colors */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;

    /* Neutral Colors */
    --bg-body: #f8fafc;
    --bg-white: #ffffff;
    --bg-sidebar: #0f172a;
    /* Slate 900 - More modern than gray */

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-dark: #f8fafc;

    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Dimensions */
    --sidebar-width: 280px;
    --header-height: 72px;
    --border-radius: 16px;
    /* Larger radius for modern feel */
}

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

body {
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

ul {
    list-style: none;
}

/* Layout Architecture */
.app-body {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-sidebar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon-wrapper {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(44, 95, 45, 0.3);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: white;
    line-height: 1;
}

.logo-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.close-sidebar-btn {
    display: none;
    /* Only visible on mobile */
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.938rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(44, 95, 45, 0.1) 0%, rgba(44, 95, 45, 0) 100%);
    color: #4ade80;
    border-left: 3px solid #4ade80;
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: #4ade80;
    opacity: 1;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-toggle-sidebar {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.25rem;
    display: flex;
}

.lang-btn {
    flex: 1;
    background: none;
    border: none;
    color: #9CA3AF;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Premium Card Utilities */
.premium-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.premium-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.premium-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(44, 95, 45, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.premium-card:hover::after {
    opacity: 1;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent overflow issues */
    transition: margin-left 0.3s ease;
}

/* Header Styling */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0 2rem;
    display: flex;
    align-items: center;
}

.header-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle-btn {
    display: none;
    /* Only mobile */
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
}

.sidebar-toggle-btn:hover {
    background-color: var(--bg-body);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

/* Page Content Container */
.content-container {
    padding: 2rem;
    flex: 1;
    max-width: 1600px;
    /* Limit width on giant screens */
    width: 100%;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Mobile Responsiveness */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    backdrop-filter: blur(2px);
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        display: block;
    }

    .close-sidebar-btn {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .content-container {
        padding: 1.5rem;
    }
}

/* Landing Page Specific Helper */
/* Since landing page might use this CSS, ensure it looks okay even if structure differs slightly,
   but preferably landing page should just use main-wrapper with no sidebar if desired.
   However, for uniformity, we keep the sidebar everywhere as requested.
*/

/* Weather/Advisory Cards */
.advisory-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid;
}

.risk-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.risk-low {
    background-color: #D1FAE5;
    color: #065F46;
    border-color: #10B981;
}

.risk-moderate {
    background-color: #FEF3C7;
    color: #92400E;
    border-color: #F59E0B;
}

.risk-high {
    background-color: #FEE2E2;
    color: #991B1B;
    border-color: #EF4444;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Small spinner used on home/advisory loading */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background-color: #F9FAFB;
    text-align: left;
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tr:last-child td {
    border-bottom: none;
}