/* src/public/css/cron.css … Cron式ジェネレーター ＆ 可視化パーサー
   ダークモードは theme-dark.css の末尾（=== Cron式 ===）にあります */

.cron-box {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    padding: 18px;
    margin-top: 18px;
}
.cron-h2 {
    font-size: 1.05rem;
    color: #2a5298;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cron-label {
    display: block;
    font-weight: bold;
    color: #2a5298;
    margin-bottom: 8px;
}
.cron-hint {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 10px;
    line-height: 1.6;
}

/* --- 式の入力 --- */
.cron-expr-row {
    display: flex;
    gap: 8px;
}
.cron-expr {
    flex: 1;
    min-width: 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
}
.cron-expr:focus { border-color: #3498db; }
.cron-btn {
    flex: 0 0 auto;
    padding: 0 16px;
    background: #2a5298;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cron-btn:hover { background: #1e3c72; }
.cron-copy-status {
    display: block;
    min-height: 1.2em;
    font-size: 0.85rem;
    color: #16a34a;
    margin-top: 4px;
}

/* 項目ごとの表示（分 時 日 月 曜日） */
.cron-cells {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-top: 6px;
}
.cron-cell {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    min-width: 0;
}
.cron-cell-value {
    display: block;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: bold;
    color: #1e293b;
    overflow-wrap: anywhere;
    min-height: 1.3em;
}
.cron-cell-name {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
}
.cron-cell.is-bad { background: #fee2e2; }
.cron-cell.is-bad .cron-cell-value { color: #b91c1c; }

.cron-error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.9rem;
}
.cron-error[hidden] { display: none; }

/* 意味（文章） */
.cron-desc-box {
    margin-top: 14px;
    padding: 14px;
    border-radius: 10px;
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}
.cron-desc-label {
    font-size: 0.8rem;
    color: #2563eb;
    font-weight: bold;
}
.cron-desc {
    margin: 4px 0 0;
    font-size: 1.15rem;
    font-weight: bold;
    color: #1e3a8a;
    line-height: 1.6;
    min-height: 1.6em;
}

/* --- プリセット --- */
.cron-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}
.cron-preset {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: #334155;
}
.cron-preset:hover { background: #e2e8f0; }
.cron-preset.is-active { border-color: #2a5298; background: #e0e7ff; }
.cron-preset-name { font-weight: bold; font-size: 0.9rem; }
.cron-preset code { font-size: 0.8rem; color: #475569; }

/* --- 組み立て --- */
.cron-builders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.cron-builder {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    min-width: 0;
}
.cron-builder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.cron-builder-title { font-weight: bold; color: #2a5298; }
.cron-builder select,
.cron-runs-options select,
.cron-b-step {
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    font-size: 0.9rem;
    max-width: 100%;
}
.cron-b-step { width: 5em; }
.cron-b-panel[hidden] { display: none; }
.cron-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.cron-b-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 190px;
    overflow-y: auto;
}
.cron-chip { cursor: pointer; }
.cron-chip input { position: absolute; opacity: 0; pointer-events: none; }
.cron-chip span {
    display: inline-block;
    min-width: 2.2em;
    padding: 4px 6px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.8rem;
    background: #fff;
    color: #334155;
    user-select: none;
}
.cron-chip input:checked + span { background: #2a5298; border-color: #2a5298; color: #fff; }
.cron-chip input:focus-visible + span { outline: 2px solid #3b82f6; outline-offset: 1px; }

/* --- 実行予定 --- */
.cron-runs-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.cron-runs-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}
.cron-runs-options label { display: flex; align-items: center; gap: 6px; }
.cron-runs {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cron-run {
    display: grid;
    grid-template-columns: 2em minmax(0, 1fr) 4em 7em;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid #eef2f7;
}
.cron-run:last-child { border-bottom: none; }
.cron-run-no { color: #94a3b8; font-size: 0.8rem; text-align: right; }
.cron-run-date { color: #1e293b; overflow-wrap: anywhere; }
.cron-run-time {
    text-align: right;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: bold;
    color: #2a5298;
}
.cron-run-rel { color: #64748b; font-size: 0.85rem; text-align: right; }

/* --- 早見表 --- */
.cron-table-wrap { overflow-x: auto; }
.cron-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.cron-table th,
.cron-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}
.cron-table th { color: #475569; background: #f8fafc; }
.cron-table code,
.cron-hint code {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .cron-expr { font-size: 1.15rem; }
    .cron-expr-row { flex-direction: column; }
    .cron-btn { padding: 10px 16px; justify-content: center; }
    .cron-run { grid-template-columns: 1.6em minmax(0, 1fr) 4em; }
    .cron-run-rel { grid-column: 2 / -1; text-align: left; }
    .cron-desc { font-size: 1.05rem; }
}
