:root {
    /* Dark Theme (Default) */
    --bg-main: #0F172A;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --accent: #10B981;
    --error: #EF4444;
    --field-bg: rgba(15, 23, 42, 0.6);
    --field-bg-hover: rgba(99, 102, 241, 0.2);
    --field-active: rgba(99, 102, 241, 0.3);
    
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

body.light-theme {
    --bg-main: #F8FAFC;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --border-color: rgba(15, 23, 42, 0.1);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --field-bg: rgba(241, 245, 249, 0.8);
    --field-bg-hover: rgba(99, 102, 241, 0.1);
    --field-active: rgba(99, 102, 241, 0.2);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden { display: none !important; }
.mt-6 { margin-top: 1.5rem; }
.h-full { height: 100%; }
.flex-col { display: flex; flex-direction: column; }

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-icon:hover {
    color: var(--text-main);
    background: var(--border-color);
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    flex: 1;
    min-height: 0; /* allows scrolling in children */
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    .app-container { height: auto; }
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.2);
}

body.light-theme .glass-panel {
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.05);
}

/* Hero Editor Section */
.hero-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cron-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.cron-input {
    width: 100%;
    background: var(--field-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px 60px 24px 24px;
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    transition: all 0.2s;
    outline: none;
    letter-spacing: 4px;
}

.cron-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.cron-input.error {
    color: var(--error);
    border-color: var(--error);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.btn-copy {
    position: absolute;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.btn-copy:hover {
    color: var(--text-main);
    background: var(--border-color);
}

.cron-description {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent);
    min-height: 2em;
}

.cron-description.error {
    color: var(--error);
}

/* Interactive Fields */
.cron-fields {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 16px;
}

.cron-field {
    flex: 1;
    background: var(--field-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.cron-field:hover {
    background: var(--field-bg-hover);
    border-color: var(--primary);
}

.cron-field.active {
    background: var(--field-active);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.field-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.field-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 600px) {
    .cron-fields { flex-wrap: wrap; }
    .cron-field { min-width: calc(33.33% - 8px); }
    .cron-input { font-size: 1.5rem; padding: 16px; }
}

/* Field Helper */
.field-helper {
    margin-top: 24px;
    padding: 20px;
    background: var(--field-bg);
    border: 1px dashed var(--primary);
    border-radius: var(--radius-md);
    animation: fadeIn 0.2s ease-out;
}

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

.field-helper h4 { color: var(--primary); margin-bottom: 4px; }
.field-helper p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; font-family: var(--font-mono); }

.helper-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Presets */
.presets-section h3, .syntax-guide h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.preset-pill {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.preset-pill:hover {
    background: var(--field-bg-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

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

.syntax-item {
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.syntax-item code {
    background: var(--field-bg);
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--primary);
    font-family: var(--font-mono);
    font-weight: 700;
}

/* Timeline */
.timeline-section {
    min-height: 0;
}

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

.timeline-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.timezone-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--field-bg);
    padding: 6px 12px;
    border-radius: 20px;
}

.timeline-list-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.timeline-list-container::-webkit-scrollbar {
    width: 6px;
}
.timeline-list-container::-webkit-scrollbar-track {
    background: transparent;
}
.timeline-list-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.timeline-list {
    list-style: none;
    position: relative;
}

.timeline-list::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-left: 48px;
    padding-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: 17px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--bg-panel);
}

.timeline-item.past .timeline-dot { background: var(--text-muted); }
.timeline-item.past .time-main, .timeline-item.past .time-sub { color: var(--text-muted); }

.time-main {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: block;
    font-family: var(--font-mono);
}

.time-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: var(--bg-main);
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
}
