*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: #f0fdf4; color: #111827; -ms-overflow-style: none; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html, body { height: 100%; }

.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════
   SCREEN LOGIN
══════════════════════════════════════════════════════ */
#search-screen { min-height: 100vh; background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.logo-placeholder { font-size: 40px; margin-bottom: 12px; background: white; padding: 16px; border-radius: 20px; box-shadow: 0 10px 25px rgba(4,120,87,0.1); }
.login-card { background: white; border-radius: 24px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(4,120,87,0.08); border: 1px solid #e5e7eb; }
.login-input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid #e5e7eb; font-size: 15px; outline: none; transition: border-color .2s; margin-bottom: 12px; color:#111827;}
.login-input:focus { border-color: #059669; }
.login-btn { width: 100%; padding: 14px; border-radius: 14px; border: none; cursor: pointer; font-size: 15px; font-weight: 700; color: white; background: linear-gradient(135deg, #047857, #10b981); box-shadow: 0 4px 16px rgba(4,120,87,0.25); transition: opacity .2s; }
.login-btn:hover { opacity: .9; }

/* ══════════════════════════════════════════════════════
   SCREEN PROFILE / DASHBOARD SHELL
══════════════════════════════════════════════════════ */
#profile-screen { display: none; min-height: 100vh; flex-direction: column; background: #f9fafb;}

@media (min-width: 768px) {
  #profile-screen.is-visible {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
    padding-top: 70px; /* Jarak untuk Desktop Header */
    position: relative;
  }
}
@media (max-width: 767px) {
  #profile-screen.is-visible { display: flex; }
}

/* ══════════════════════════════════════════════════════
   DESKTOP TOP HEADER & SIDEBAR
══════════════════════════════════════════════════════ */
.desktop-header { display: none; }
.sidebar { display: none; }

@media (min-width: 768px) {
  .desktop-header {
    display: flex; position: absolute; top: 0; left: 0; right: 0; height: 70px;
    justify-content: space-between; align-items: center;
    background: #022c22; padding: 0 24px; z-index: 100;
  }
  .dh-logo { display: flex; align-items: center; gap: 12px; }
  .dh-logout {
    padding: 8px 16px; border-radius: 99px; background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    color: white; border: none; cursor: pointer; transition: background 0.2s;
  }
  .dh-logout:hover { background: rgba(255,255,255,0.2); }

  .sidebar {
    display: flex; flex-direction: column; width: 270px; flex-shrink: 0;
    height: calc(100vh - 70px); overflow-y: auto;
    background: linear-gradient(175deg, #047857 0%, #059669 100%);
    position: relative; z-index: 10; padding-top: 24px;
  }
  .sb-profile { padding: 0 18px 24px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 16px; }
  .sb-welcome { font-size: 11px; color: rgba(255,255,255,.7); font-weight: 500; margin-bottom: 4px; }
  .sb-name { font-size: 20px; font-weight: 700; color: #fff; line-height: 1.2; margin-bottom: 8px; }
  .sb-meta { display: flex; gap: 6px; flex-wrap: wrap; }
  .sb-badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.15); border-radius: 99px; padding: 3px 10px; font-size: 11px; color: white; font-weight: 600; }
  
  .sb-nav { padding: 0 10px; }
  .sb-nav-item {
    display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 10px;
    border: none; background: transparent; cursor: pointer; transition: background .15s; width: 100%; text-align: left; margin-bottom: 4px;
  }
  .sb-nav-item:hover { background: rgba(255,255,255,.10); }
  .sb-nav-item.active { background: rgba(255,255,255,.2); }
  .sb-nav-icon { font-size: 18px; filter: grayscale(100%) opacity(0.7); display: flex; align-items: center; justify-content: center; }
  .sb-nav-label { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.8); }
  .sb-nav-item.active .sb-nav-icon { filter: none; }
  .sb-nav-item.active .sb-nav-label { color: #fff; font-weight: 700; }
}

/* ══════════════════════════════════════════════════════
   MOBILE TOPBAR & BOTTOM NAV
══════════════════════════════════════════════════════ */
.mobile-topbar { background: linear-gradient(145deg, #022c22 0%, #047857 60%, #059669 100%); padding: 0 0 20px; position: relative; overflow: hidden; }
.mob-tb-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; position: relative; z-index: 2; }
.mob-logout { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.15); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mob-profile { padding: 4px 20px 0; position: relative; z-index: 2; }
.mob-welcome { font-size: 12px; color: rgba(255,255,255,.7); font-weight: 500; margin-bottom: 2px; }
.mob-name { font-size: 22px; font-weight: 700; color: #fff; line-height: 1.2; margin-bottom: 8px; }
.mob-meta { display: flex; gap: 8px; }
.mob-badge { background: rgba(255,255,255,.2); border-radius: 99px; padding: 4px 12px; font-size: 11px; color: white; font-weight: 600; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid #e5e7eb; display: grid; grid-template-columns: repeat(3, 1fr); padding: 10px 0 16px; z-index: 50; }
.bn-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: transparent; cursor: pointer; }
.bn-icon { font-size: 20px; filter: grayscale(100%) opacity(0.5); transition: 0.2s; }
.bn-lbl { font-size: 10px; font-weight: 600; color: #9ca3af; }
.bn-btn.active .bn-icon { filter: none; }
.bn-btn.active .bn-lbl { color: #047857; }

@media (min-width: 768px) {
  .mobile-topbar { display: none; }
  .bottom-nav { display: none; }
}

/* ══════════════════════════════════════════════════════
   CONTENT AREA
══════════════════════════════════════════════════════ */
.content-area { flex: 1; min-height: 0; overflow-y: auto; background: #f9fafb; padding-bottom: 80px; }
.content-wrapper { max-width: 800px; margin: 0 auto; /* Supaya konten rapi di tengah pada layar desktop yang lebar */ }
.page { display: none; }
.page.active { display: block; }

@media (min-width: 768px) {
  .content-area { height: calc(100vh - 70px); padding-bottom: 24px; padding-top: 16px; }
}

.section-card { margin: 16px 14px 0; background: white; border-radius: 16px; border: 1px solid #f0f0f0; overflow: hidden; }
.section-header { padding: 14px 16px 10px; border-bottom: 1px solid #f5f5f5; }
.section-title { font-size: 14px; font-weight: 700; color: #111827; }

/* Grid Beranda untuk Desktop */
.beranda-grid { display: block; }
@media (min-width: 768px) {
  .beranda-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 0 14px; align-items: start; }
  .beranda-grid .section-card { margin: 0; }
}

.page-intro { padding: 20px 16px 4px; font-size: 16px; font-weight: 700; color: #111827; }
.page-sub { padding: 0 16px 10px; font-size: 12px; color: #6b7280; }

/* JUZ ACCORDION CARD */
.juz-card { background: white; border-radius: 16px; margin-bottom: 12px; border: 1px solid #e5e7eb; overflow: hidden; }
.juz-header { padding: 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: #f9fafb; transition: background 0.2s; }
.juz-header:hover { background: #f3f4f6; }
.juz-content { padding: 12px 16px; background: white; border-top: 1px solid #e5e7eb; }
.juz-chevron { transition: transform 0.3s ease; }

.hafalan-item { background: white; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; border: 1px solid #f0f0f0;}
.juz-content .hafalan-item { border: 1px solid #f0f0f0; } /* Styling di dalam juz content */
.juz-content .hafalan-item:last-child { margin-bottom: 0; }
.hf-name { font-size: 15px; font-weight: 700; color: #111827; }
.hf-ayat { font-size: 12px; color: #6b7280; margin-top: 2px; }
.hf-badge { font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 99px; text-align: center;}
.badge-lancar { background: #d1fae5; color: #047857; }
.badge-mengulang { background: #fef3c7; color: #b45309; }

/* CATATAN CARD */
.cat-card { background: white; border-radius: 16px; margin-bottom: 12px; border: 1px solid #e5e7eb; overflow: hidden; }
.cat-date { background: #f9fafb; padding: 10px 16px; font-size: 11px; font-weight: 700; color: #6b7280; border-bottom: 1px solid #e5e7eb; }
.cat-body { padding: 16px; }
.cat-lbl { font-size: 10px; font-weight: 700; color: #059669; margin-bottom: 4px; text-transform: uppercase; }
.cat-text { font-size: 13px; color: #374151; line-height: 1.5; margin-bottom: 12px; }
.cat-ortu { background: #ecfdf5; border-left: 3px solid #10b981; padding: 10px 12px; border-radius: 0 8px 8px 0; }
/* ══════════════════════════════════════════════════════
   ANIMASI PUTAR IKON REFRESH
══════════════════════════════════════════════════════ */
.is-spinning {
  animation: spin-icon 1s linear infinite;
  transform-origin: center;
}
@keyframes spin-icon {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}