@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #222845;
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #f0f2f5;
    --text-secondary: #8b95a5;
    --text-muted: #5a6577;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --status-online: #10b981;
    --status-online-bg: rgba(16, 185, 129, 0.12);
    --status-online-glow: rgba(16, 185, 129, 0.4);
    --status-offline: #ef4444;
    --status-offline-bg: rgba(239, 68, 68, 0.12);
    --status-offline-glow: rgba(239, 68, 68, 0.4);
    --status-slow: #f59e0b;
    --status-slow-bg: rgba(245, 158, 11, 0.12);
    --status-slow-glow: rgba(245, 158, 11, 0.4);
    --status-checking: #6366f1;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-hero: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0a0e1a 100%);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Effects */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: orbFloat 15s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.bg-orb:nth-child(2) {
    width: 350px;
    height: 350px;
    background: var(--accent-blue);
    bottom: -80px;
    left: -80px;
    animation-delay: -5s;
}

.bg-orb:nth-child(3) {
    width: 250px;
    height: 250px;
    background: var(--accent-cyan);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    padding: 40px 0 32px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 48px;
    height: 48px;
    background: var(--gradient-1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.header-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.5);
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading .btn-text {
    opacity: 0.6;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Summary Stats */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.online {
    background: var(--status-online-bg);
    color: var(--status-online);
}

.stat-icon.offline {
    background: var(--status-offline-bg);
    color: var(--status-offline);
}

.stat-icon.slow {
    background: var(--status-slow-bg);
    color: var(--status-slow);
}

.stat-icon.total {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

/* Last Checked Bar */
.last-checked-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.last-checked-bar .live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--status-online);
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.countdown {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Service Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Service Card */
.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--status-checking);
    transition: background 0.5s ease;
}

.service-card.online::before {
    background: var(--status-online);
    box-shadow: 0 0 20px var(--status-online-glow);
}

.service-card.offline::before {
    background: var(--status-offline);
    box-shadow: 0 0 20px var(--status-offline-glow);
}

.service-card.slow::before {
    background: var(--status-slow);
    box-shadow: 0 0 20px var(--status-slow-glow);
}

.service-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.service-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.service-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.service-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.service-name {
    font-size: 18px;
    font-weight: 700;
}

.service-domain {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    margin-top: 2px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.online {
    background: var(--status-online-bg);
    color: var(--status-online);
}

.status-badge.offline {
    background: var(--status-offline-bg);
    color: var(--status-offline);
}

.status-badge.slow {
    background: var(--status-slow-bg);
    color: var(--status-slow);
}

.status-badge.checking {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.online .status-dot {
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 currentColor;
}

/* Service Metrics */
.service-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border-color);
    border-top: 1px solid var(--border-color);
}

.metric {
    background: var(--bg-card);
    padding: 14px 16px;
    text-align: center;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.metric-value.fast { color: var(--status-online); }
.metric-value.medium { color: var(--status-slow); }
.metric-value.slow { color: var(--status-offline); }

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Endpoint List */
.endpoints {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px 20px;
}

.endpoints-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.endpoint-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-xs);
    margin-bottom: 6px;
    transition: background 0.2s ease;
}

.endpoint-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.endpoint-item:last-child {
    margin-bottom: 0;
}

.endpoint-path {
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.endpoint-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.endpoint-time {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.endpoint-code {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.endpoint-code.success {
    background: var(--status-online-bg);
    color: var(--status-online);
}

.endpoint-code.error {
    background: var(--status-offline-bg);
    color: var(--status-offline);
}

.endpoint-code.warning {
    background: var(--status-slow-bg);
    color: var(--status-slow);
}

/* Response Chart */
.chart-container {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px 20px;
}

.chart-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.chart-canvas {
    width: 100%;
    height: 60px;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
    height: 280px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Footer */
.footer {
    text-align: center;
    padding: 32px 0 48px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 3px solid var(--status-online);
}

.toast.error {
    border-left: 3px solid var(--status-offline);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .header-title {
        font-size: 22px;
    }

    .service-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }
}
