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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 48px 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #f8fafc;
}

.login-card .subtitle {
    color: #94a3b8;
    margin-bottom: 32px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3b82f6;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: #334155;
    color: #e2e8f0;
}

.btn-secondary:hover { background: #475569; }

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover { background: #b91c1c; }

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.error-msg {
    background: #450a0a;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

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

.sidebar {
    width: 240px;
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid #334155;
}

.sidebar-logo h2 {
    font-size: 20px;
    font-weight: 700;
    color: #3b82f6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-item:hover { background: #334155; color: #e2e8f0; }
.nav-item.active { background: #1e40af; color: #fff; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #334155;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: #475569;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #e2e8f0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.user-role {
    font-size: 12px;
    color: #64748b;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #f8fafc;
}

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

.stat-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #334155;
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #f8fafc;
}

.stat-card .stat-value.green { color: #22c55e; }
.stat-card .stat-value.red { color: #ef4444; }
.stat-card .stat-value.yellow { color: #eab308; }
.stat-card .stat-value.blue { color: #3b82f6; }

/* Search and Filter Bar */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
}

.search-box input:focus { border-color: #3b82f6; }

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 16px;
}

.filter-group {
    display: flex;
    gap: 4px;
    background: #1e293b;
    border-radius: 8px;
    padding: 3px;
    border: 1px solid #334155;
}

.filter-btn {
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover { color: #e2e8f0; }
.filter-btn.active { background: #3b82f6; color: #fff; }

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

.site-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.site-card:hover {
    border-color: #475569;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.site-card.selected {
    border-color: #3b82f6;
    background: #172554;
}

.site-card.selected:hover {
    border-color: #60a5fa;
}

.site-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.site-name {
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.up {
    background: #052e16;
    color: #22c55e;
}

.status-badge.down {
    background: #450a0a;
    color: #ef4444;
}

.status-badge.degraded {
    background: #422006;
    color: #eab308;
}

.status-badge.unknown {
    background: #1e293b;
    color: #64748b;
    border: 1px solid #334155;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.up { background: #22c55e; }
.status-dot.down { background: #ef4444; }
.status-dot.degraded { background: #eab308; }
.status-dot.unknown { background: #64748b; }

.site-url {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.uptime-bar {
    width: 100%;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    margin-top: 14px;
    overflow: hidden;
}

.uptime-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s;
}

.uptime-bar-fill.high { background: #22c55e; }
.uptime-bar-fill.medium { background: #eab308; }
.uptime-bar-fill.low { background: #ef4444; }

/* Site Detail */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: color 0.15s;
}

.back-link:hover { color: #e2e8f0; }

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.detail-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #f8fafc;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.detail-stat {
    background: #1e293b;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #334155;
    text-align: center;
}

.detail-stat .label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.detail-stat .value {
    font-size: 22px;
    font-weight: 700;
    color: #f8fafc;
}

.chart-container {
    background: #1e293b;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #334155;
    margin-bottom: 24px;
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.chart-svg {
    width: 100%;
    overflow: visible;
}

/* Incidents */
.incidents-container {
    background: #1e293b;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #334155;
}

.incidents-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.incident-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.incident-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #334155;
}

.incident-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.incident-type {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
}

.incident-time {
    font-size: 12px;
    color: #64748b;
}

.incident-duration {
    font-size: 14px;
    font-weight: 600;
    color: #eab308;
}

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

.modal {
    background: #1e293b;
    border-radius: 16px;
    padding: 32px;
    width: 480px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.modal h2 {
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: #64748b;
    font-size: 15px;
    gap: 10px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
    color: #64748b;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .sites-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .toolbar { flex-direction: column; }
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: #1e293b;
    border-top: 1px solid #334155;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 90;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
}

@media (max-width: 768px) {
    .bulk-actions-bar { left: 0; padding: 14px 16px; }
}
