/* ── WIZARD SYSTEM STYLES ── */
:root {
    --wiz-primary: #1d4ed8;       /* Royal Blue */
    --wiz-primary-light: #eff6ff; /* Very Light Blue */
    --wiz-success: #10b981;       /* Emerald */
    --wiz-success-light: #ecfdf5; /* Mint */
    --wiz-warning: #f59e0b;       /* Amber */
    --wiz-warning-light: #fef3c7; /* Pale Amber */
    --wiz-danger: #ef4444;        /* Crimson Red */
    --wiz-danger-light: #fef2f2;  /* Pale Crimson */
    --wiz-border: #e2e8f0;        /* Cool Gray Border */
    --wiz-bg-light: #f8fafc;      /* Slate Light BG */
    --wiz-text-main: #334155;     /* Dark Slate Text */
    --wiz-text-muted: #64748b;    /* Slate Muted Text */
}

/* ── Container Layout ── */
.wizard-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--wiz-border);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 2rem;
}

.wizard-header-strip {
    background: linear-gradient(90deg, #1e3a8a, #3b82f6);
    padding: 1.5rem 2rem;
    color: #ffffff;
}

.wizard-header-strip h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    font-size: 1.25rem;
}

.wizard-header-strip p {
    margin: 0.25rem 0 0 0;
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ── Steps Progress Tracker ── */
.wizard-steps-track {
    background: var(--wiz-bg-light);
    border-bottom: 1px solid var(--wiz-border);
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow-x: auto;
}

/* Horizontal line behind steps */
.wizard-steps-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4%;
    right: 4%;
    height: 3px;
    background: var(--wiz-border);
    transform: translateY(-50%);
    z-index: 1;
}

.wizard-steps-progress-line {
    position: absolute;
    top: 50%;
    left: 4%;
    height: 3px;
    background: var(--wiz-primary);
    transform: translateY(-50%);
    z-index: 2;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.wizard-step-node {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 90px;
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
}

.wizard-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--wiz-border);
    color: var(--wiz-text-muted);
    font-weight: 700;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.wizard-step-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--wiz-text-muted);
    margin-top: 0.5rem;
    max-width: 110px;
    line-height: 1.2;
    transition: all 0.3s ease;
}

/* Steps states */
.wizard-step-node.completed .wizard-step-circle {
    background: var(--wiz-primary);
    border-color: var(--wiz-primary);
    color: #ffffff;
}

.wizard-step-node.completed .wizard-step-label {
    color: var(--wiz-primary);
}

.wizard-step-node.active .wizard-step-circle {
    background: #ffffff;
    border-color: var(--wiz-primary);
    color: var(--wiz-primary);
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.wizard-step-node.active .wizard-step-label {
    color: var(--wiz-primary);
    font-weight: 700;
}

/* ── Panel Layout ── */
.wizard-panel {
    display: none;
    padding: 2rem;
}

.wizard-panel.active {
    display: block;
    animation: fadeIn 0.35s ease;
}

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

/* ── Wizard Bottom Actions ── */
.wizard-actions-bar {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--wiz-border);
    background: var(--wiz-bg-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.btn-wizard-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-wizard-action.btn-back {
    background: #ffffff;
    border: 1px solid var(--wiz-border);
    color: var(--wiz-text-main);
}

.btn-wizard-action.btn-back:hover {
    background: #f1f5f9;
}

.btn-wizard-action.btn-next {
    background: var(--wiz-primary);
    border: 1px solid var(--wiz-primary);
    color: #ffffff;
}

.btn-wizard-action.btn-next:hover {
    background: #1e40af;
}

/* ── Forms and Tables in Wizard ── */
.form-group-wizard {
    margin-bottom: 1.25rem;
}

.form-group-wizard label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--wiz-text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

.input-wizard {
    border-radius: 8px;
    border: 1px solid var(--wiz-border);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    width: 100%;
    transition: border-color 0.15s ease;
    background: #ffffff;
}

.input-wizard:focus {
    border-color: var(--wiz-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ── Step-Specific Custom Elements ── */

/* Timeslots Grid (Step 2) */
.timeslot-day-tab {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.timeslot-day-tab.active {
    background: var(--wiz-primary-light);
    color: var(--wiz-primary);
    border-color: rgba(59,130,246,0.2);
}

/* Targets Kurikulum (Step 3) */
.jtm-table {
    width: 100%;
    border-collapse: collapse;
}

.jtm-table th {
    background: var(--wiz-bg-light);
    border-bottom: 2px solid var(--wiz-border);
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--wiz-text-muted);
    text-transform: uppercase;
}

.jtm-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--wiz-border);
    vertical-align: middle;
}

.jtm-input-field {
    width: 70px;
    text-align: center;
    border: 1px solid var(--wiz-border);
    border-radius: 6px;
    padding: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.jtm-input-field:focus {
    border-color: var(--wiz-primary);
    outline: none;
}

/* Beban Mengajar (Step 4) */
.load-split-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--wiz-primary-light);
    color: var(--wiz-primary);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    margin: 0.125rem;
}

/* Availability Grid (Step 5) */
.avail-teacher-list-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--wiz-border);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}
.avail-teacher-list-item:hover {
    background: var(--wiz-bg-light);
}
.avail-teacher-list-item.active {
    border-color: var(--wiz-primary);
    background: var(--wiz-primary-light);
    color: var(--wiz-primary);
    font-weight: 600;
}

.avail-grid {
    display: grid;
    grid-template-columns: 80px repeat(6, 1fr);
    gap: 4px;
    margin-top: 1rem;
}

.avail-grid-header {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--wiz-text-muted);
    text-transform: uppercase;
    padding: 0.5rem 0.25rem;
    background: var(--wiz-bg-light);
    border-radius: 4px;
}

.avail-grid-cell {
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    border: 1px solid var(--wiz-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.avail-grid-cell.available {
    background: var(--wiz-success-light);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--wiz-success);
}

.avail-grid-cell.blocked {
    background: var(--wiz-danger-light);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--wiz-danger);
}

.avail-grid-cell:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.avail-label {
    font-size: 10px;
    font-weight: 700;
}

.avail-time {
    font-size: 9px;
    opacity: 0.75;
}

/* Micro-animations and effects */
.btn-save-inline {
    background: var(--wiz-success);
    border-color: var(--wiz-success);
    color: #ffffff;
}

.btn-save-inline:hover {
    background: #059669;
}

/* ─── DETAIL TIMETABLE & MASTER TIMETABLE IN WIZARD (Step 7) ─── */
.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.vmode-bar { display: flex; align-items: center; gap: 2px; background: #f3f4f6; border-radius: 8px; padding: 3px; width: fit-content; margin-bottom: 12px; }
.vmode-btn { font-size: 12px; padding: 5px 14px; border-radius: 6px; border: none; background: transparent; color: #6b7280; cursor: pointer; font-weight: 500; transition: all .12s; white-space: nowrap; }
.vmode-btn:hover { color: #111827; background: #e5e7eb; }
.vmode-btn.active { background: #fff; color: #1d4ed8; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.entity-selector { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.entity-selector label { font-size: 12px; color: #6b7280; font-weight: 600; white-space: nowrap; }
.entity-select { border: 1px solid #d1d5db; border-radius: 7px; padding: 5px 10px; font-size: 13px; color: #111827; background: #fff; min-width: 200px; max-width: 340px; cursor: pointer; outline: none; transition: border-color .12s; }
.entity-select:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px #dbeafe; }

.tt-table { border-collapse: separate; border-spacing: 0; font-size: 12px; width: 100%; }
.tt-table th { padding: 7px 10px; font-size: 11px; font-weight: 700; color: #4b5563; background: #f9fafb; border-bottom: 2px solid #e5e7eb; border-right: 1px solid #f0f0f0; text-align: center; white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.tt-table th.col-slot { text-align: left; width: 100px; min-width: 100px; position: sticky; left: 0; z-index: 3; background: #f9fafb; border-right: 2px solid #e5e7eb; }
.tt-table td { border-right: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; padding: 4px; vertical-align: top; min-width: 115px; height: auto; min-height: 56px; }
.tt-table td.col-slot { background: #fafafa; border-right: 2px solid #e5e7eb; padding: 4px 8px; position: sticky; left: 0; z-index: 1; vertical-align: middle; }

.slot-num { font-weight: 700; font-size: 12px; color: #1f2937; }
.slot-time { font-size: 10px; color: #9ca3af; margin-top: 1px; }

.row-nonkbm td { background: #fffbeb!important; height: 24px!important; padding: 2px 8px!important; border-bottom: 1px solid #fde68a!important; }
.row-nonkbm td.col-slot { background: #fef3c7!important; }
.row-nonkbm-label { font-size: 10px; font-weight: 600; color: #92400e; }
.cell-nonkbm { background: #fffbeb!important; vertical-align: middle!important; padding: 3px 5px!important; text-align: center; }
.cell-nonkbm-label { font-size: 10px; font-weight: 600; color: #92400e; }

/* Entry Card (ec) */
.ec { border-radius: 5px; padding: 4px 6px; height: auto; min-height: 46px; border-left: 3px solid; display: flex; flex-direction: column; justify-content: center; transition: filter .1s; position: relative; }
.ec:hover { filter: brightness(.92); }
.ec-subj { font-weight: 700; font-size: 11px; line-height: 1.2; }
.ec-meta { font-size: 10px; opacity: .68; margin-top: 2px; }
.ec.is-manual::after { position: absolute; top: 2px; right: 3px; content: '✎'; opacity: .55; font-size: 9px; }
.ec.locked-entry { cursor: not-allowed; opacity: 0.85; }

/* Master Timetable */
.mt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mt-table { border-collapse: separate; border-spacing: 0; font-size: 11px; width: 100%; }
.mt-table thead th { position: sticky; top: 0; z-index: 3; }

.mt-col-day {
    background: #f0f4f8; border-right: 2px solid #d1d5db; border-bottom: 1px solid #e5e7eb;
    min-width: 46px; width: 46px; position: sticky; left: 0; z-index: 2;
    text-align: center; vertical-align: middle; padding: 4px 2px;
}
.mt-table thead .mt-col-day { z-index: 4; background: #e8edf2; }
.day-vert {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: 11px; font-weight: 700; color: #374151;
    white-space: nowrap; letter-spacing: .03em;
}

.mt-col-jam {
    background: #f9fafb; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb;
    min-width: 52px; width: 52px; position: sticky; left: 46px; z-index: 2;
    text-align: center; vertical-align: middle; padding: 3px 4px;
}
.mt-table thead .mt-col-jam { z-index: 4; border-bottom: 2px solid #e5e7eb; }

.mt-col-jam-nonkbm {
    background: #fffbeb; border-right: 1px solid #fde68a; border-bottom: 1px solid #fde68a;
    min-width: 52px; width: 52px; position: sticky; left: 46px; z-index: 2;
    padding: 0;
}

.mt-cls-th { background: #f9fafb; border-right: 1px solid #e5e7eb; border-bottom: 2px solid #e5e7eb; padding: 5px 3px; font-size: 10px; font-weight: 700; color: #374151; text-align: center; white-space: nowrap; min-width: 60px; }
.mt-cell { border-right: 1px solid #efefef; border-bottom: 1px solid #efefef; padding: 2px; vertical-align: middle; height: auto; min-height: 42px; min-width: 60px; }

.mt-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: auto; min-height: 36px; border-radius: 4px; padding: 2px 3px; font-size: 10px; font-weight: 700; line-height: 1.2; text-align: center; overflow: hidden; transition: filter .1s, opacity .15s; word-break: break-word; }
.mt-chip:hover { filter: brightness(.88); }
.mt-chip.is-locked { outline: 2px solid #fbbf24; }
.mt-chip.dimmed, .ec.dimmed { opacity: .12; pointer-events: none; }
.mt-chip.highlighted, .ec.highlighted { outline: 2px solid #111827; z-index: 1; position: relative; }

.mt-day-sep .mt-col-day, .mt-day-sep .mt-col-jam, .mt-day-sep .mt-col-jam-nonkbm, .mt-day-sep .mt-cell { border-top: 2px solid #c8d0db!important; }
.mt-nonkbm-row .mt-cell { height: 20px; }
.mt-nonkbm-label-cell { background: #fffbeb; border-bottom: 1px solid #fde68a; font-size: 10px; font-weight: 600; color: #92400e; padding: 2px 8px; vertical-align: middle; border-right: 1px solid #fde68a; text-align: center; }

/* Legend Panel */
.legend-panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.legend-panel-title { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.legend-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.legend-item { display: flex; align-items: center; gap: 5px; padding: 4px 10px 4px 6px; border-radius: 20px; border: 1.5px solid transparent; cursor: pointer; transition: all .12s; font-size: 11px; font-weight: 600; }
.legend-item:hover { filter: brightness(.93); transform: translateY(-1px); }
.legend-item.active-highlight { box-shadow: 0 0 0 2px #111827; }
.legend-item.is-locked-teacher { position: relative; }
.legend-item.is-locked-teacher .legend-lock { display: inline; }
.legend-lock { display: none; font-size: 10px; margin-left: 2px; }
.legend-userid { font-size: 9px; opacity: .65; font-weight: 400; margin-left: 2px; }
.legend-sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* Lock Action Bar */
.lock-action-bar { display: none; align-items: center; gap: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 12px; }
.lock-action-bar.visible { display: flex; }
.lock-action-bar .teacher-info { flex: 1; }
.lock-action-bar .teacher-info strong { font-size: 13px; }
.lock-action-bar .teacher-info small { color: #6b7280; }

/* Drag & Drop */
.draggable { cursor: grab; user-select: none; transition: transform 0.1s; }
.draggable:active { cursor: grabbing; }
.dragging { opacity: 0.5; cursor: grabbing; }
.drop-zone { transition: background 0.1s; }
.drop-zone.drag-over { background: #c7e5ff !important; box-shadow: inset 0 0 0 2px #0d6efd; }

@media print {
    .no-print { display: none!important; }
    .mt-table thead th, .mt-col-day, .mt-col-jam, .mt-col-jam-nonkbm, .tt-table th, .tt-table td.col-slot { position: static!important; }
}
