/* dashboard.css - VPN Dashboard Styling */

/* Variables */
:root {
    --primary-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #7ba52a 0%, #5f8814 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo .subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
}

/* Main Content */
.main-content {
    padding: 30px 0;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 30px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-refresh {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.btn-refresh:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.status-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-left: 4px solid var(--gray-300);
}

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

.status-card.status-ok {
    border-left-color: var(--success-color);
}

.status-card.status-warning {
    border-left-color: var(--warning-color);
}

.status-card.status-error {
    border-left-color: var(--danger-color);
}

.status-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.status-info-label {
    color: var(--gray-600);
}

.status-info-value {
    font-weight: 600;
    color: var(--gray-900);
}

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

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-container h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

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

/* Uptime Section */
.uptime-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.uptime-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.uptime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.uptime-card {
    background: var(--gray-50);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
}

.uptime-card:hover {
    background: var(--gray-100);
}

.uptime-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 10px;
}

.uptime-percent {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.uptime-percent.excellent {
    color: var(--success-color);
}

.uptime-percent.good {
    color: var(--warning-color);
}

.uptime-percent.poor {
    color: var(--danger-color);
}

.uptime-days {
    font-size: 12px;
    color: var(--gray-600);
}

/* Alerts Section */
.alerts-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.alerts-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 4px solid var(--gray-300);
}

.alert-item.critical {
    border-left-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.alert-item.warning {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

.alert-item.resolved {
    opacity: 0.6;
    border-left-color: var(--success-color);
}

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

.alert-content {
    flex: 1;
}

.alert-message {
    font-weight: 600;
    margin-bottom: 5px;
}

.alert-meta {
    font-size: 12px;
    color: var(--gray-600);
}

.alert-time {
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
}

/* Table Section */
.table-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.table-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.table-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.table-search {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
}

.table-search:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-export {
    padding: 10px 20px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    background: #059669;
}

.table-wrapper {
    overflow-x: auto;
}

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

.data-table thead {
    background: var(--gray-100);
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 15px;
    border-top: 1px solid var(--gray-200);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

/* Footer */
.footer {
    background: var(--gray-800);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: 50px;
}

.footer p {
    margin: 5px 0;
    font-size: 14px;
}

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

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

    .filter-section {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

    .btn-refresh {
        width: 100%;
        margin-left: 0;
    }

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

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

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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