/* ─── Design Tokens — Purple Haze ────────────────────────────────── */
:root {
    --primary: #6C5CE7;
    --primary-dim: rgba(108, 92, 231, 0.15);
    --secondary: #A29BFE;
    --accent: #FFEAA7;
    --accent-dim: rgba(255, 234, 167, 0.15);
    --bg: #1A0E2E;
    --bg-elevated: #231642;
    --bg-card: rgba(35, 22, 66, 0.7);
    --bg-hover: rgba(108, 92, 231, 0.08);
    --surface: rgba(255, 255, 255, 0.04);
    --border: rgba(108, 92, 231, 0.15);
    --border-strong: rgba(108, 92, 231, 0.3);
    --text: #F0E6FF;
    --text-dim: rgba(240, 230, 255, 0.6);
    --text-muted: rgba(240, 230, 255, 0.35);
    --danger: #FF6B6B;
    --success: #51CF66;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --transition: 200ms ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    /* Job colors */
    --job-0: #6C5CE7;
    --job-1: #00CEC9;
    --job-2: #FF7675;
    --job-3: #FDCB6E;
    --job-4: #74B9FF;
    --job-5: #A29BFE;
    --job-6: #55EFC4;
    --job-7: #FAB1A0;
    --job-8: #81ECEC;
    --job-9: #DFE6E9;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* ─── Header ────────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-brand .logo {
    font-size: 1.5rem;
}

.header-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ─── Form Elements ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #5A4BD1);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface);
}

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

.btn-danger {
    color: var(--danger);
}

.input,
.select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.875rem;
    transition: border-color var(--transition);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--primary);
}

.input::placeholder {
    color: var(--text-muted);
}

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23A29BFE'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.select option {
    background: var(--bg-elevated);
}

.cron-input {
    font-family: var(--font-mono);
    width: 200px;
}

.label-input {
    flex: 1;
    min-width: 150px;
}

/* ─── Add Section ───────────────────────────────────────────────── */
.add-section {
    margin-bottom: 20px;
}

.add-card {
    padding: 16px 20px;
}

.add-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.cron-description {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

/* ─── Warnings ──────────────────────────────────────────────────── */
.warnings-section {
    margin-bottom: 20px;
    animation: fadeIn 300ms ease;
}

.warning-card {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-color: rgba(255, 234, 167, 0.2);
}

.warning-icon {
    font-size: 1.2rem;
}

/* ─── Jobs Section ──────────────────────────────────────────────── */
.jobs-section {
    margin-bottom: 20px;
}

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

.jobs-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.job-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all var(--transition);
    animation: fadeIn 200ms ease;
}

.job-item:hover {
    border-color: var(--border-strong);
}

.job-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.job-label {
    font-weight: 500;
    flex: 1;
}

.job-cron {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--secondary);
}

.job-desc {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-left: 8px;
}

.job-next {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ─── Timeline ──────────────────────────────────────────────────── */
.timeline-section {
    animation: fadeIn 400ms ease;
}

.timeline-container {
    padding: 20px;
}

.timeline-container h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.timeline-grid {
    position: relative;
    overflow-x: auto;
    min-height: 100px;
}

.timeline-header {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.timeline-hour {
    flex: 1;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    min-width: 40px;
}

.timeline-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    position: relative;
    height: 28px;
}

.timeline-row-label {
    width: 120px;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.timeline-row-track {
    flex: 1;
    position: relative;
    height: 100%;
    min-width: 0;
}

.timeline-marker {
    position: absolute;
    top: 4px;
    width: 6px;
    height: 20px;
    border-radius: 3px;
    opacity: 0.85;
    transition: opacity var(--transition), transform var(--transition);
    cursor: pointer;
}

.timeline-marker:hover {
    opacity: 1;
    transform: scaleY(1.3);
    z-index: 2;
}

.timeline-marker.collision {
    box-shadow: 0 0 8px rgba(255, 234, 167, 0.6);
}

.now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    z-index: 3;
    pointer-events: none;
}

.now-label {
    position: absolute;
    top: -18px;
    font-size: 0.6rem;
    color: var(--accent);
    font-family: var(--font-mono);
    transform: translateX(-50%);
    white-space: nowrap;
}

/* ─── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

@media (max-width: 768px) {
    .app {
        padding: 16px 12px;
    }

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

    .add-row {
        flex-direction: column;
    }

    .cron-input,
    .label-input {
        width: 100%;
    }

    .timeline-row-label {
        width: 80px;
        font-size: 0.65rem;
    }
}