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

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: var(--text-primary);
    padding: 20px;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
}

.subtitle {
    font-size: 1.2em;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.main-nav {
    margin-top: 20px;
    display: flex;
    gap: 16px;
    justify-content: center;
}

.nav-link {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.last-update {
    margin-top: 15px;
    font-size: 0.85em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.last-update::before {
    content: '🔄';
    animation: rotate 2s linear infinite;
}

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

.refresh-btn {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.5);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.8);
    transform: translateY(-1px);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-btn.loading::before {
    content: '⏳';
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
    animation: fadeInUp 0.6s ease-out backwards;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px var(--shadow);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }

.health-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.1) 100%);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 24px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.2);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 50px;
    align-items: center;
    animation: fadeInUp 0.6s ease-out;
}

.health-score {
    text-align: center;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    font-weight: 700;
    margin: 0 auto 15px;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
    position: relative;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.6); }
    50% { box-shadow: 0 0 60px rgba(99, 102, 241, 0.9); }
}

.health-label {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-primary);
}

.health-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.stat {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.stat:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.05);
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 8px;
    font-weight: 500;
}

h2 {
    margin-bottom: 25px;
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upcoming-list, .jobs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upcoming-item {
    display: flex;
    justify-content: space-between;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border-left: 3px solid var(--primary);
    transition: all 0.3s;
}

.upcoming-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(5px);
}

.upcoming-time {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95em;
}

.job-card {
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border-left: 4px solid var(--success);
    transition: all 0.3s;
}

.job-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(5px);
}

.job-card.paused {
    border-left-color: var(--text-secondary);
    opacity: 0.6;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.job-name {
    font-weight: 600;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-badge.paused {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
}

.job-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.95em;
    line-height: 1.5;
}

.job-meta {
    display: flex;
    gap: 24px;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.job-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.9em;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-4px);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

.clinics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.clinic-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
}

.clinic-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.clinic-card.inactive {
    border-left-color: var(--text-secondary);
    opacity: 0.6;
}

.clinic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.clinic-name {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-primary);
}

.clinic-badges {
    display: flex;
    gap: 6px;
}

.clinic-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
}

.clinic-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.clinic-badge.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.clinic-badge.test {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.clinic-badge.prod {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.clinic-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.clinic-info-row {
    display: flex;
    justify-content: space-between;
}

.clinic-info-label {
    font-weight: 500;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2.5em;
    }
    
    .health-card {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
    }
    
    .health-stats {
        grid-template-columns: 1fr;
    }
    
    .job-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .card {
        padding: 20px;
    }
}
