/* ============================================================
   AVIL Dashboard — Custom Styles (Bootstrap 5.3 Dark Theme)
   ============================================================ */

/* ---- Layout ---- */
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Top Bar ---- */
.top-bar { flex-shrink: 0; }

/* ---- Scrollable Nav ---- */
.nav-scroll {
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}
.nav-scroll .overflow-x-auto {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav-scroll .overflow-x-auto::-webkit-scrollbar { display: none; }

.nav-pill {
    font-size: 13px;
    color: var(--bs-secondary-color);
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-pill:hover {
    background: rgba(255,255,255,0.06);
    color: #d1d5db;
}
.nav-pill.active {
    background: rgba(139,92,246,0.2) !important;
    color: #a78bfa !important;
    font-weight: 600;
}

/* ---- Page Header ---- */
.app-header { flex-shrink: 0; }

/* ---- Chat ---- */
.chat-messages {
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth;
}
.message-row { display: flex; gap: 8px; align-items: flex-start; }
.message-row.user { flex-direction: row-reverse; }
.msg-avatar {
    width: 28px; height: 28px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.msg-bubble {
    max-width: 80%; padding: 8px 12px; border-radius: 12px;
    font-size: 13px; line-height: 1.5; word-wrap: break-word;
}
.msg-bubble.assistant {
    background: rgba(139,92,246,0.12);
    border: 1px solid rgba(139,92,246,0.2);
    color: #e0e0e0;
}
.msg-bubble.user {
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.25);
    color: #e0e0e0;
}
.msg-bubble img { max-width: 100%; border-radius: 8px; margin-top: 4px; }
.chat-input-area { border-top: 1px solid var(--bs-border-color); }

/* ---- Kalender ---- */
.kalender-grid-header {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; font-size: 11px; font-weight: 600;
    color: var(--bs-secondary-color); padding: 4px 0;
    border-bottom: 1px solid var(--bs-border-color);
}
.kalender-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.kal-cell {
    aspect-ratio: 1; padding: 2px; border-radius: 4px;
    cursor: pointer; font-size: 11px; min-height: 30px;
    transition: background 0.15s; position: relative; overflow: hidden;
}
.kal-cell:hover { background: rgba(255,255,255,0.04); }
.kal-cell.empty { cursor: default; opacity: 0.2; }
.kal-cell.today { background: rgba(139,92,246,0.18) !important; font-weight: 700; }
.kal-day-num { display: block; text-align: right; font-size: 11px; }
.kal-dot { display: block; height: 2px; border-radius: 1px; margin-top: 1px; }

/* ---- Kegiatan Cards ---- */
.kegiatan-cards {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin-top: 14px; padding-bottom: 14px;
}
.kegiatan-card .card-header { font-weight: 700; font-size: 13px; padding: 10px 14px; }
.kegiatan-list { flex: 1; display: flex; flex-direction: column; gap: 4px; min-height: 50px; }
.kegiatan-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border-left: 3px solid transparent; transition: all 0.15s;
}
.kegiatan-item:hover { background: rgba(255,255,255,0.06); border-left-color: #a78bfa; }
.kegiatan-time {
    font-family: monospace; font-size: 11px; font-weight: 600; color: #a78bfa;
    min-width: 44px; background: rgba(139,92,246,0.12);
    padding: 2px 6px; border-radius: 5px; text-align: center;
}
.kegiatan-title { font-size: 12px; font-weight: 500; flex: 1; }
.kegiatan-empty { text-align: center; color: var(--bs-secondary-color); font-size: 12px; padding: 16px; opacity: 0.7; }

/* ---- Todo Matrix ---- */
.matrix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; height: 100%; }
.matrix-q {
    display: flex; flex-direction: column; border-radius: 12px;
    border: 1px solid var(--bs-border-color); overflow: hidden; min-height: 180px;
}
.matrix-list { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 80px; overflow-y: auto; }
.matrix-list.drag-over { background: rgba(139,92,246,0.12); }

/* ---- Login ---- */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; min-height: 100dvh; padding: 16px;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1030 50%, #0f0f0f 100%);
}
.login-card { width: 100%; max-width: 400px; }
.login-avatar {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
    border: 3px solid #a78bfa; box-shadow: 0 0 20px rgba(139,92,246,0.4);
}

/* ---- Loading dots ---- */
.typing-dots span {
    display: inline-block; width: 5px; height: 5px; border-radius: 50%;
    background: #a78bfa; margin: 0 1px;
    animation: dot-bounce 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }
@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* ============================================================
   RESPONSIVE — Mobile (< 768px)
   ============================================================ */
@media (max-width: 767.98px) {
    .kegiatan-cards { grid-template-columns: 1fr; }
    .matrix-grid { grid-template-columns: 1fr; }
    .app-content { padding: 8px !important; }
    .kal-cell { font-size: 10px; min-height: 26px; }
    .msg-bubble { max-width: 90%; }
    .nav-pill { font-size: 12px; padding: 6px 10px !important; }
    .nav-label { display: none; }
}
