/* ============================================
   DASHBOARD STYLES - CONNECTION BJ
   Modern glassmorphism design with auth & backup
   ============================================ */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-wrap: wrap;
    gap: 15px;
}

.header-left .dashboard-title {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.header-left .dashboard-subtitle {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Backup Indicator */
.backup-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 50px;
    font-size: 13px;
    color: #667eea;
}

.backup-icon {
    font-size: 16px;
    animation: rotate 2s linear infinite;
}

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

.backup-time {
    font-weight: 600;
}

/* Language Toggle in Header */
.language-toggle-header {
    display: flex;
    gap: 5px;
}

.lang-btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 50px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.lang-btn-small:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.lang-btn-small.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50px;
    font-size: 14px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.user-icon {
    font-size: 16px;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-role {
    color: #667eea;
    font-weight: 500;
    font-size: 12px;
}

/* Logout Button */
.logout-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.logout-icon {
    font-size: 16px;
}

/* Navigation Tabs */
.nav-tabs {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #666;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.tab-btn.hidden {
    display: none;
}

/* Main Content */
.main-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-height: 600px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.kpi-card.alert {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(238, 90, 111, 0.1) 100%);
    border-color: rgba(255, 107, 107, 0.2);
}

.kpi-icon {
    font-size: 40px;
}

.kpi-info {
    flex: 1;
}

.kpi-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.chart-container {
    position: relative;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Data Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.data-table th {
    padding: 15px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.data-table tbody tr.warning {
    background: rgba(255, 107, 107, 0.1);
}

.data-table tbody tr.warning:hover {
    background: rgba(255, 107, 107, 0.15);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-normal {
    background: rgba(81, 207, 102, 0.2);
    color: #37b24d;
}

.status-warning {
    background: rgba(255, 107, 107, 0.2);
    color: #ee5a6f;
}

.status-notset {
    background: rgba(158, 158, 158, 0.2);
    color: #666;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 5px;
    transition: all 0.2s ease;
}

.btn-edit {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.btn-edit:hover {
    background: rgba(102, 126, 234, 0.2);
}

.btn-delete {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.btn-delete:hover {
    background: rgba(255, 107, 107, 0.2);
}

.btn-edit:disabled, .btn-delete:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

/* Backup Section */
.backup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.backup-header h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 5px;
}

.backup-header p {
    font-size: 13px;
    color: #666;
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.backup-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.backup-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

.backup-item.auto {
    border-left: 4px solid #51cf66;
}

.backup-info {
    flex: 1;
    min-width: 200px;
}

.backup-date {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.backup-meta {
    font-size: 13px;
    color: #666;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.backup-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.backup-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.backup-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-restore {
    background: rgba(81, 207, 102, 0.1);
    color: #37b24d;
}

.btn-restore:hover {
    background: rgba(81, 207, 102, 0.2);
}

.btn-download {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.btn-download:hover {
    background: rgba(102, 126, 234, 0.2);
}

.btn-backup-delete {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.btn-backup-delete:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 20px;
    color: #333;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 107, 107, 0.2);
    transform: rotate(90deg);
}

.modal-form {
    padding: 30px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    color: #333;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.show {
    display: flex;
}

.toast-icon {
    font-size: 24px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px;
    }

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

    .backup-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .backup-actions {
        width: 100%;
    }

    .backup-btn {
        flex: 1;
        justify-content: center;
    }
}
