/* OS-2045 Cron-Editor (Wave D-3) */

.cron-editor {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    color: #cfd8dc;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
}

.cron-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #1f2933;
    background: #0d141b;
}

.cron-toolbar-spacer { flex: 1; }
.cron-status { color: #6b7886; font-size: 12px; }

.cron-btn {
    background: #1a2330;
    color: #cfd8dc;
    border: 1px solid #2c3a4d;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background 120ms;
}

.cron-btn:hover { background: #243345; }
.cron-btn:focus-visible { outline: 2px solid #4cc2ff; outline-offset: 1px; }

.cron-btn-primary {
    background: #1c3a5a;
    border-color: #2f5e88;
    color: #d8ecff;
}
.cron-btn-primary:hover { background: #244a72; }

.cron-btn-danger {
    background: #3a1a1a;
    border-color: #722f2f;
    color: #ffd8d8;
}
.cron-btn-danger:hover { background: #4a2424; }

.cron-btn-sm { padding: 3px 8px; font-size: 12px; }
.cron-btn-tiny { padding: 2px 7px; font-size: 11px; }

.cron-table-wrap {
    flex: 1;
    overflow: auto;
    padding: 8px 14px;
}

.cron-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cron-table th,
.cron-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #1a2330;
    vertical-align: middle;
}

.cron-table th {
    color: #6b7886;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #0d141b;
    position: sticky;
    top: 0;
    z-index: 1;
}

.cron-table code {
    font-family: "JetBrains Mono", "Consolas", monospace;
    color: #b6e3ff;
    background: rgba(76, 194, 255, 0.06);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    word-break: break-all;
}

.cron-table .cron-next {
    color: #6b7886;
    font-size: 11px;
    margin-top: 3px;
}

.cron-col-actions {
    width: 200px;
    white-space: nowrap;
}

.cron-col-actions .cron-btn { margin-right: 4px; }

.cron-empty {
    text-align: center;
    color: #6b7886;
    padding: 36px 12px;
    font-style: italic;
}

/* Toggle switch */
.cron-toggle {
    display: inline-block;
    position: relative;
    width: 36px;
    height: 18px;
    cursor: pointer;
}

.cron-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.cron-toggle span {
    position: absolute;
    inset: 0;
    background: #2c3a4d;
    border-radius: 18px;
    transition: background 120ms;
}

.cron-toggle span::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    background: #cfd8dc;
    border-radius: 50%;
    transition: transform 120ms;
}

.cron-toggle input:checked + span { background: #2f5e88; }
.cron-toggle input:checked + span::before { transform: translateX(18px); }

/* Modal */
.cron-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.cron-modal-backdrop[hidden] { display: none; }

.cron-modal {
    background: #111921;
    border: 1px solid #2c3a4d;
    border-radius: 8px;
    width: 520px;
    max-width: calc(100% - 32px);
    max-height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.cron-modal-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #1f2933;
}

.cron-modal-header h3 { margin: 0; font-size: 15px; color: #d8ecff; flex: 1; }

.cron-modal-x {
    background: none;
    border: none;
    color: #6b7886;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}
.cron-modal-x:hover { color: #cfd8dc; }

.cron-modal-body {
    padding: 14px 16px;
    overflow-y: auto;
}

.cron-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid #1f2933;
}

.cron-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.cron-field span { color: #8a98a6; font-size: 12px; }

.cron-field input[type="text"] {
    background: #0d141b;
    border: 1px solid #2c3a4d;
    color: #d8ecff;
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: "JetBrains Mono", monospace;
}

.cron-field input[type="text"]:focus {
    outline: none;
    border-color: #4cc2ff;
    box-shadow: 0 0 0 2px rgba(76, 194, 255, 0.2);
}

.cron-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #cfd8dc;
    font-size: 13px;
    cursor: pointer;
}

.cron-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.cron-next-preview {
    color: #6b7886;
    font-size: 12px;
    margin-top: 6px;
}

.cron-next-preview span { color: #b6e3ff; }

.cron-modal-error {
    background: #3a1a1a;
    border: 1px solid #722f2f;
    color: #ffd8d8;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 6px;
}

.cron-preview-block {
    background: #0d141b;
    border: 1px solid #2c3a4d;
    border-radius: 4px;
    padding: 10px;
    color: #b6e3ff;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Extended a11y / WCAG 2.4.7 — generic fallback for inputs, selects,
 * textareas and any [tabindex] target inside the Cron editor. */
.cron-editor button:focus-visible,
.cron-editor [tabindex]:focus-visible,
.cron-editor input:focus-visible,
.cron-editor select:focus-visible,
.cron-editor textarea:focus-visible {
    outline: 2px solid var(--theme-accent, #5fd1ff);
    outline-offset: 2px;
}
