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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: #0f0f1a;
    color: #e0e0f0;
    min-height: 100vh;
}

.dashboard { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ─── Header ────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 20px 24px;
    background: #1a1a2e;
    border-radius: 12px;
    border: 1px solid #2a2a4a;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.logo { font-size: 36px; }
h1 { font-size: 24px; font-weight: 700; color: white; }
.subtitle { font-size: 13px; color: #7070a0; margin-top: 2px; }

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

.stat-card {
    background: #252540;
    border-radius: 8px;
    padding: 12px 20px;
    text-align: center;
    border: 1px solid #3a3a6a;
    min-width: 80px;
}
.stat-card.ok { border-color: #57f287; }
.stat-card.warn { border-color: #ffa500; }
.stat-card.error { border-color: #ed4245; }

.stat-num { display: block; font-size: 28px; font-weight: 700; color: white; }
.stat-card.ok .stat-num { color: #57f287; }
.stat-card.warn .stat-num { color: #ffa500; }
.stat-card.error .stat-num { color: #ed4245; }
.stat-label { font-size: 11px; color: #7070a0; text-transform: uppercase; letter-spacing: 0.5px; }

/* ─── Filters ────────────────────────────────────────────── */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #3a3a6a;
    border-radius: 8px;
    color: white;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
}
.search-input:focus { border-color: #5865f2; }

.filter-select {
    background: #1a1a2e;
    border: 1px solid #3a3a6a;
    border-radius: 8px;
    color: white;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.btn-refresh {
    background: #5865f2;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.btn-refresh:hover { background: #4752c4; }

/* ─── Table ──────────────────────────────────────────────── */
.table-container {
    background: #1a1a2e;
    border-radius: 12px;
    border: 1px solid #2a2a4a;
    overflow: hidden;
}

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

.devices-table thead tr {
    background: #252540;
    border-bottom: 1px solid #3a3a6a;
}

.devices-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7070a0;
    font-weight: 600;
}

.device-row { border-bottom: 1px solid #1e1e38; transition: background 0.15s; }
.device-row:hover { background: #20203a; }
.device-row.selected { background: #252550; }

.devices-table td {
    padding: 14px 16px;
    font-size: 14px;
    vertical-align: middle;
}

.hostname { font-weight: 600; color: white; }
.mono { font-family: 'Consolas', 'Courier New', monospace; font-size: 13px; }
.mac { color: #a0a0c0; }
.version { color: #7070a0; font-size: 12px; }
.date { color: #7070a0; font-size: 12px; white-space: nowrap; }

.ip-link { color: #5865f2; text-decoration: none; }
.ip-link:hover { text-decoration: underline; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-ok { background: rgba(87,242,135,0.15); color: #57f287; }
.badge-warn { background: rgba(255,165,0,0.15); color: #ffa500; }
.badge-error { background: rgba(237,66,69,0.15); color: #ed4245; }
.badge-pending { background: rgba(88,101,242,0.15); color: #5865f2; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn-detail {
    background: #252550;
    color: #a0a0f0;
    border: 1px solid #3a3a6a;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-detail:hover { background: #5865f2; color: white; border-color: #5865f2; }

/* ─── Loading / Empty ────────────────────────────────────── */
.loading, .empty-state {
    text-align: center;
    padding: 60px;
    color: #7070a0;
}
.loading span, .empty-state span { font-size: 48px; display: block; margin-bottom: 16px; }

.spinner {
    width: 40px; height: 40px;
    border: 3px solid #3a3a6a;
    border-top-color: #5865f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal {
    background: #1a1a2e;
    border: 1px solid #3a3a6a;
    border-radius: 16px;
    width: 620px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #2a2a4a;
}
.modal-header h2 { font-size: 18px; color: white; }

.modal-close {
    background: none;
    border: none;
    color: #7070a0;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.modal-close:hover { background: #252540; color: white; }

.modal-body { padding: 24px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-item.full-width { grid-column: 1 / -1; }
.detail-item label { font-size: 11px; color: #7070a0; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item span, .detail-item a { font-size: 14px; color: #e0e0f0; }
.detail-item a { color: #5865f2; text-decoration: none; }

.password-row { display: flex; align-items: center; gap: 8px; }
.password-field { letter-spacing: 2px; }

.btn-show-pass {
    background: #252550;
    color: #a0a0f0;
    border: 1px solid #3a3a6a;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-show-pass:hover { background: #5865f2; color: white; }

.modal-links {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #2a2a4a;
}

.btn-link {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    background: #252550;
    color: #a0a0f0;
    border: 1px solid #3a3a6a;
    transition: all 0.15s;
}
.btn-link:hover { background: #5865f2; color: white; border-color: #5865f2; }
.btn-link.admin { background: rgba(237,66,69,0.1); color: #ed8a8c; border-color: #ed4245; }
.btn-link.admin:hover { background: #ed4245; color: white; }
