/* ==========================================================================
   TEHDIR - Auxiliary Styles: RPP Master (Kurikulum KMI)
   Direktori: assets/auxillary/rpp.css
   Penggunaan: src/Web/Rpp/View/view.php
   
   ATURAN PENGEMBANGAN (AGENTS.md):
   - Berisi style khusus fitur RPP Master KMI yang TIDAK ada di Bootstrap 5.3:
     Buku Referensi, Fixed Table Matrix 1050px, Toast Autosave Vanilla JS,
     AJAX Inline Live-Editing, Tipografi Arab RTL (Amiri), & Koreksi Operator.
   ========================================================================== */


/* ==========================================================================
   Bagian 1 — RPP Master: Buku Referensi / Kutubul Muqarrarah
   Digunakan di: src/Web/Rpp/View/view.php
   Alasan Non-Bootstrap:
   - Banner khusus penampil rujukan kitab kurikulum KMI dwi-bahasa (Arab/Latin).
   - Mendukung integrasi dengan orientasi RTL otomatis dan live-edit inline AJAX.
   ========================================================================== */

/* Kontainer utama banner buku referensi kurikulum */
.rpp-reference-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: var(--alert-success-bg);
    border: 1px solid var(--alert-success-border);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

/* Ikon kitab referensi */
.rpp-reference-banner-icon {
    font-size: 1.5rem;
    color: var(--success);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Judul label buku referensi */
.rpp-reference-banner-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--alert-success-text);
    margin-bottom: 4px;
}

/* Isi teks referensi kitab (mendukung teks panjang dan Arab) */
.rpp-reference-banner-text {
    font-size: 0.9rem;
    color: var(--alert-success-text);
    line-height: 1.6;
}


/* ==========================================================================
   Bagian 2 — RPP Master: Tabel Sesi & Metadata Pertemuan Kurikulum
   Digunakan di: src/Web/Rpp/View/view.php
   Alasan Non-Bootstrap:
   - Membutuhkan fixed table layout dengan min-width 1050px agar teks Arab/Latin
     pada kolom rincian silabus tidak saling bertabrakan atau terkompresi.
   - Penataan nomor sesi bulat, tipografi materi, dan badge metode pengajaran KMI.
   ========================================================================== */

/* Tabel matriks sesi kurikulum */
.rpp-session-table {
    width: 100%;
    min-width: 1050px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.855rem;
}

/* Header kolom tabel sesi (huruf kapital terstruktur, vertikal top) */
.rpp-session-table th {
    background: var(--bg-hover);
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
}

/* Pembagian proporsi kolom matriks silabus RPP (KMI Standard) */
.rpp-session-table th.th-sesi          { width: 4%; }
.rpp-session-table th.th-materi        { width: 10%; }
.rpp-session-table th.th-deskripsi     { width: 11%; }
.rpp-session-table th.th-tujuan-umum   { width: 11%; }
.rpp-session-table th.th-tujuan-khusus { width: 28%; }
.rpp-session-table th.th-metode        { width: 22%; }
.rpp-session-table th.th-media         { width: 9%; }
.rpp-session-table th.th-aksi          { width: 5%; text-align: center; }

/* Sel isi rincian sesi silabus */
.rpp-session-table td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-main);
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

.rpp-session-table tbody tr:last-child td {
    border-bottom: none;
}

.rpp-session-table tbody tr {
    transition: background 0.15s ease;
}

.rpp-session-table tbody tr:hover td {
    background: var(--bg-hover);
}

/* Badge bulat penomoran urutan sesi pertemuan (28x28px) */
.rpp-session-number {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Judul topik materi pembelajaran silabus */
.rpp-session-materi {
    font-weight: 600;
    color: var(--text-main);
}

/* Teks metadata keterangan / uraian pembelajaran */
.rpp-session-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Badge penanda metode pengajaran KMI (Thariqah at-Tadris) */
.rpp-method-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.77rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border);
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}


/* ==========================================================================
   Bagian 3 — RPP Master: Toast Notifikasi Autosave (Vanilla JS)
   Digunakan di: src/Web/Rpp/View/view.php
   Alasan Non-Bootstrap:
   - Notifikasi floating autosave AJAX mandiri tanpa ketergantungan
     pada runtime library Bootstrap JS / Popper.
   - Dilengkapi animasi CSS masuk halus (@keyframes rpp-toast-in).
   ========================================================================== */

.rpp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--success);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
    animation: rpp-toast-in 0.3s ease;
}

@keyframes rpp-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rpp-toast.show {
    display: flex;
}


/* ==========================================================================
   Bagian 4 — RPP Master: AJAX Live-Editing & Contenteditable Cells
   Digunakan di: src/Web/Rpp/View/view.php
   Alasan Non-Bootstrap:
   - Efek visual border putus-putus (dashed), background focus, dan indikasi kursor
     saat operator mengaktifkan mode inline-editing pada sel silabus.
   - Tidak ada padanan utility di Bootstrap untuk interaktivitas contenteditable.
   ========================================================================== */

/* Kontrol edit mikro dan chip metadata RPP saat mode edit aktif */
.edit-mode-active .rpp-chip-static-text,
.edit-mode-active .rpp-static-text {
    display: none !important;
}

.edit-mode-active .rpp-chip-edit-controls,
.edit-mode-active .rpp-edit-control {
    display: inline-flex !important;
}

.edit-mode-active .rpp-editable-chip {
    border: 1.5px dashed var(--primary) !important;
    background: var(--primary-light, rgba(79, 70, 229, 0.1)) !important;
}

.edit-mode-active #refEditHint,
.edit-mode-active #rppRefBookHint {
    display: inline-flex !important;
}

/* Sel tabel dalam mode inline edit aktif */
.edit-mode-active .editable-cell {
    border: 1.5px dashed var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    background: var(--bg-hover);
    cursor: text;
    transition: all 0.2s ease;
    min-height: 24px;
}

.edit-mode-active .editable-cell:hover {
    border-color: var(--secondary);
    background: var(--bg-hover);
}

.edit-mode-active .editable-cell:focus {
    outline: none;
    border-color: var(--primary);
    border-style: solid;
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Dukungan tema gelap untuk sel edit */
body[data-theme="dark"] .edit-mode-active .editable-cell {
    border-color: #475569;
    background: rgba(255, 255, 255, 0.03);
}

body[data-theme="dark"] .edit-mode-active .editable-cell:hover {
    border-color: #64748b;
    background: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .edit-mode-active .editable-cell:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Area teks buku referensi dalam mode inline edit */
.edit-mode-active .rpp-reference-banner-text.editable-cell {
    border: 1.5px dashed var(--success);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: text;
    transition: all 0.2s ease;
    min-height: 48px;
    display: block;
}

body[data-theme="dark"] .edit-mode-active .rpp-reference-banner-text.editable-cell {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--text-main);
}

.edit-mode-active .rpp-reference-banner-text.editable-cell:hover {
    background: #ffffff;
    border-color: var(--success-hover);
}

body[data-theme="dark"] .edit-mode-active .rpp-reference-banner-text.editable-cell:hover {
    background: rgba(16, 185, 129, 0.15);
}

.edit-mode-active .rpp-reference-banner-text.editable-cell:focus {
    outline: none;
    border-color: var(--success);
    border-style: solid;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

body[data-theme="dark"] .edit-mode-active .rpp-reference-banner-text.editable-cell:focus {
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

/* Badge petunjuk mode edit */
.edit-mode-active .rpp-edit-hint {
    display: inline-flex !important;
    animation: rpp-fade-in 0.2s ease;
}

@keyframes rpp-fade-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Kontrol input/select mini untuk mengubah semester dan jam/minggu */
.rpp-chip-select,
.rpp-chip-input {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 8px;
    outline: none;
    transition: all 0.2s ease;
}

.rpp-chip-select:focus,
.rpp-chip-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
    background: var(--bg-card);
}

.rpp-chip-input {
    width: 52px;
    text-align: center;
}

.rpp-chip-edit-controls {
    display: none;
    align-items: center;
    gap: 4px;
}

.edit-mode-active .rpp-chip-edit-controls {
    display: inline-flex;
}

.edit-mode-active .rpp-chip-static-text {
    display: none;
}

/* Efek visual pada badge saat chip dalam mode edit */
.edit-mode-active .rpp-editable-chip {
    border: 1.5px dashed var(--primary) !important;
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    padding: 3px 10px;
    transition: all 0.2s ease;
}

body[data-theme="dark"] .edit-mode-active .rpp-editable-chip {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: var(--primary) !important;
}


/* ==========================================================================
   Bagian 5 — Domain KMI: Tipografi Dwi-Bahasa Arab & Mode RTL
   Digunakan di: src/Web/Rpp/View/view.php
   Alasan Non-Bootstrap:
   - Kurikulum Pondok Modern Gontor menggunakan silabus berbahasa Arab dan Inggris/Indonesia.
   - Membutuhkan font Arab kaligrafi khusus ('Amiri', 'Scheherazade New') dengan ukuran
     huruf dan line-height yang disesuaikan agar harakat terbaca jelas tanpa terpotong.
   - Pengaturan arah teks (direction: rtl) khusus per tabel tanpa merusak tata letak navbar global.
   ========================================================================== */

/* Kontainer utama orientasi kanan-ke-kiri (RTL) */
.rpp-rtl {
    direction: rtl !important;
    text-align: right !important;
}

.rpp-rtl .rpp-session-table {
    direction: rtl !important;
}

.rpp-rtl .rpp-session-table th {
    text-align: right;
}

.rpp-rtl .rpp-session-table th.th-sesi,
.rpp-rtl .rpp-session-table td.td-sesi {
    text-align: center !important;
}

/* Tipografi judul materi berbahasa Arab */
.rpp-rtl .rpp-session-materi {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.8;
}

/* Tipografi rincian tujuan/uraian berbahasa Arab */
.rpp-rtl .rpp-session-meta {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-main);
    text-align: right;
}

/* Tipografi badge metode berbahasa Arab */
.rpp-rtl .rpp-method-badge {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 0.92rem;
    line-height: 1.6;
    text-align: right;
}

/* Banner referensi kitab dalam mode RTL */
.rpp-rtl .rpp-reference-banner {
    direction: rtl;
    text-align: right;
}

.rpp-rtl .rpp-reference-banner-icon {
    margin-left: 12px;
    margin-right: 0;
}

.rpp-rtl .rpp-reference-banner-text {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Header Tabel Dwi-Bahasa (Baris atas teks Arab, baris bawah teks Indonesia) */
.rpp-th-ar {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.3;
}

.rpp-th-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.rpp-rtl .rpp-th-ar {
    color: var(--primary);
}

.rpp-rtl .rpp-session-table thead tr th {
    letter-spacing: 0;
}

/* Badge penanda dokumen terdeteksi otomatis berbahasa Arab */
.rtl-badge {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}


/* ==========================================================================
   Bagian 6 — RPP Master: Status Verifikasi & Koreksi Operator KMI
   Digunakan di: src/Web/Rpp/View/view.php
   Alasan Non-Bootstrap:
   - Komponen chip interaktif bagi staf KMI untuk mencentang kelayakan silabus
     yang langsung melakukan pembaruan real-time ke database via AJAX.
   ========================================================================== */

/* Kontainer chip verifikasi di header */
.rpp-verification-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    padding: 4px 12px;
    border-radius: 9999px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

/* Label switch interaktif */
.rpp-verification-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.rpp-verification-switch input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer;
    accent-color: var(--success);
    margin: 0;
}

/* Badge status apakah sudah diverifikasi staf atau belum */
.rpp-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.rpp-verified-badge.is-verified {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.rpp-verified-badge.is-unverified {
    background: rgba(156, 163, 175, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(156, 163, 175, 0.25);
}

/* Teks keterangan nama operator dan waktu verifikasi */
.rpp-verified-meta-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Kontrol Input & Select mikro saat mode edit semester & jam RPP */
.rpp-editable-select {
    width: auto;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1.5px solid var(--primary);
    background: var(--bg-card);
    color: var(--primary);
    padding: 2px 24px 2px 8px;
    cursor: pointer;
}

.rpp-editable-input {
    width: 52px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1.5px solid var(--primary);
    background: var(--bg-card);
    color: var(--primary);
    padding: 2px 4px;
}

