/* Admin Panel - Dark Theme */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a45;
    --bg-input: #0f1729;
    --border: #2a3a5c;
    --text-primary: #e0e6f0;
    --text-secondary: #8892a8;
    --text-muted: #5a6478;
    --accent: #00d4ff;
    --accent-hover: #00b8e0;
    --ok: #00e676;
    --ok-bg: rgba(0, 230, 118, 0.1);
    --warning: #ffa726;
    --warning-bg: rgba(255, 167, 38, 0.1);
    --error: #ff5252;
    --error-bg: rgba(255, 82, 82, 0.1);
    --ssl: #ab47bc;
    --ssl-bg: rgba(171, 71, 188, 0.1);
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-title {
    font-size: 24px;
    color: var(--accent);
    text-align: center;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 13px;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand { display: flex; align-items: center; gap: 10px; margin-right: 30px; }

.nav-logo {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
}

.nav-title { font-weight: 600; font-size: 15px; }

.nav-tabs { display: flex; gap: 2px; flex: 1; }

.nav-tab {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 12px; }

.nav-info {
    font-size: 11px;
    color: var(--text-muted);
    padding: 3px 8px;
    background: var(--bg-input);
    border-radius: 4px;
}

.nav-info.active { color: var(--ok); }

.nav-logout { color: var(--text-muted) !important; }
.nav-logout:hover { color: var(--error) !important; }

/* Main Content */
.main-content { padding: 20px; max-width: 1600px; margin: 0 auto; }

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

.section-header h2 { font-size: 18px; font-weight: 600; }

.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-card.stat-ok { border-left: 3px solid var(--ok); }
.stat-card.stat-warning { border-left: 3px solid var(--warning); }
.stat-card.stat-error { border-left: 3px solid var(--error); }
.stat-card.stat-ssl { border-left: 3px solid var(--ssl); }
.stat-card.stat-disk { border-left: 3px solid var(--warning); }

.stat-value { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.stat-ok .stat-value { color: var(--ok); }
.stat-warning .stat-value { color: var(--warning); }
.stat-error .stat-value { color: var(--error); }
.stat-ssl .stat-value { color: var(--ssl); }
.stat-disk .stat-value { color: var(--warning); }
.stat-label { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Quick Servers */
.quick-servers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 16px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 13px; }

.form-input, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    width: 100%;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input-sm { width: 160px; }
.form-select { cursor: pointer; width: auto; min-width: 120px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.btn:hover { background: var(--bg-secondary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #0099cc);
    color: #fff;
    border: none;
}

.btn-secondary { background: var(--bg-input); }
.btn-block { width: 100%; justify-content: center; }

/* Progress Bar */
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--ok));
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

/* Sites Grid */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
}

.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.site-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.site-card.status-ok { border-left: 3px solid var(--ok); }
.site-card.status-warning { border-left: 3px solid var(--warning); }
.site-card.status-error { border-left: 3px solid var(--error); }
.site-card.status-untested { border-left: 3px solid var(--text-muted); }

.site-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.site-meta span { display: flex; align-items: center; gap: 3px; }

.site-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-server { background: rgba(0,212,255,0.1); color: var(--accent); }
.badge-group { background: rgba(255,255,255,0.05); color: var(--text-secondary); }

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.data-table th {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Server Cards */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 16px;
}

.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.server-card.status-ok { border-top: 3px solid var(--ok); }
.server-card.status-warning { border-top: 3px solid var(--warning); }
.server-card.status-error { border-top: 3px solid var(--error); }

.server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.server-card-title { font-size: 16px; font-weight: 600; }
.server-card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.server-metric {
    margin-bottom: 12px;
}

.server-metric-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.gauge-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}

.gauge-fill.ok { background: var(--ok); }
.gauge-fill.warning { background: var(--warning); }
.gauge-fill.error { background: var(--error); }

.server-services {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.service-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.service-running { background: var(--ok-bg); color: var(--ok); }
.service-stopped { background: var(--error-bg); color: var(--error); }
.service-unknown { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.server-card.status-unknown { border-top: 3px solid var(--text-muted); }
.server-card.status-pending { border-top: 3px solid var(--border); opacity: 0.7; }
.server-card.status-loading { border-top: 3px solid var(--accent); opacity: 0.8; }
.status-badge.status-pending { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.status-badge.status-loading { background: rgba(0, 212, 255, 0.1); color: var(--accent); }
.service-badge.service-pending { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.server-note { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 8px; }
.badge-unknown { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.gauge-fill.unknown { background: var(--text-muted); }

/* Log Container */
.log-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    max-height: 600px;
    overflow-y: auto;
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-line { white-space: pre-wrap; word-break: break-all; padding: 1px 0; }
.log-line:hover { background: rgba(255,255,255,0.03); }
.log-line.log-error { color: var(--error); }
.log-line.log-warning { color: var(--warning); }
.log-line.log-notice { color: var(--text-secondary); }

.log-section-title {
    color: var(--accent);
    font-weight: 600;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    font-family: -apple-system, sans-serif;
    font-size: 13px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 16px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-section { margin-bottom: 16px; }
.modal-section-title { font-size: 12px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; }

.modal-detail-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.modal-detail-label { color: var(--text-secondary); min-width: 120px; }
.modal-detail-value { color: var(--text-primary); word-break: break-all; }

.modal-headers {
    background: var(--bg-input);
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.html-check { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-size: 12px; }
.check-ok { color: var(--ok); }
.check-fail { color: var(--error); }

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast-ok { border-left: 3px solid var(--ok); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--accent); }

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

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(255,82,82,0.2); }

/* Utilities */
.text-center { text-align: center; }
.text-ok { color: var(--ok); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-muted); }

.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
    grid-column: 1 / -1;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 10px; }
    .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
    .section-actions { flex-wrap: wrap; }
    .sites-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
