/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e40af;
    --secondary-color: #1e3a8a;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #9333ea;
    --dark-bg: #1a1a1a;
    --light-bg: #f8f8f8;
    --card-bg: #ffffff;
    --border-color: #e5e5e5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --blue-accent: #2563eb;
    --blue-light: #dbeafe;
    --blue-dark: #1e40af;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

/* ===== LAYOUT ===== */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    padding: 20px;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.sidebar-header {
    padding: 20px 0 30px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.sidebar-header .subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.nav-menu {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
    cursor: pointer;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 18px;
}

.nav-item:hover {
    background-color: rgba(37, 99, 235, 0.15);
    transform: translateX(5px);
}

.nav-item.active {
    background-color: rgba(37, 99, 235, 0.25);
    border-left: 4px solid #2563eb;
    padding-left: 11px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.top-bar {
    background-color: var(--card-bg);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.header-info h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.header-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

#current-date {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.kpi-section h3,
.action-section h3,
.alert-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid var(--blue-accent);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.kpi-card.alert {
    background: linear-gradient(135deg, #4b5563 0%, #2d2d2d 100%);
    border-left-color: #dc2626;
}

.kpi-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.kpi-change {
    font-size: 12px;
    opacity: 0.85;
}

.action-section {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.btn-lg {
    flex: 1;
    padding: 20px;
    font-size: 16px;
    height: auto;
    border-radius: 10px;
}

.btn-lg .icon {
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
}

/* ===== CHARTS ===== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.chart-container {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-primary);
}

.chart-container canvas {
    max-height: 300px;
}

/* ===== LISTS ===== */
.alert-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin: 20px 0;
}

.list-container {
    max-height: 300px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.list-item-value {
    color: var(--warning-color);
    font-weight: bold;
}

.placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 14px;
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 24px;
    color: var(--text-primary);
}

/* ===== FORMS ===== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.form-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-primary);
}

.data-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 64, 129, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.form-actions button {
    flex: 1;
}

/* ===== TABLES ===== */
.table-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.table-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-primary);
}

.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background-color: #f9f9f9;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-ok {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.status-low {
    background-color: #ffe0b2;
    color: #e65100;
}

.status-warning {
    background-color: #ffccbc;
    color: #bf360c;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--light-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #45a049;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #da190b;
}

.btn-cancel {
    background-color: var(--text-secondary);
    color: white;
}

.btn-cancel:hover {
    background-color: var(--text-primary);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text-primary);
}

#modal-title {
    margin-bottom: 15px;
    font-size: 18px;
    color: var(--text-primary);
}

#modal-message {
    margin-bottom: 25px;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
}

/* ===== REPORTS ===== */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.report-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.report-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-primary);
}

.report-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.report-item:last-child {
    border-bottom: none;
}

.report-item .label {
    font-size: 14px;
    color: var(--text-secondary);
}

.report-item .value {
    font-size: 18px;
    font-weight: bold;
    color: var(--blue-accent);
}

.full-width {
    grid-column: 1 / -1;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.full-width canvas {
    max-height: 350px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        width: 280px;
        height: 100vh;
        top: 0;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        height: calc(100vh - 60px);
    }

    .top-bar {
        position: relative;
        padding: 15px;
    }

    .header-info h2 {
        font-size: 18px;
    }

    .header-info p {
        display: none;
    }

    .content {
        padding: 15px;
    }

    .kpi-cards {
        grid-template-columns: 1fr;
    }

    .action-section {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .section-header button {
        width: 100%;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        gap: 20px;
    }

    .kpi-value {
        font-size: 24px;
    }

    .btn-lg {
        padding: 15px;
        font-size: 14px;
    }

    .section-header h2 {
        font-size: 20px;
    }

    .form-group label {
        font-size: 12px;
    }

    .data-table {
        font-size: 11px;
    }
}
