:root {
    /* God Mode Palette */
    --bg-core: #0a0a0f;
    --bg-panel: #13131f;
    --bg-input: #1c1c2e;

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-glow: rgba(102, 126, 234, 0.4);

    --text-main: #ffffff;
    --text-muted: #a0a0b0;

    --border-light: rgba(255, 255, 255, 0.1);

    --font-mono: 'Fira Code', 'Roboto Mono', monospace;
    --font-sans: 'Inter', system-ui, sans-serif;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;

    --shadow-glow: 0 0 20px var(--accent-glow);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-core);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
    text-shadow: 0 10px 30px rgba(118, 75, 162, 0.3);
}

.tagline {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Sections */
section {
    margin-bottom: 3rem;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

/* Visual Builder */
.cron-field {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.cron-field:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.1);
}

.field-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

select,
input[type="number"],
input[type="text"] {
    background: var(--bg-core);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Output */
.output-block {
    background: var(--bg-core);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--border-light);
    position: relative;
}

.output-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--accent-primary);
    word-break: break-all;
}

.natural-language .output-value {
    color: #00ff9d;
    /* Matrix green for success/readable */
    font-size: 1.4rem;
    font-weight: 600;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.2s ease;
}

.preset-btn {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    margin: 0.25rem;
}

.preset-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.copy-btn {
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: var(--bg-panel);
    color: var(--text-main);
    font-size: 0.8rem;
}

.copy-btn:hover {
    background: var(--accent-secondary);
}

/* Next Runs */
.run-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.run-item:last-child {
    border-bottom: none;
}

.run-number {
    color: var(--accent-secondary);
    font-weight: bold;
    width: 30px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }

    .field-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Timeline */
.timeline-block {
    overflow-x: auto;
}

.timeline-container {
    position: relative;
    height: 80px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.timeline-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: var(--border-light);
    z-index: 1;
}

.timeline-point {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-point:hover {
    transform: translate(-50%, -50%) scale(1.5);
    background: #fff;
}

.timeline-point::after {
    content: attr(data-time);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.timeline-point:hover::after {
    opacity: 1;
}

/* Micro-interactions */
@keyframes flash {
    0% {
        color: var(--accent-primary);
        text-shadow: 0 0 10px var(--accent-primary);
    }

    50% {
        color: #fff;
        text-shadow: 0 0 20px #fff;
    }

    100% {
        color: var(--accent-primary);
        text-shadow: none;
    }
}

.updating {
    animation: flash 0.5s ease-out;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(19, 19, 31, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.cron-display-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper {
    position: relative;
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    height: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: text;
    transition: transform 0.2s ease;
}

.input-wrapper:hover {
    transform: scale(1.02);
}

/* Add a visual cue for the input area */
.cron-display-container::after {
    content: 'Click to edit';
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.cron-display-container:hover::after {
    opacity: 0.7;
}

.cron-input-real {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.01;
    /* Ensure it's technically visible for events */
    z-index: 10;
    /* Force top layer */
    cursor: text;
    text-align: center;
    font-size: inherit;
    font-family: inherit;
    background: transparent;
    border: none;
    color: transparent;
    caret-color: var(--accent-primary);
}

.cron-display-ghost {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    z-index: 1;
    pointer-events: none;
}

.cron-display-ghost span {
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    color: var(--text-main);
}

/* Highlighting States */
.cron-display-ghost span.active {
    background: var(--accent-glow);
    color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-glow);
}

.cron-display-ghost span.hovered {
    background: rgba(255, 255, 255, 0.1);
}

.hero-actions {
    margin-top: 2rem;
}

/* UI Rescue: Tabs & Pills */
.field-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-core);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    border: none;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* UI Rescue: Grid Pickers */
.grid-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.grid-item {
    background: var(--bg-core);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 0.5rem;
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    user-select: none;
}

.grid-item:hover {
    border-color: var(--accent-primary);
    color: var(--text-main);
}

.grid-item.selected {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: white;
    box-shadow: 0 0 10px rgba(118, 75, 162, 0.4);
}

/* UI Rescue: Interval & Range Inputs */
.input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-core);
    border-radius: var(--radius-md);
}

.input-row input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    width: 80px;
    text-align: center;
    font-size: 1.1rem;
}

.input-row span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Saved Expressions Sidebar */
.saved-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: rgba(19, 19, 31, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-light);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.saved-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    color: var(--text-main);
}

.close-sidebar-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    padding: 0.2rem 0.5rem;
}

.close-sidebar-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.saved-item {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.saved-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(-2px);
}

.saved-info {
    flex: 1;
    cursor: pointer;
}

.saved-name {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.saved-cron {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

.delete-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    opacity: 0.5;
}

.delete-btn:hover {
    color: #ff4757;
    opacity: 1;
    background: rgba(255, 71, 87, 0.1);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.clear-all-btn {
    width: 100%;
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.clear-all-btn:hover {
    background: rgba(255, 71, 87, 0.2);
}

/* Floating Button */
.floating-saved-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 900;
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-saved-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    background: var(--accent-secondary);
}

.saved-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.saved-count {
    font-size: 0.75rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    margin-top: 2px;
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-style: italic;
}
/* Save Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

.close-modal-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
}

.close-modal-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    background: var(--bg-core);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    border-radius: var(--radius-sm);
}

.input-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    padding: 0.75rem 1.5rem;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* Detailed Breakdown */
.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.breakdown-item {
    display: flex;
    align-items: baseline;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-label {
    width: 100px;
    color: var(--accent-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.breakdown-value {
    flex: 1;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

/* Clear Modal Danger Theme */
.btn-danger {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.2);
    padding: 0.75rem 1.5rem;
}

.btn-danger:hover {
    background: #ff4757;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
}

/* Paste Button */
#paste-btn {
    margin-right: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
}

#paste-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--text-main);
}

/* Input Wrapper Affordance */
.input-wrapper {
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.input-wrapper:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.1);
}
