/* ============================================================
   Scheduling — Modernized Huntarr Theme
   ============================================================ */

/* Container — no horizontal padding; align with page header / content boundary */
.sched-container {
    width: 100%;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ---- Card ---- */
.sched-card {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.10);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.sched-card:hover {
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

/* ---- Card header ---- */
.sched-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    flex-wrap: wrap;
}

.sched-card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sched-card-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: -0.01em;
    padding: 0;
    border-bottom: none;
    background: none;
    box-shadow: none;
    text-shadow: none;
    display: block;
}

/* ---- Card icon ---- */
.sched-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.sched-icon-blue {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.sched-icon-slate {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
}

/* ---- Card body ---- */
.sched-card-body {
    padding: 18px 22px 22px;
}

/* ---- Timezone display ---- */
.sched-timezone-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 8px;
    color: #93bbfc;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.sched-timezone-display .timezone-label {
    color: #64748b;
    margin-right: 2px;
}

.sched-timezone-display .timezone-separator {
    color: rgba(148, 163, 184, 0.3);
    margin: 0 2px;
}

/* ---- Form layout ---- */
.sched-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.sched-form-group {
    margin-bottom: 18px;
}

.sched-form-group:last-child {
    margin-bottom: 0;
}

.sched-form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.813rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sched-form-time { flex: 0 0 auto; }
.sched-form-action { flex: 1; }
.sched-form-app { flex: 1; }
.sched-form-instance { flex: 1; }

/* ---- Time picker ---- */
.sched-time-picker {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Visual properties enforced by components.css — only layout kept here */
.sched-time-select {
    width: 70px;
    padding: 10px 8px;
    font-size: 1rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    text-align: center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.sched-time-colon {
    font-size: 1.3rem;
    font-weight: 700;
    color: #64748b;
    padding: 0 2px;
}

/* ---- Select inputs — visual via components.css ---- */
.sched-form-group select:not(.sched-time-select) {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    cursor: pointer;
}

.sched-form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sched-form-group select optgroup {
    background: #1e293b;
    color: #94a3b8;
    font-weight: 600;
}

.sched-form-group select option {
    background: #1e293b;
    color: #f1f5f9;
    padding: 6px;
}

/* ---- Day pills ---- */
.sched-day-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.sched-day-pill {
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.sched-day-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sched-day-pill span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.813rem;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    transition: all 0.2s ease;
}

.sched-day-pill:hover span {
    border-color: rgba(99, 102, 241, 0.3);
    color: #cbd5e1;
}

.sched-day-pill input:checked + span {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.45);
    color: #a5b4fc;
}

.sched-day-daily span {
    font-weight: 600;
}

.sched-day-daily input:checked + span {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.45);
    color: #a78bfa;
}

.sched-day-divider {
    width: 1px;
    height: 28px;
    background: rgba(148, 163, 184, 0.15);
    margin: 0 4px;
}

/* ---- Add button ---- */
.sched-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-top: 8px;
}

.sched-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.sched-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    width: 100%;
    justify-content: center;
}

.sched-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

/* ---- Schedule list ---- */
.sched-empty-state {
    text-align: center;
    padding: 36px 16px;
    color: #475569;
}

.sched-empty-state i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

.sched-empty-state p {
    margin: 0;
    font-size: 0.875rem;
    font-style: italic;
}

/* Schedule item */
.schedule-item {
    display: grid;
    grid-template-columns: 70px 1fr 1fr 1fr 44px;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.schedule-item:hover {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.50);
}

.schedule-item-time {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
    text-align: center;
    padding: 6px 0;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
}

.schedule-item-days {
    font-size: 0.813rem;
    color: #94a3b8;
}

.schedule-item-action {
    font-size: 0.813rem;
    font-weight: 500;
}

.schedule-item-action[data-action="enable"],
.schedule-item-action.action-enable {
    color: #4ade80;
}

.schedule-item-action[data-action="disable"],
.schedule-item-action.action-disable {
    color: #f87171;
}

.schedule-item-app {
    font-size: 0.813rem;
    color: #cbd5e1;
}

.schedule-item-actions {
    display: flex;
    justify-content: center;
}

/* Delete button */
.schedule-item .delete-schedule,
.schedule-item .icon-button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    padding: 0;
}

.schedule-item .delete-schedule:hover,
.schedule-item .icon-button:hover {
    background: rgba(239, 68, 68, 0.20);
    border-color: rgba(239, 68, 68, 0.50);
    color: #fecaca;
}

/* ---- Legacy class overrides (used by JS renderSchedules) ---- */
.schedule-item-checkbox { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .sched-container {
        padding: 0;
        gap: 14px;
    }

    .sched-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px 16px 12px;
    }

    .sched-timezone-display {
        font-size: 0.75rem;
    }

    .sched-timezone-display .timezone-label,
    .sched-timezone-display .timezone-separator,
    #serverTimezone {
        display: none;
    }

    .sched-card-body {
        padding: 14px 16px 18px;
    }

    .sched-form-row {
        flex-direction: column;
        gap: 0;
    }

    .sched-form-time,
    .sched-form-action,
    .sched-form-app,
    .sched-form-instance {
        flex: unset;
        width: 100%;
        margin-bottom: 18px;
    }

    .sched-day-pills {
        gap: 6px;
    }

    .sched-day-pill span {
        padding: 7px 10px;
        font-size: 0.75rem;
    }

    .sched-day-divider {
        display: none;
    }

    .schedule-item {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 12px 14px;
    }

    .schedule-item-time {
        grid-column: 1 / -1;
        text-align: left;
        display: inline-block;
        width: auto;
        padding: 4px 10px;
    }

    .schedule-item-actions {
        grid-column: 2;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .sched-card-header h3 {
        font-size: 0.95rem;
    }

    .sched-card-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
        border-radius: 8px;
    }

    .sched-time-select {
        width: 60px;
        padding: 8px 6px;
        font-size: 0.9rem;
    }

    .sched-day-pill span {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
}
