/* ===================== VARIABLES ===================== */
:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252836;
    --border: #2e3140;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --primary: #6c5ce7;
    --primary-hover: #7d6ff0;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e74c3c;
    --info: #0984e3;
    --radius: 10px;
    --shadow: 0 2px 15px rgba(0,0,0,0.3);
}

/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ===================== LAYOUT ===================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ===================== NAVBAR ===================== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 5px;
}

.nav-links a {
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.9em;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--bg-input);
    color: var(--text);
}

.nav-links a.logout {
    color: var(--danger);
}

@media (max-width: 768px) {
    .navbar { flex-direction: column; height: auto; padding: 10px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
}

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin-bottom: 16px;
    font-size: 1.1em;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

/* ===================== STATS ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 4px;
}

/* ===================== PROGRESS ===================== */
.progress-bar {
    background: var(--bg-input);
    border-radius: 6px;
    height: 24px;
    overflow: hidden;
    flex: 1;
}

.progress {
    background: linear-gradient(90deg, var(--primary), var(--info));
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 600;
    color: #fff;
    min-width: 40px;
    transition: width 0.3s;
}

.progress-danger {
    background: linear-gradient(90deg, var(--warning), var(--danger));
}

/* ===================== INFO ROWS ===================== */
.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.info-row > span:first-child {
    min-width: 50px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-table td:first-child {
    color: var(--text-muted);
    width: 40%;
}

/* ===================== SERVICES ===================== */
.service-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.service-row:last-child { border-bottom: none; }

.service-status { font-size: 1.2em; }
.status-on { color: var(--success); }
.status-off { color: var(--danger); }

.service-name {
    font-weight: 600;
    flex: 1;
}

.service-state {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* ===================== TABLES ===================== */
.table-responsive {
    overflow-x: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-input);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
    vertical-align: middle;
}

.data-table tr:hover {
    background: rgba(108, 92, 231, 0.05);
}

.row-inactive {
    opacity: 0.5;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 30px !important;
}

/* ===================== BADGES ===================== */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

.badge-green { background: rgba(0,184,148,0.15); color: var(--success); }
.badge-red { background: rgba(231,76,60,0.15); color: var(--danger); }

/* ===================== BUTTONS ===================== */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #222; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8em;
}

.actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

/* ===================== FORMS ===================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95em;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-inline {
    padding: 4px 8px;
    font-size: 0.85em;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text);
    width: 100%;
}

.input-inline:focus {
    border-color: var(--primary);
    outline: none;
}

.input-sm { max-width: 100px; }
.input-full { width: 100%; }

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group { margin-bottom: 0; flex: 1; min-width: 120px; }
.form-actions { flex: 0; min-width: auto; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85em;
}

.text-muted { color: var(--text-muted); font-size: 0.85em; }

/* ===================== FLASH MESSAGES ===================== */
.flash-messages { margin-bottom: 20px; }

.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.9em;
    border-left: 4px solid;
}

.flash-success { background: rgba(0,184,148,0.1); border-color: var(--success); color: var(--success); }
.flash-error { background: rgba(231,76,60,0.1); border-color: var(--danger); color: var(--danger); }
.flash-warning { background: rgba(253,203,110,0.1); border-color: var(--warning); color: var(--warning); }

/* ===================== LOGIN ===================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1117 0%, #1a1d27 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.login-box h1 {
    font-size: 2em;
    margin-bottom: 4px;
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.login-box .form-group { text-align: left; }

/* ===================== FOOTER ===================== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8em;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================== HEADINGS ===================== */
h1 {
    font-size: 1.6em;
    margin-bottom: 20px;
    color: var(--text);
}
