@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0b0f;
    --bg-secondary: #12131a;
    --bg-card: #161820;
    --bg-card-hover: #1c1e28;
    --bg-input: #1a1c26;
    --border: #252836;
    --border-active: #3a3d50;
    --text-primary: #e4e6f0;
    --text-secondary: #8b8fa3;
    --text-muted: #5a5e72;
    --accent: #22c55e;
    --accent-dim: rgba(34,197,94,0.12);
    --accent-glow: rgba(34,197,94,0.25);
    --danger: #ef4444;
    --danger-dim: rgba(239,68,68,0.12);
    --warn: #f59e0b;
    --warn-dim: rgba(245,158,11,0.12);
    --info: #3b82f6;
    --info-dim: rgba(59,130,246,0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Outfit', sans-serif;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 1px var(--border);
}

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

html { font-size: 15px; }
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

/* ========= LAYOUT ========= */
.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ========= SIDEBAR ========= */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.sidebar-brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand h1 .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #000;
    font-weight: 700;
}
.sidebar-brand small {
    display: block;
    color: var(--text-muted);
    font-size: 0.73rem;
    font-family: var(--font-mono);
    margin-top: 4px;
}
.nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}
.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 8px 8px 4px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    transition: all var(--transition);
}
.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    opacity: 1;
}
.nav-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 500;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* ========= MAIN ========= */
.main-content {
    padding: 32px 40px;
    max-width: 1400px;
}
.page-header {
    margin-bottom: 28px;
}
.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.page-header p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.9rem;
}

/* ========= CARDS ========= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-active); }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

/* ========= STAT CARDS ========= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}
.stat-card.green::before { background: var(--accent); }
.stat-card.red::before { background: var(--danger); }
.stat-card.blue::before { background: var(--info); }
.stat-card.yellow::before { background: var(--warn); }
.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
}

/* ========= TABLE ========= */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
thead th {
    background: var(--bg-secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ========= STATUS BADGE ========= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.badge-online { background: var(--accent-dim); color: var(--accent); }
.badge-online::before { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.badge-offline { background: var(--danger-dim); color: var(--danger); }
.badge-offline::before { background: var(--danger); }
.badge-pending { background: var(--warn-dim); color: var(--warn); }
.badge-pending::before { background: var(--warn); }
.badge-provisioning { background: var(--info-dim); color: var(--info); }
.badge-provisioning::before { background: var(--info); animation: pulse 1.5s infinite; }
.badge-error { background: var(--danger-dim); color: var(--danger); }
.badge-error::before { background: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ========= BUTTONS ========= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}
.btn-primary:hover { background: #16a34a; }
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-active); background: var(--bg-card); }
.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover { border-color: var(--border-active); color: var(--text-primary); }

/* ========= FORMS ========= */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    transition: border-color var(--transition);
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 80px; }
.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ========= COPY FIELD ========= */
.copy-field {
    display: flex;
    gap: 8px;
    align-items: center;
}
.copy-field input {
    flex: 1;
    font-size: 0.78rem;
}
.copy-btn {
    padding: 10px 14px;
    cursor: pointer;
}

/* ========= ALERTS ========= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert-error { background: var(--danger-dim); border-color: rgba(239,68,68,0.2); color: var(--danger); }
.alert-success { background: var(--accent-dim); border-color: rgba(34,197,94,0.2); color: var(--accent); }

/* ========= ACTIVITY LOG ========= */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.83rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}
.activity-time {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    white-space: nowrap;
}

/* ========= LOGIN ========= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 380px;
}
.login-box .logo-block {
    text-align: center;
    margin-bottom: 32px;
}
.login-box .logo-block .logo-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #000;
}
.login-box h2 {
    font-size: 1.3rem;
    font-weight: 600;
}
.login-box .card { padding: 28px; }

/* ========= EMPTY STATE ========= */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 0.9rem; }

/* ========= UTILITY ========= */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ========= RESPONSIVE ========= */
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 100;
        width: 260px;
        transition: left var(--transition);
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
