:root {
    /* Color Palette - Energy Green Theme */
    --primary-color: #2e7d32;
    --primary-hover: #1b5e20;
    --secondary-color: #e8f5e9;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --info-color: #3b82f6;

    /* Backgrounds */
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --bg-sidebar: #111827;

    /* Text */
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-light: #f9fafb;

    /* Spacing & Borders */
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);

    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* --- Layout --- */

/* Sidebar */
.sidebar {
    width: 220px;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: width var(--transition-speed);
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    font-size: 20px;
    font-weight: 700;
    color: var(--success-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.menu-item {
    padding: 14px 24px;
    cursor: pointer;
    font-size: 15px;
    color: #9ca3af;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(46, 125, 50, 0.2) 0%, transparent 100%);
    color: var(--success-color);
    border-left-color: var(--success-color);
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    background-color: var(--bg-surface);
    height: 64px;
    min-height: 64px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

.btn-logout {
    padding: 6px 16px;
    background-color: #fee2e2;
    color: var(--danger-color);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background-color: #fecaca;
    border-color: #fca5a5;
}

/* Content Area */
.content {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

/* --- Components --- */

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-surface);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s;
    border: 1px solid #f0f0f0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-title {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Tables */
.card-table-container {
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 32px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background-color: #f9fafb;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f9fafb;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(46, 125, 50, 0.2);
}

.btn-danger {
    background-color: #fff1f2;
    color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #ffe4e6;
}

.btn-warning {
    background-color: #fffbeb;
    color: var(--accent-color);
}

.btn-warning:hover {
    background-color: #fef3c7;
}

.btn-info {
    background-color: #eff6ff;
    color: var(--info-color);
}

.btn-info:hover {
    background-color: #dbeafe;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.status-normal,
.status-operating,
.status-supplier,
.status-solar,
.status-solar_panel {
    background-color: #dcfce7;
    color: #166534;
}

.status-fault,
.status-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-maintenance,
.status-planning,
.status-partner,
.status-wind,
.status-wind_turbine {
    background-color: #fef3c7;
    color: #92400e;
}

.status-storage,
.status-battery {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-box {
    background: white;
    width: 500px;
    max-width: 90%;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s;
    overflow: hidden;
}

.modal-overlay.show .modal-box {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.modal-footer {
    padding: 16px 24px;
    background-color: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- Login Page Specifics --- */
.login-body {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    display: flex;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 900px;
    min-height: 500px;
}

.login-left {
    width: 400px;
    background: linear-gradient(135deg, #2e7d32 0%, #43a047 50%, #66bb6a 100%);
    padding: 50px 40px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.login-left::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.login-left h2 {
    font-size: 26px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.login-left p {
    font-size: 14px;
    line-height: 1.8;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.login-features {
    margin-top: 35px;
    position: relative;
    z-index: 1;
}

.login-feature {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 16px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.login-feature span {
    margin-right: 12px;
    font-size: 20px;
}

.login-right {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-title {
    font-size: 28px;
    color: #1b5e20;
    margin-bottom: 8px;
    font-weight: 600;
}

.login-subtitle {
    color: #81c784;
    font-size: 14px;
    margin-bottom: 35px;
}

.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(67, 160, 71, 0.35);
}

.login-msg {
    text-align: center;
    margin-top: 18px;
    color: #e53935;
    font-size: 14px;
    min-height: 20px;
}

.demo-box {
    margin-top: 30px;
    padding: 20px;
    background: #f1f8e9;
    border-radius: 10px;
    border: 1px dashed #a5d6a7;
}

.demo-title {
    font-size: 13px;
    color: #2e7d32;
    margin-bottom: 12px;
    font-weight: 600;
}

.demo-text {
    font-size: 13px;
    color: #558b2f;
    line-height: 1.8;
}

.demo-code {
    background: #c8e6c9;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    color: #1b5e20;
}