/* ===================================================
   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;
}

/* 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 Rata Kanan Desktop */
.user-area-container {
    position: absolute;
    right: 0; /* Mengunci posisi di paling kanan header */
    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;
}

.search-container {
    position: relative !important;
}

/* Dalam file style.css */

#searchInput {
    width: 200px;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #ccc !important; /* Memastikan border sekeliling tetap bersih */
    border-bottom: none !important;     /* Hilangkan garis bawah jika ada */
    background: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    outline: none !important;          /* Hilangkan outline browser saat fokus */
    box-shadow: none !important;       /* Mencegah bayangan/garis bawah dari browser */
    transition: all 0.3s ease;
}

#searchInput:focus {
    width: 230px;
    background: #ffffff;
    border: 1px solid #3498db !important;
    outline: none !important;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2) !important;
}

.suggestions-box {
    position: absolute !important;
    top: 110% !important;
    left: 0 !important;
    right: 0 !important;
    min-width: 280px;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    z-index: 9999 !important;
    max-height: 280px !important;
    overflow-y: auto !important;
}

.suggestion-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
    transition: background 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f0f7ff;
}

/* === 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, EFEK GLOW UP CARD HASIL CARI & 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.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: grab;
    user-select: none;
    position: relative;
    z-index: 1;
}

.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); 
}

/* ===================================================
   EFEK GLOW UP / BLOW UP CARD (SAAT DICARI / DITEMUKAN)
   =================================================== */

/* Class yang ditambahkan via JS ke .task-item saat dipilih dari pencarian */
.task-item.search-highlight,
.task-item.glow-up {
    z-index: 10 !important;
    animation: cardGlowPulse 1.8s ease-in-out infinite alternate !important;
    border: 2px solid #3b82f6 !important;
}

@keyframes cardGlowPulse {
    0% {
        transform: scale(1.02);
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.6), 0 0 20px rgba(59, 130, 246, 0.3);
    }
    100% {
        transform: scale(1.07);
        box-shadow: 0 0 22px rgba(59, 130, 246, 0.9), 0 0 35px rgba(59, 130, 246, 0.5);
    }
}

/* Teks yang cocok di dalam Card menyala */
mark, .highlight-text {
    background-color: #fef08a !important;
    color: #854d0e !important;
    font-weight: 700 !important;
    padding: 1px 4px !important;
    border-radius: 3px !important;
    box-shadow: 0 0 6px rgba(254, 240, 138, 0.8);
}

.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: 2px;
    width: 100%;
}

/* Badge Kategori */
.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;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.2;
}

/* 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;
}

/* 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;
}

/* === 7. LOGIN PAGE & MODAL Z-INDEX === */
.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 */
#timelineModal {
    z-index: 1000 !important;
}

/* Layer modal edit & form aksi diatur di level paling atas */
#editTaskModal,
#addTaskModal,
#moveTaskModal,
#jurnalModal,
#mediaLightbox {
    z-index: 2000 !important;
}

/* === 8. OPTIMASI MODAL JURNAL KHUSUS MOBILE LANDSCAPE & RESPONSIVE === */
.jurnal-modal-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
}

@media screen and (max-height: 500px) and (orientation: landscape) {
    .jurnal-modal-content {
        max-height: 92vh;
        padding: 12px 16px !important;
    }

    .jurnal-header {
        padding-bottom: 4px !important;
        margin-bottom: 8px !important;
    }

    #jurnalPreviewBox {
        min-height: 60px !important;
        max-height: 120px !important;
    }

    #jurnalDeskripsi {
        min-height: 60px !important;
        height: 80px !important;
    }

    .lampiran-grid {
        max-height: 140px;
        overflow-y: auto;
        padding-right: 4px;
    }
}

/* === 9. UTILS, COLORS & SCROLLBAR === */
.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; }

.mobile-day-nav { display: none !important; }

/* Custom Scrollbar Styles */
.task-list::-webkit-scrollbar { width: 4px; }
.task-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }

.suggestions-box::-webkit-scrollbar { width: 6px; }
.suggestions-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }