/* CORAL VPN Management System - Styles */
/* Created: 2026-04-13 */

:root {
    --primary: #2ab5b2;
    --primary-dark: #1a8f8c;
    --primary-light: #e0f7f6;
    --accent: #e31837;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0f172a;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f1f5f9;
    --border: #e2e8f0;
    --online: #10b981;
    --offline: #ef4444;
    --white: #ffffff;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    font-size: 15px;
}

/* ======= LOGIN PAGE ======= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #3dd6d3 100%);
}
.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.login-card .logo { width: 180px; margin-bottom: 10px; }
.login-card h2 { color: var(--primary-dark); margin: 0 0 5px; font-size: 18px; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 30px; font-size: 13px; }
.login-card .form-control {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42, 181, 178, 0.15);
}
.login-card .btn-primary {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 15px;
    font-weight: 600;
    width: 100%;
    transition: background 0.2s;
}
.login-card .btn-primary:hover { background: var(--primary-dark); }
.login-error {
    background: #fef2f2;
    color: var(--accent);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-size: 13px;
}

/* ======= LAYOUT ======= */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s;
}
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header img { width: 160px; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-nav a i { width: 20px; text-align: center; font-size: 16px; }
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    text-align: center;
}

/* Main content */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    background: var(--white);
    padding: 12px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.top-bar .page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}
.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Stats Bar */
.stats-bar {
    background: var(--white);
    padding: 15px 25px;
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-radius: 10px;
    background: var(--bg-light);
    min-width: 160px;
}
.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--white);
}
.stat-card .stat-icon.total { background: var(--primary); }
.stat-card .stat-icon.online { background: var(--online); }
.stat-card .stat-icon.offline { background: var(--offline); }
.stat-card .stat-value { font-size: 22px; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }

/* Content Area */
.content-area { padding: 20px 25px; flex: 1; }

/* ======= TABLE STYLES ======= */
.table-container {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Column filter dropdowns */
.column-filters th {
    padding: 4px 6px !important;
}
.column-filters select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--white);
    color: var(--text-dark);
}

/* DataTables overrides */
table.dataTable { border-collapse: collapse !important; }
table.dataTable thead th,
#vpn-status-table thead th,
#clients-table thead th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 17px !important;
    padding: 10px 12px;
    border-bottom: 2px solid var(--primary-dark);
    white-space: nowrap;
}
table.dataTable tbody td,
#vpn-status-table tbody td,
#clients-table tbody td {
    padding: 9px 12px;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1a1a1a;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.dataTable tbody tr:hover { background: var(--primary-light) !important; }
table.dataTable tbody tr:nth-child(even) { background: #f8fafc; }

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 14px;
}

/* Status badges */
.badge-online {
    background: var(--online);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-offline {
    background: var(--offline);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-online::before, .badge-offline::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ======= CARDS & FORMS ======= */
.card {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.btn-coral {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-coral:hover { background: var(--primary-dark); color: var(--white); }

.btn-danger {
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ======= CLIENT MANAGEMENT ======= */
.file-browser {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.file-item:hover { background: var(--primary-light); }
.file-item i { color: var(--primary); }

/* ======= MOBILE RESPONSIVE ======= */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stats-bar { flex-wrap: wrap; }
    .stat-card { flex: 1; min-width: 140px; }
}

/* ======= MODAL OVERRIDES ======= */
.modal-header { background: var(--primary); color: var(--white); }
.modal-header .btn-close { filter: brightness(0) invert(1); }

/* ======= MISC ======= */
.text-online { color: var(--online); font-weight: 600; }
.text-offline { color: var(--offline); font-weight: 600; }
.editable-cell { cursor: pointer; border-bottom: 1px dashed var(--primary); }
.editable-cell:hover { background: var(--primary-light); }
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Export button style */
.dt-buttons .btn {
    background: var(--online) !important;
    color: var(--white) !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    padding: 6px 14px !important;
}
