:root {
    --primary-color: #2196F3;
    --secondary-color: #FF9800;
    --danger-color: #F44336;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #ecf0f1;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation Bar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1565c0 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar-logo i {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Layout */
.container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Sidebar */
.sidebar {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-upload {
    position: relative;
    margin-bottom: 1rem;
}

#csvFile {
    display: none;
}

.upload-btn {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    font-weight: 500;
}

.upload-btn:hover {
    background: #1565c0;
    transform: translateY(-2px);
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.quick-stat {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-stat.critical {
    background: rgba(244, 67, 54, 0.1);
    border-left: 4px solid var(--danger-color);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: bold;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: #1565c0;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

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

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

.btn-success:hover {
    background: #388e3c;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Main Content */
.main-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    color: var(--text-dark);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-light);
    font-size: 1.05rem;
}

/* Status Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.status-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.status-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.status-card.danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.status-card.success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.card-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
}

.card-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.chart-container {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-container h2 {
    color: var(--text-dark);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.chart-container canvas {
    max-height: 300px;
}

/* Table Section */
.table-section {
    margin-bottom: 3rem;
}

.table-section h2 {
    color: var(--text-dark);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.table-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
    background: var(--light-bg);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 1rem;
}

.search-box i {
    color: var(--text-light);
    margin-right: 0.5rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

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

.data-table tbody tr:hover {
    background: var(--light-bg);
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.normal {
    background: #d4edda;
    color: #155724;
}

.status-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.status-badge.critical {
    background: #f8d7da;
    color: #721c24;
}

/* Alerts Section */
.alerts-section {
    margin-bottom: 2rem;
}

.alerts-section h2 {
    color: var(--text-dark);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.alerts-container {
    display: grid;
    gap: 1rem;
}

.alert-item {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-item.warning {
    border-left-color: var(--warning-color);
    background: rgba(255, 193, 7, 0.1);
}

.alert-icon {
    font-size: 1.5rem;
    color: var(--danger-color);
}

.alert-item.warning .alert-icon {
    color: var(--warning-color);
}

.alert-content {
    flex: 1;
}

.alert-title {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    color: var(--text-light);
    font-size: 0.95rem;
}

.alert-time {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: white;
    margin-top: 1rem;
    font-weight: 500;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1001;
}

.toast.show {
    bottom: 2rem;
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
    color: var(--text-dark);
}

/* Content Sections */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reports Section */
.reports-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.report-card {
    background: var(--light-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.report-card h3 {
    color: var(--text-dark);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.report-item:last-child {
    border-bottom: none;
}

.report-label {
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
}

.report-value {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1.1rem;
}

.report-value.critical-value {
    color: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sidebar {
        position: static;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .main-content {
        padding: 1rem;
    }

    .table-controls {
        flex-direction: column;
    }

    .search-box {
        flex: auto;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .sidebar {
        padding: 1rem;
    }

    .status-card {
        padding: 1rem;
    }

    .card-value {
        font-size: 1.5rem;
    }
}
