/* ===================================================
   style.css - OPTIMASI FINAL DESKTOP & INTERAKSI
   =================================================== */

/* === 1. GLOBAL & RESET === */
body, html {
    margin: 0;
    padding: 0;
    font-family: "Poppins", "Segoe UI", sans-serif;
    height: 100%;
    width: 100%;
    color: #333;
    overflow: hidden; /* Mencegah scroll body utama */
}

/* === 2. APLIKASI UTAMA (FIXED LAYOUT) === */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #75928d, #999caa);
    overflow: hidden;
}

/* Header Sticky */
.top-header {
    flex-shrink: 0; 
    z-index: 100;
    padding: 10px 30px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.header-row {
    display: flex;
    justify-content: center; /* Judul tetap presisi di tengah */
    align-items: center;
    position: relative; /* Anchor untuk elemen absolute kiri & kanan */
    margin-bottom: 8px;
    width: 100%;
}

.header-row h1 {
    font-size: 1.5em;
    color: #2c3e50;
    margin: 0;
    font-weight: 700;
    text-align: center;
}

.user-area-container {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-label {
    font-weight: 600;
    font-size: 12px;
    background: white;
    padding: 5px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.logout-btn {
    padding: 5px 15px;
    border-radius: 20px;
    border: none;
    background: #e74c3c;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 11px;
    transition: 0.2s;
}

.logout-btn:hover { background: #c0392b; }

/* === 3. NAVIGATION & SEARCH === */
.week-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
}

.week-nav button {
    background: white;
    color: #3498db;
    border: 1px solid #3498db;
    padding: 6px 16px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    transition: 0.3s;
}

.week-nav button:hover {
    background: #3498db;
    color: white;
}

#searchInput {
    width: 200px;
    padding: 8px 15px;
    border-radius: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    outline: none;
}

.suggestions-box {
    position: absolute;
    top: 110%;
    right: 0;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 2000;
    max-height: 350px;
    overflow-y: auto;
    display: none;
    border: 1px solid #eee;
}

/* === 4. GRID AREA & DRAG INTERACTION === */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    padding: 15px;
    flex: 1;
    min-height: 0; 
}

.day-column {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 12px 0 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    height: 100%;
    overflow: hidden;
    transition: background 0.3s;
}

/* Visual saat ada item drag di atas kolom */
.day-column.drag-over {
    background: rgba(52, 152, 219, 0.2);
    border: 2px dashed #3498db;
}

.day-header {
    flex-shrink: 0;
    font-weight: 800;
    color: #2c3e50;
    font-size: 13px;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
}

.task-list {
    list-style: none;
    padding: 0 8px 15px 8px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    min-height: 50px; /* Area drop tetap ada meski list kosong */
}

/* === 5. TASK ITEM, KATEGORI BADGE, & EDITING === */
.task-item {
    background: white;
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: grab; /* Indikator bisa ditarik */
    user-select: none;
}

.task-item:active { cursor: grabbing; }

/* Visual saat sedang di-drag */
.task-item.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    border: 1px dashed #3498db;
}

.task-item:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.08); }

.task-main { display: flex; align-items: flex-start; gap: 8px; flex: 1; overflow: hidden; }

.task-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
}

/* Badge Kategori */
/* ===================================================
   style.css - PERBAIKAN BADGE & CONTEXT MENU
   =================================================== */

/* FIX BADGE AGAR TEKS SUB KATEGORI TIDAK TERPOTONG */
.category-badge {
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-bottom: 3px;
    display: inline-block;
    white-space: normal !important; /* Membolehkan bungkus kalimat */
    word-break: break-word;        /* Memecah kata panjang jika diperlukan */
    max-width: 100%;
    line-height: 1.2;
}

.task-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
}

/* CUSTOM CONTEXT MENU (KLIK KANAN) */
.context-menu {
    display: none;
    position: absolute;
    z-index: 10000;
    width: 210px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid #eee;
    padding: 5px 0;
}

.context-menu-item {
    padding: 8px 15px;
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: #f0f3f6;
    color: #3498db;
}

.context-menu-item.danger {
    color: #e74c3c;
}

.context-menu-item.danger:hover {
    background: #fdf2f2;
}

.context-menu-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

/* Gaya Input saat Edit Inline (Double Klik) */
.edit-inline-input {
    width: 100%;
    border: 1px solid #3498db;
    border-radius: 4px;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.task-actions { display: flex; gap: 4px; opacity: 0; transition: 0.2s; }
.task-item:hover .task-actions { opacity: 1; }

.move-btn, .delete-btn {
    border: none; background: none; cursor: pointer; font-size: 14px; padding: 2px 4px;
}
.move-btn { color: #3498db; }
.delete-btn { color: #e74c3c; }

/* === 6. FOOTER & MODAL === */
.add-task-section {
    flex-shrink: 0;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.add-task-section select,
.add-task-section input,
.add-task-section button {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 12px;
    outline: none;
}

.add-task-section button {
    background: #27ae60;
    color: white;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.add-task-section button:hover { background: #219150; }

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    text-align: center;
}

/* Tombol Tambah Aktivitas di Rata Kiri Desktop */
.btn-add-header {
    position: absolute;
    left: 0; /* Mengunci posisi di paling kiri header */
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.btn-add-header:hover {
    background: #219150;
    transform: translateY(-1px);
}

/* Area User & Logout tetap Rata Kanan Desktop */
.user-area-container {
    position: absolute;
    right: 0; /* Mengunci posisi di paling kanan header */
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Styling Modal Form */
.modal-form {
    max-width: 400px;
    width: 90%;
    text-align: left;
}

.modal-form h3 {
    margin-top: 0;
    color: #2c3e50;
    text-align: center;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: #34495e;
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
}

.form-input:focus {
    border-color: #3498db;
}

.new-inline-input {
    border: 1px dashed #27ae60;
    background: #f0fff4;
}

/* Category Badge Styling */
.category-badge {
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-bottom: 3px;
    display: inline-block;
}


/* === 7. LOGIN PAGE === */
.login-wrapper {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #2c3e50, #455a64);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Layer standar modal timeline diatur di level bawah */
#timelineModal {
    z-index: 1000 !important;
}

/* Layer modal edit & form aksi diatur di level paling atas (di depan timeline) */
#editTaskModal,
#addTaskModal,
#moveTaskModal,
#jurnalModal,
#mediaLightbox {
    z-index: 2000 !important;
}

/* =====================================================
   OPTIMASI MODAL JURNAL KHUSUS MOBILE LANDSCAPE & RESPONSIVE
   ===================================================== */

/* 1. Atur batas maksimal tinggi modal jurnal secara umum */
.jurnal-modal-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Mengaktifkan scroll vertikal jika konten melebihi layar */
    box-sizing: border-box;
}

/* 2. Khusus Layar HP dengan Tinggi Terbatas (Landscape Mode) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .jurnal-modal-content {
        max-height: 92vh;
        padding: 12px 16px !important;
    }

    /* Kecilkan padding header agar hemat ruang vertikal */
    .jurnal-header {
        padding-bottom: 4px !important;
        margin-bottom: 8px !important;
    }

    /* Batasi tinggi area teks deskripsi di landscape agar lampiran terlihat */
    #jurnalPreviewBox {
        min-height: 60px !important;
        max-height: 120px !important;
    }

    #jurnalDeskripsi {
        min-height: 60px !important;
        height: 80px !important;
    }

    /* Buat grid lampiran lebih fleksibel dan bisa di-scroll */
    .lampiran-grid {
        max-height: 140px;
        overflow-y: auto;
        padding-right: 4px;
    }
}


/* === 8. UTILS & COLORS === */
.completed { opacity: 0.5; text-decoration: line-through; }

.task-item:nth-child(7n + 1) { border-left: 4px solid #ff6384; }
.task-item:nth-child(7n + 2) { border-left: 4px solid #ff9f40; }
.task-item:nth-child(7n + 3) { border-left: 4px solid #ffcd56; }
.task-item:nth-child(7n + 4) { border-left: 4px solid #4bc0c0; }
.task-item:nth-child(7n + 5) { border-left: 4px solid #36a2eb; }
.task-item:nth-child(7n + 6) { border-left: 4px solid #9966ff; }
.task-item:nth-child(7n + 7) { border-left: 4px solid #f67280; }

/* Sembunyikan navigasi mobile saat di desktop */
.mobile-day-nav { display: none !important; }

/* Scrollbar Styles */
.task-list::-webkit-scrollbar { width: 4px; }
.task-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }

