:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-sidebar: #0d0d14;
    --border: #1a1a25;
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.15);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --text: #ffffff;
    --text-dim: #6b7280;
    --text-muted: #4b5563;
    --sidebar-width: 240px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== LAYOUT ==================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.logo-dot {
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.global-shield {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), transparent);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.shield-title {
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.shield-desc {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1.4;
}

.btn-kill {
    width: 100%;
    padding: 12px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-kill:hover,
.btn-kill:active {
    background: #dc2626;
    transform: scale(0.98);
}

.btn-kill.active {
    background: var(--success);
}

.session-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
    padding: 8px 0;
}

.session-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.main-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.main-subtitle {
    color: var(--text-dim);
    font-size: 14px;
}

.logout-link {
    color: var(--text-dim);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.logout-link:hover {
    color: var(--text);
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

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

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
}

.stat-value.green {
    color: var(--success);
}

.stat-value.red {
    color: var(--danger);
}

/* ==================== TABLE ==================== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr 0.8fr 0.8fr;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
}

.table-header span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    font-weight: 600;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr 0.8fr 0.8fr;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background 0.2s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.table-row:hover,
.table-row:active {
    background: rgba(139, 92, 246, 0.05);
}

.table-row:last-child {
    border-bottom: none;
}

.domain-name {
    font-weight: 500;
    font-size: 14px;
    word-break: break-word;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.operational {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-badge.maintenance {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.health-status {
    font-size: 12px;
}

.health-status.ok {
    color: var(--success);
}

.health-status.error {
    color: var(--danger);
}

.health-status.warning {
    color: var(--warning);
}

.latency {
    font-size: 12px;
    color: var(--text-dim);
}

.btn-action {
    padding: 8px 18px;
    border-radius: 100px;
    /* Pill shape */
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Site is running - show green "Live" button, clicking will kill it */
.btn-action.kill {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-action.kill:hover,
.btn-action.kill:active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Site is in maintenance - show red "Down" button, clicking will resume */
.btn-action.resume {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-action.resume:hover,
.btn-action.resume:active {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* ==================== MOBILE MENU BUTTON ==================== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn svg {
    color: var(--text);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

/* ==================== DRAWER ==================== */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
}

.drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    transition: right 0.3s ease;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.drawer-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.drawer-open {
    overflow: hidden !important;
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-header,
    .table-row {
        grid-template-columns: 1.5fr 1fr 1fr;
    }

    .table-header span:nth-child(4),
    .table-header span:nth-child(5),
    .table-row>*:nth-child(4),
    .table-row>*:nth-child(5) {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 16px 24px;
    }

    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-title {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .table-header {
        display: none;
    }

    .table-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 20px;
    }

    .table-row>* {
        display: block !important;
    }

    .domain-name {
        font-size: 16px;
        font-weight: 600;
    }

    .btn-action {
        width: 100%;
        padding: 12px;
        font-size: 13px;
        margin-top: 4px;
    }

    .drawer {
        max-width: 100%;
    }

    .drawer-content {
        padding: 20px;
    }
}

@media (max-width: 400px) {
    .main-content {
        padding: 70px 12px 20px;
    }

    .main-title {
        font-size: 20px;
    }

    .main-subtitle {
        font-size: 13px;
    }
}

/* ==================== TOUCH OPTIMIZATIONS ==================== */
@media (hover: none) and (pointer: coarse) {

    .nav-item,
    .table-row,
    .btn-action,
    .btn-kill {
        min-height: 48px;
    }

    .nav-item {
        padding: 16px;
    }
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 24px;
        border-radius: 16px;
    }
}