/* === Infra Cockpit v3.0 — Taskade-inspired Dark Theme === */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #0a0a0f;
    --bg-surface: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text: #f0f0f3;
    --text-dim: #71717a;
    --text-muted: #52525b;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.25);
    --accent-subtle: rgba(139, 92, 246, 0.08);
    --green: #22c55e;
    --green-glow: rgba(34, 197, 94, 0.3);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.3);
    --yellow: #eab308;
    --blue: #3b82f6;
    --gray: #6b7280;
    --sidebar-w: 260px;
    --header-h: 56px;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 var(--green-glow); }
    50% { box-shadow: 0 0 0 6px transparent; }
}
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 var(--red-glow); }
    50% { box-shadow: 0 0 0 6px transparent; }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
.fade-in-delay-1 { animation: fadeIn 0.4s ease-out 0.1s forwards; opacity: 0; }
.fade-in-delay-2 { animation: fadeIn 0.4s ease-out 0.2s forwards; opacity: 0; }
.fade-in-delay-3 { animation: fadeIn 0.4s ease-out 0.3s forwards; opacity: 0; }

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo h1 {
    font-size: 17px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.sidebar-logo h1 .logo-icon {
    color: var(--accent);
}
.sidebar-logo small {
    color: var(--text-dim);
    font-size: 11px;
    display: block;
    margin-top: 4px;
    padding-left: 30px;
}
.nav-section {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 20px 20px 8px;
    letter-spacing: 1px;
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 1px 0;
}
.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}
.nav-item.active {
    color: var(--accent);
    background: var(--accent-subtle);
    border-left-color: var(--accent);
}
.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-item .nav-icon svg {
    width: 18px;
    height: 18px;
}

/* === Top Header Bar === */
.top-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 90;
    backdrop-filter: blur(12px);
}
.top-header .page-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.top-header .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim);
}
.top-header .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-subtle);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-glow);
}
.btn-logout svg { width: 14px; height: 14px; }

/* === Main Content === */
.main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    flex: 1;
    padding: 28px;
    min-width: 0;
}
.page-header {
    margin-bottom: 28px;
}
.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header h2 svg { color: var(--accent); }
.page-header .subtitle {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 6px;
}

/* === Cards === */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}
.card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}
.card:hover::before { opacity: 1; }
.card-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title svg { width: 14px; height: 14px; color: var(--accent); }
.card-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.card-detail {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
    line-height: 1.5;
}

/* === Tables === */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(8px);
}
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 12px 16px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.015); }

/* === Status Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.badge-green {
    background: rgba(34,197,94,0.12);
    color: var(--green);
}
.badge-green::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-green 2s infinite;
}
.badge-red {
    background: rgba(239,68,68,0.12);
    color: var(--red);
}
.badge-red::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse-red 2s infinite;
}
.badge-yellow {
    background: rgba(234,179,8,0.12);
    color: var(--yellow);
}
.badge-gray {
    background: rgba(107,114,128,0.12);
    color: var(--gray);
}
.badge-blue {
    background: rgba(59,130,246,0.12);
    color: var(--blue);
}
.badge-purple {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.btn-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--bg-card-hover);
}
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* === Log entries === */
.log-entry {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.log-entry:hover { border-color: var(--border-hover); }
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.log-action { font-weight: 600; font-size: 13px; }
.log-time { color: var(--text-dim); font-size: 11px; }
.log-details { color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.log-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Secret toggle === */
.secret-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.secret-row:last-child { border-bottom: none; }
.secret-name { font-weight: 500; }
.secret-value {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 12px;
    background: rgba(0,0,0,0.3);
    padding: 4px 10px;
    border-radius: 4px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: all;
}

/* === Error page === */
.error-box {
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
}
.error-box h3 { color: var(--red); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.error-box pre {
    color: var(--text-dim);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* === Empty state === */
.empty {
    text-align: center;
    padding: 48px;
    color: var(--text-dim);
}
.empty-icon { margin-bottom: 16px; }
.empty-icon svg { width: 48px; height: 48px; color: var(--text-muted); }

/* === Sidebar bottom === */
.sidebar-bottom {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.sidebar-bottom .version {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .top-header { left: 0; }
}

/* === Status dot utility === */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.status-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red-glow); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.gray { background: var(--gray); }

/* === Login page === */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}
.login-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.5s ease-out;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo svg {
    width: 40px;
    height: 40px;
    color: var(--accent);
    margin-bottom: 12px;
}
.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.login-logo p {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 6px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input::placeholder { color: var(--text-muted); }
.login-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--red);
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-error svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-login:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-login svg { width: 18px; height: 18px; }

/* === Hermes card specific === */
.hermes-card {
    background: linear-gradient(135deg, var(--bg-card), rgba(139, 92, 246, 0.05));
}
.hermes-card.alive { border-left: 3px solid var(--green); }
.hermes-card.dead { border-left: 3px solid var(--red); }

/* === Quick Links === */
.quick-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* === Server Cards === */
.server-card {
    border-left: 3px solid transparent;
}

/* === Resource Bars === */
.resource-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.resource-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.resource-fill.green {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}
.resource-fill.yellow {
    background: linear-gradient(90deg, #eab308, #facc15);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.3);
}
.resource-fill.red {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* === Server Card Extended === */
.server-card-extended {
    border-left: 3px solid var(--accent);
    background: linear-gradient(135deg, var(--bg-card), rgba(139, 92, 246, 0.03));
}
.server-card-extended:hover {
    border-left-color: var(--accent-hover);
}
