/* history.css - Hanya untuk halaman history */

/* Reset dan dasar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2a2a2a 100%);
    color: #f0f0f0;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 100, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(100, 0, 255, 0.1) 0%, transparent 50%);
    z-index: -1;
}

/* Header */
header {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(100, 100, 100, 0.3);
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    color: #ffffff;
    font-size: 2.2em;
    background: linear-gradient(45deg, #4a90e2, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0, 100, 255, 0.3);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Navigasi */
.main-nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #b0b0b0;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 10px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.3);
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a:hover {
    background: linear-gradient(135deg, #1a3a5f 0%, #2a4a7f 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 100, 255, 0.3);
    border-color: #4a90e2;
}

.main-nav a.active {
    background: linear-gradient(135deg, #2a4a7f 0%, #3a5a9f 100%);
    color: #ffffff;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* Filter Container */
.filter-container {
    background: linear-gradient(135deg, rgba(10, 25, 47, 0.95) 0%, rgba(15, 35, 65, 0.98) 100%);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(100, 150, 255, 0.2);
    border: 1px solid rgba(50, 100, 200, 0.3);
}

.filter-container h2 {
    color: #ffffff;
    font-size: 1.8em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(45deg, #00d4ff, #4a90e2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #b0d0ff;
    margin-bottom: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    background: rgba(20, 40, 70, 0.8);
    color: #ffffff;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    background: rgba(25, 50, 90, 0.9);
}

.filter-btn {
    padding: 16px 30px;
    background: linear-gradient(135deg, #2a4a7f 0%, #3a5a9f 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(100, 150, 255, 0.4);
}

.filter-btn:hover {
    background: linear-gradient(135deg, #3a5a9f 0%, #4a6abf 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 100, 255, 0.4);
    border-color: #00d4ff;
}

/* History Container */
.history-container {
    background: linear-gradient(135deg, rgba(10, 25, 47, 0.95) 0%, rgba(15, 35, 65, 0.98) 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(100, 150, 255, 0.2);
    border: 1px solid rgba(50, 100, 200, 0.3);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.history-header h2 {
    color: #ffffff;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(45deg, #00d4ff, #4a90e2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.summary-item {
    color: #b0d0ff;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(20, 40, 70, 0.8);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(100, 150, 255, 0.2);
}

/* Export Options */
.export-options {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.export-btn {
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.csv-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
}

.pdf-btn {
    background: linear-gradient(135deg, #F44336 0%, #C62828 100%);
    color: white;
}

.excel-btn {
    background: linear-gradient(135deg, #2196F3 0%, #0D47A1 100%);
    color: white;
}

.export-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* ====================== */
/* PERBAIKAN UTAMA: TABLE STYLES */
/* ====================== */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    background: rgba(20, 40, 70, 0.8);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px; /* Minimum width untuk 6 kolom */
}

.history-table thead {
    background: linear-gradient(135deg, #2a4a7f 0%, #3a5a9f 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* PERBAIKAN: Gunakan display: table-cell untuk th dan td */
.history-table th {
    padding: 16px 12px;
    text-align: left;
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid rgba(100, 150, 255, 0.3);
    white-space: nowrap;
    display: table-cell; /* INI YANG DIPERBAIKI */
    vertical-align: middle;
}

.history-table th i {
    margin-right: 8px;
    font-size: 0.9em;
}

.history-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.1);
    color: #e0e0e0;
    vertical-align: middle;
    display: table-cell; /* Pastikan ini table-cell */
}

/* Atur lebar kolom */
.history-table th:nth-child(1), /* No */
.history-table td:nth-child(1) {
    width: 60px;
    text-align: center;
}

.history-table th:nth-child(2), /* Tanggal & Waktu */
.history-table td:nth-child(2) {
    width: 180px;
    min-width: 180px;
}

.history-table th:nth-child(3), /* Power */
.history-table td:nth-child(3) {
    width: 120px;
    text-align: right;
}

.history-table th:nth-child(4), /* Reflected */
.history-table td:nth-child(4) {
    width: 120px;
    text-align: right;
}

.history-table th:nth-child(5), /* Status Power */
.history-table td:nth-child(5) {
    width: 150px;
}

.history-table th:nth-child(6), /* Status Reflected */
.history-table td:nth-child(6) {
    width: 150px;
}

/* Warna baris bergantian */
.history-table tbody tr:nth-child(even) {
    background: rgba(25, 50, 90, 0.3);
}

.history-table tbody tr:hover {
    background: rgba(30, 60, 120, 0.4);
}

/* Status Badge */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.status-badge.normal {
    background: rgba(76, 175, 80, 0.2);
    color: #a5d6a7;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-badge.warning {
    background: rgba(255, 152, 0, 0.2);
    color: #ffcc80;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.status-badge.alarm {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
    animation: pulse 1s infinite;
}

.status-badge.off {
    background: rgba(158, 158, 158, 0.2);
    color: #9E9E9E;
    border: 1px solid #9E9E9E;
}

.status-badge.low {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
    border: 1px solid #FFC107;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.warning-text {
    color: #FF9800;
    font-weight: bold;
}

.no-data {
    text-align: center;
    padding: 40px !important;
    color: #888;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Statistics */
.statistics {
    margin-top: 30px;
    padding: 25px;
    background: rgba(20, 40, 70, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.2);
}

.statistics h3 {
    color: #b0d0ff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: rgba(25, 50, 90, 0.8);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: #00d4ff;
    background: rgba(30, 60, 100, 0.9);
}

.stat-card h4 {
    color: #b0d0ff;
    margin-bottom: 10px;
    font-size: 1em;
}

.stat-value {
    color: #ffffff;
    font-size: 1.4em;
    font-weight: bold;
}

/* Scrollbar styling untuk tabel */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(100, 150, 255, 0.1);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4a90e2 0%, #00d4ff 100%);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00d4ff 0%, #4a90e2 100%);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.9em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Responsif */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .summary {
        width: 100%;
        justify-content: flex-start;
    }
    
    .export-options {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .history-table th,
    .history-table td {
        padding: 10px 8px;
        font-size: 0.9em;
    }
    
    .history-table th:nth-child(2),
    .history-table td:nth-child(2) {
        width: 160px;
        min-width: 160px;
    }
    
    .history-table {
        min-width: 900px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.6em;
    }
    
    .main-nav a {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .filter-form {
        grid-template-columns: 1fr;
    }
    
    .export-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .history-table th:nth-child(5),
    .history-table td:nth-child(5),
    .history-table th:nth-child(6),
    .history-table td:nth-child(6) {
        width: 130px;
    }
}