﻿

/* ==========================================================================
   EXTRACTED STYLES FROM INDEX.HTML
   ========================================================================== */


/* --- Style Block 1 --- */
/* ==========================================================================
       DESIGN SYSTEM (Apple Aesthetic inspired)
       ========================================================================== */
    *, *::before, *::after { 
      box-sizing: border-box; 
      margin: 0; 
      padding: 0; 
    }
    
    :root {
      /* Apple Palette */
      --apple-bg: #f5f5f7;
      --apple-white: #ffffff;
      --apple-dark: #1d1d1f;
      --apple-grey: #86868b;
      --apple-light-grey: #e8e8ed;
      --apple-border: rgba(0, 0, 0, 0.08);
      --apple-text-secondary: #333336;
      --apple-dark-hover: #333336;
      
      /* Accents */
      --accent-gold: #b8860b;
      --accent-gold-light: #fef9ec;
      --accent-green: #1a472a;
      --accent-green-light: #eaf4ee;
      --accent-blue: #0066cc;
      --accent-blue-light: #f0f7ff;
      --accent-red: #d32f2f;
      --accent-red-light: #ffebee;
      --accent-orange: #ed6c02;
      --accent-orange-light: #fff4e5;
      --accent-purple: #9c27b0;
      --accent-purple-light: #f3e5f5;
      
      /* Dynamic Backgrounds */
      --header-bg: rgba(255, 255, 255, 0.72);
      --card-detail-bg: #fafafb;
      
      /* Border Radii */
      --radius-sm: 8px;
      --radius-md: 12px;
      --radius-lg: 20px;
      --radius-pill: 9999px;
      
      /* Shadows */
      --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
      --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
      --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
      
      /* Fonts */
      --font-latin: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      --font-arabic: 'Scheherazade New', serif;
    }

    body.dark-theme {
      --apple-bg: #121214;
      --apple-white: #1d1d1f;
      --apple-dark: #f5f5f7;
      --apple-grey: #98989d;
      --apple-light-grey: #2c2c2e;
      --apple-border: rgba(255, 255, 255, 0.1);
      --apple-text-secondary: #d2d2d7;
      --apple-dark-hover: #e8e8ed;
      
      /* Accents (Adjusted for Dark Mode Contrast) */
      --accent-gold: #e5b842;
      --accent-gold-light: #2c2516;
      --accent-green: #48a06a;
      --accent-green-light: #162a1c;
      --accent-blue: #4da3ff;
      --accent-blue-light: #12253a;
      --accent-red: #ff5252;
      --accent-red-light: #3a1616;
      --accent-orange: #ff9800;
      --accent-orange-light: #3a2616;
      --accent-purple: #e040fb;
      --accent-purple-light: #2c1638;
      
      --header-bg: rgba(29, 29, 31, 0.72);
      --card-detail-bg: #151517;
      
      /* Shadows (Softer for dark surfaces) */
      --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
      --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
      --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    }

    /* Smooth Transition for Premium Theme Switching */
    body, header, footer, .card-header, .card-detail, .result-card, .rawi-node, .search-box, .search-input, .chip, .quick-card, .about-section, .method-card, .istilah-box, .tab-btn, .tab-row {
      transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    }

    body { 
      font-family: var(--font-latin); 
      background: var(--apple-bg); 
      color: var(--apple-dark); 
      min-height: 100vh; 
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
      overflow-x: hidden;
    }

    .arabic { 
      font-family: var(--font-arabic); 
      font-weight: 500;
    }

    /* Selection Color */
    ::selection {
      background: rgba(0, 102, 204, 0.15);
      color: var(--apple-dark);
    }

    /* Scrollbar Style */
    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: #c1c1c1;
      border-radius: var(--radius-pill);
    }
    ::-webkit-scrollbar-thumb:hover {
      background: #a8a8a8;
    }

    /* ==========================================================================
       HEADER (Glassmorphism & Sticky Nav)
       ========================================================================== */
    .header {
      background: var(--header-bg);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      border-bottom: 1px solid var(--apple-border);
      padding: 0 2.5rem;
      height: 64px;
      display: flex; 
      align-items: center; 
      justify-content: space-between;
      position: sticky; 
      top: 0; 
      z-index: 1000;
    }
    
    .logo { 
      display: flex; 
      align-items: center; 
      gap: 12px; 
      text-decoration: none; 
      transition: opacity 0.2s ease;
    }
    .logo:hover {
      opacity: 0.85;
    }
    .logo-mark {
      width: 38px; 
      height: 38px; 
      background: linear-gradient(135deg, var(--apple-dark) 0%, #434343 100%);
      border-radius: 9px; 
      display: flex; 
      align-items: center; 
      justify-content: center;
      color: var(--apple-white);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }
    .logo-name { 
      font-size: 16px; 
      font-weight: 700; 
      color: var(--apple-dark); 
      letter-spacing: -0.02em;
    }
    .logo-tagline { 
      font-size: 10px; 
      color: var(--apple-grey); 
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-top: 1px;
    }
    
    .nav { 
      display: flex; 
      gap: 8px; 
    }
    .nav a {
      padding: 8px 16px; 
      border-radius: var(--radius-pill);
      text-decoration: none; 
      font-size: 14px; 
      font-weight: 500;
      color: var(--apple-grey);
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .nav a:hover {
      color: var(--apple-dark);
      background: rgba(0, 0, 0, 0.04);
    }
    .nav a.active { 
      color: var(--apple-white);
      background: var(--apple-dark);
      box-shadow: var(--shadow-sm);
    }

    /* ==========================================================================
       PAGES & TRANSITIONS
       ========================================================================== */
    .page { 
      display: none; 
      opacity: 0;
      transform: translateY(15px);
      transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
      will-change: opacity, transform;
    }
    .page.active { 
      display: block; 
      opacity: 1;
      transform: translateY(0);
    }

    /* ==========================================================================
       HERO SECTION
       ========================================================================== */
    .hero {
      background: transparent;
      border-bottom: 1px solid var(--apple-border);
      padding: 6rem 2rem 4rem;
      text-align: center;
      position: relative;
      overflow: hidden;
      transition: background 0.3s ease;
    }
    .hero-badge {
      display: inline-flex; 
      align-items: center; 
      gap: 6px;
      font-size: 13px; 
      font-weight: 600;
      background: var(--accent-gold-light); 
      color: var(--accent-gold);
      border: 1px solid rgba(184, 134, 11, 0.18); 
      border-radius: var(--radius-pill);
      padding: 6px 16px; 
      margin-bottom: 1.5rem;
      letter-spacing: -0.01em;
    }
    @keyframes welcomePulse {
      0%, 100% { transform: scale(1); opacity: 0.95; }
      50% { transform: scale(1.03); opacity: 1; box-shadow: 0 0 10px rgba(184, 134, 11, 0.2); }
    }
    .hero h1 { 
      font-size: 46px; 
      font-weight: 800; 
      color: var(--apple-dark); 
      margin-bottom: 0.5rem; 
      letter-spacing: -0.035em;
    }
    .hero-arabic {
      font-family: var(--font-arabic);
      font-size: 36px; 
      color: var(--accent-gold); 
      margin-bottom: 1.2rem;
      direction: rtl; 
      line-height: 1.3;
    }
    .hero p { 
      font-size: 17px; 
      color: var(--apple-grey); 
      margin-bottom: 3rem; 
      max-width: 540px; 
      margin-left: auto; 
      margin-right: auto;
      line-height: 1.5;
    }

    /* ==========================================================================
       SEARCH BAR (Sticky & Premium design)
       ========================================================================== */
    .search-wrap { 
      max-width: 680px; 
      margin: 0 auto 1.5rem; 
      position: relative;
    }
    
    /* Sticky Search Wrapper on search page */
    .sticky-search-container {
      position: sticky;
      top: 64px;
      background: rgba(245, 245, 247, 0.85);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      z-index: 90;
      padding: 1.5rem 0;
      border-bottom: 1px solid var(--apple-border);
      margin-bottom: 2rem;
      transition: all 0.3s ease;
    }

    .search-box {
      display: flex; 
      align-items: center;
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      padding: 6px 8px 6px 18px;
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
      box-shadow: var(--shadow-sm);
    }
    .search-box:focus-within { 
      border-color: var(--apple-dark); 
      box-shadow: 0 0 0 4px rgba(29, 29, 31, 0.08), var(--shadow-md);
      transform: translateY(-1px);
    }
    .search-icon { 
      color: var(--apple-grey); 
      font-size: 20px; 
      flex-shrink: 0; 
      transition: color 0.2s ease;
    }
    .search-box:focus-within .search-icon {
      color: var(--apple-dark);
    }
    .search-input {
      flex: 1; 
      border: none; 
      outline: none; 
      background: none;
      font-size: 18px; 
      color: var(--apple-dark);
      padding: 10px 14px;
      direction: ltr;
      text-align: left;
      font-family: var(--font-latin);
      min-width: 0; /* Prevents long placeholder from expanding flex container on mobile */
    }
    /* Dynamic text-direction based on language input */
    .search-input:placeholder-shown {
      text-align: center;
      direction: ltr;
    }
    .search-input:focus:not(:placeholder-shown),
    .search-input:not(:placeholder-shown) {
      /* Dynamic RTL for Arabic text */
      text-align: right;
      direction: rtl;
      font-family: var(--font-arabic), var(--font-latin);
      font-size: 22px;
      padding: 4px 14px;
    }
    .search-input::placeholder { 
      color: var(--apple-grey); 
      font-size: 16px;
      font-family: var(--font-latin);
    }
    .search-btn {
      background: var(--apple-dark); 
      color: var(--apple-white);
      border: none; 
      border-radius: var(--radius-md);
      padding: 12px 24px; 
      font-size: 14px; 
      font-weight: 600;
      cursor: pointer; 
      transition: all 0.2s ease; 
      white-space: nowrap;
      box-shadow: var(--shadow-sm);
    }
    .search-btn:hover { 
      background: var(--apple-dark-hover); 
      transform: scale(1.02);
    }
    .search-btn:active {
      transform: scale(0.98);
    }

    /* Chips Filter */
    .filter-row { 
      display: flex; 
      gap: 8px; 
      flex-wrap: wrap; 
      justify-content: center; 
      margin-top: 1.25rem;
    }
    .chip {
      border: 1px solid var(--apple-border); 
      border-radius: var(--radius-pill);
      padding: 6px 16px; 
      font-size: 13px; 
      font-weight: 500;
      color: var(--apple-grey);
      background: var(--apple-white); 
      cursor: pointer; 
      transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
      box-shadow: var(--shadow-sm);
    }
    .chip:hover { 
      border-color: var(--apple-grey); 
      color: var(--apple-dark);
      transform: translateY(-1px);
    }
    .chip.active { 
      background: var(--apple-dark); 
      color: var(--apple-white); 
      border-color: var(--apple-dark); 
    }

    /* Hero Stats */
    .stats-row {
      display: flex; 
      gap: 3.5rem; 
      justify-content: center; 
      margin-top: 3.5rem;
    }

    /* Hero entrance — collapses to static under reduced-motion */
    @media (prefers-reduced-motion: no-preference) {
      @keyframes hero-rise {
        from { opacity: 0; transform: translateY(14px); }
        to   { opacity: 1; transform: translateY(0); }
      }
      .hero-badge, .hero h1, .hero-arabic, .hero p, .search-wrap, .stats-row {
        animation: hero-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
      }
      .hero h1 { animation-delay: 0.08s; }
      .hero-arabic { animation-delay: 0.14s; }
      .hero p { animation-delay: 0.20s; }
      .search-wrap { animation-delay: 0.26s; }
      .stats-row { animation-delay: 0.32s; }
    }
    .stat { 
      text-align: center; 
      position: relative;
    }
    .stat:not(:last-child)::after {
      content: '';
      position: absolute;
      right: -1.75rem;
      top: 20%;
      height: 60%;
      width: 1px;
      background: var(--apple-light-grey);
    }
    .stat-num { 
      font-size: 26px; 
      font-weight: 700; 
      color: var(--apple-dark); 
      letter-spacing: -0.02em;
    }
    .stat-label { 
      font-size: 12px; 
      font-weight: 500;
      color: var(--apple-grey); 
      margin-top: 4px; 
    }

    /* ==========================================================================
       MAIN CONTAINER & LAYOUT
       ========================================================================== */
    .main { 
      max-width: 900px; 
      margin: 0 auto; 
      padding: 3rem 1.5rem; 
    }

    .section-label {
      font-size: 12px; 
      font-weight: 700; 
      letter-spacing: 0.08em;
      text-transform: uppercase; 
      color: var(--apple-grey); 
      margin-bottom: 1.25rem;
      padding-left: 4px;
    }

    /* ==========================================================================
       HERO BACKGROUND & BENTO GRID COLLECTIONS
       ========================================================================== */
    .hero-bg-container {
      position: absolute;
      inset: 0;
      z-index: -1;
      overflow: hidden;
    }
    .hero-bg-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
      opacity: 0.28;
      transition: opacity 0.3s ease;
    }
    body.dark-theme .hero-bg-image {
      opacity: 0.14;
    }
    .hero-bg-overlay {
      position: absolute;
      inset: 0;
      background:
        radial-gradient(55% 45% at 50% 0%, rgba(184, 134, 11, 0.10), transparent 70%),
        linear-gradient(180deg, rgba(245, 245, 247, 0.2) 0%, rgba(245, 245, 247, 0.65) 60%, var(--apple-bg) 100%);
      transition: background 0.3s ease;
    }
    body.dark-theme .hero-bg-overlay {
      background:
        radial-gradient(55% 45% at 50% 0%, rgba(229, 184, 66, 0.12), transparent 70%),
        linear-gradient(180deg, rgba(18, 18, 20, 0.3) 0%, rgba(18, 18, 20, 0.75) 60%, var(--apple-bg) 100%);
    }
    .hero .search-box {
      background: rgba(255, 255, 255, 0.75);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    body.dark-theme .hero .search-box {
      background: rgba(29, 29, 31, 0.75);
    }

    .bento-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      grid-auto-rows: minmax(160px, auto);
      gap: 16px;
      margin-bottom: 3.5rem;
    }
    .bento-card {
      position: relative;
      --card-accent: var(--accent-gold);
      --card-accent-light: var(--accent-gold-light);
      --card-glow: rgba(184, 134, 11, 0.12);
      background: rgba(255, 255, 255, 0.7);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(0, 0, 0, 0.06);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      overflow: hidden;
      cursor: pointer;
      box-shadow: var(--shadow-sm);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                  box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                  border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    body.dark-theme .bento-card {
      background: rgba(29, 29, 31, 0.75);
      border-color: rgba(255, 255, 255, 0.08);
    }

    /* Single brand accent (gold) for every bento card — Color Consistency Lock */
    .bento-featured {
      --card-glow: rgba(184, 134, 11, 0.14);
    }

    body.dark-theme .bento-card {
      --card-glow: rgba(229, 184, 66, 0.18);
    }

    .bento-card:hover {
      transform: translateY(-6px) scale(1.005);
      border-color: var(--card-accent);
      box-shadow: var(--shadow-md), 0 0 30px var(--card-glow);
    }
    
    .bento-card-content {
      display: flex;
      flex-direction: column;
      height: 100%;
      justify-content: space-between;
      z-index: 2;
    }
    .bento-badge {
      align-self: flex-start;
      background: var(--accent-gold-light);
      color: var(--accent-gold);
      border: 1px solid rgba(184, 134, 11, 0.15);
      border-radius: var(--radius-pill);
      padding: 4px 12px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 1rem;
    }
    body.dark-theme .bento-badge {
      background: var(--accent-gold-light);
      color: var(--accent-gold);
      border-color: rgba(229, 184, 66, 0.25);
    }
    .bento-title {
      font-size: 18px;
      font-weight: 700;
      color: var(--apple-dark);
      margin-bottom: 0.5rem;
      letter-spacing: -0.02em;
      transition: color 0.3s ease;
    }
    .bento-card:hover .bento-title {
      color: var(--card-accent);
    }
    .bento-desc {
      font-size: 13.5px;
      color: var(--apple-grey);
      line-height: 1.6;
      margin-bottom: 1rem;
    }
    .bento-btn {
      align-self: flex-start;
      background: var(--apple-dark);
      color: var(--apple-white);
      border: none;
      border-radius: var(--radius-md);
      padding: 8px 16px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      box-shadow: var(--shadow-sm);
    }
    .bento-btn:hover {
      background: var(--apple-dark-hover);
      transform: scale(1.02);
    }
    .bento-btn:active {
      transform: scale(0.98);
    }
    .bento-header-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      margin-bottom: 1rem;
    }
    .bento-icon-wrapper {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      border: 1px solid var(--apple-border);
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .bento-card:hover .bento-icon-wrapper {
      transform: scale(1.1) rotate(-3deg);
    }
    .bento-icon-wrapper.text-green,
    .bento-icon-wrapper.text-gold,
    .bento-icon-wrapper.text-blue,
    .bento-icon-wrapper.text-red,
    .bento-icon-wrapper.text-orange,
    .bento-icon-wrapper.text-purple {
      color: var(--accent-gold);
      background: var(--accent-gold-light);
      border-color: rgba(229, 184, 66, 0.15);
    }
    .bento-icon-wrapper svg {
      width: 20px;
      height: 20px;
      stroke-width: 2.2;
    }

    /* Subtle entrance motion — gated so it collapses to static under reduced-motion */
    @media (prefers-reduced-motion: no-preference) {
      @keyframes bento-fade {
        from { opacity: 0; transform: translateY(14px); }
        to   { opacity: 1; transform: translateY(0); }
      }
      .bento-card {
        animation: bento-fade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
      }
      .bento-card:nth-child(1) { animation-delay: 0.05s; }
      .bento-card:nth-child(2) { animation-delay: 0.11s; }
      .bento-card:nth-child(3) { animation-delay: 0.17s; }
      .bento-card:nth-child(4) { animation-delay: 0.23s; }
      .bento-card:nth-child(5) { animation-delay: 0.29s; }
      .bento-card:nth-child(6) { animation-delay: 0.35s; }
      .bento-card:nth-child(7) { animation-delay: 0.41s; }
    }
    .bento-meta {
      font-size: 11px;
      font-weight: 700;
      color: var(--apple-grey);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    .bento-featured-bg {
      position: absolute;
      inset: 0;
      z-index: 1;
      overflow: hidden;
      pointer-events: none;
    }
    .bento-watermark {
      position: absolute;
      bottom: -15%;
      right: -15%;
      width: 55%;
      height: 55%;
      opacity: 0.8;
      transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
    }
    .bento-card:hover .bento-watermark {
      transform: scale(1.18) rotate(12deg);
      opacity: 0.95;
    }
    .bento-featured {
      grid-column: span 2;
      grid-row: span 2;
    }
    .bento-secondary {
      grid-column: span 2;
      grid-row: span 1;
    }
    .bento-small {
      grid-column: span 1;
      grid-row: span 1;
    }

    @media (max-width: 768px) {
      .bento-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 2.5rem;
      }
      .bento-featured, .bento-secondary, .bento-small {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
      }
      .bento-card {
        padding: 1.25rem;
        min-height: 140px;
      }
      .bento-title {
        font-size: 16px;
      }
      .bento-desc {
        font-size: 13px;
        margin-bottom: 0.75rem;
      }
      .bento-watermark {
        width: 35%;
        height: 35%;
        bottom: -5%;
        right: -5%;
      }
    }

    /* ==========================================================================
       QUICK SEARCH CARDS
       ========================================================================== */
    .quick-grid { 
      display: grid; 
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
      gap: 16px; 
      margin-bottom: 3.5rem; 
    }
    .quick-card {
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg); 
      padding: 1.5rem;
      cursor: pointer; 
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
      box-shadow: var(--shadow-sm);
      display: flex;
      flex-direction: column;
      height: 100%;
    }
    .quick-card:hover { 
      border-color: var(--apple-grey); 
      box-shadow: var(--shadow-md); 
      transform: translateY(-4px); 
    }
    .qc-icon { 
      font-size: 24px; 
      margin-bottom: 12px; 
      color: var(--accent-gold); 
      line-height: 0;
    }
    .qc-icon svg { 
      width: 26px; 
      height: 26px; 
      display: block; 
    }
    .qc-title { 
      font-size: 15px; 
      font-weight: 600; 
      margin-bottom: 6px; 
      color: var(--apple-dark);
    }
    .qc-arabic { 
      font-family: var(--font-arabic); 
      font-size: 19px; 
      color: var(--accent-gold); 
      direction: rtl; 
      text-align: right;
      margin-top: auto;
      line-height: 1.4;
    }

    /* ==========================================================================
       RESULT CARDS
       ========================================================================== */
    .result-card {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      margin-bottom: 16px;
      overflow: hidden;
      box-shadow: var(--shadow-sm);
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .result-card:hover { 
      box-shadow: var(--shadow-md); 
      border-color: var(--apple-grey); 
    }
    .result-card:has(.card-detail.open) {
      border-color: rgba(184, 134, 11, 0.4);
      box-shadow: var(--shadow-md), 0 0 0 1px rgba(184, 134, 11, 0.15);
    }
    body.dark-theme .result-card:has(.card-detail.open) {
      border-color: rgba(229, 184, 66, 0.45);
    }
    
    .card-header {
      padding: 1.75rem 2rem;
      cursor: pointer; 
      display: flex; 
      gap: 1.5rem; 
      align-items: flex-start;
      transition: background-color 0.2s ease;
    }
    .card-header:hover { 
      background: rgba(245, 245, 247, 0.5); 
    }
    .card-body { 
      flex: 1; 
    }
    .card-meta { 
      display: flex; 
      gap: 8px; 
      flex-wrap: wrap; 
      margin-bottom: 12px; 
      align-items: center; 
    }
    
    /* Badges */
    .badge {
      font-size: 11px; 
      font-weight: 700; 
      padding: 4px 12px;
      border-radius: var(--radius-pill); 
      border: 1px solid transparent;
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }
    .b-sahih { background: #eafbee; color: #1e7e34; border-color: rgba(30, 126, 52, 0.15); }
    .b-hasan { background: #fffbe6; color: #d39e00; border-color: rgba(211, 158, 0, 0.15); }
    .b-dhaif { background: #fdf2f2; color: #dc3545; border-color: rgba(220, 53, 69, 0.15); }
    .b-maudu { background: #f2f2f5; color: #6c757d; border-color: rgba(108, 117, 125, 0.15); }
    .b-hasan-sahih { background: linear-gradient(135deg, #fffbe6, #eafbee); color: #8e7806; border-color: rgba(142, 120, 6, 0.2); }
    .b-src { background: var(--apple-bg); color: var(--apple-grey); border-color: var(--apple-light-grey); }
    
    .hadis-text {
      font-family: var(--font-arabic);
      font-size: 26px; 
      line-height: 1.7;
      direction: rtl; 
      text-align: right;
      color: var(--apple-dark); 
      margin-bottom: 10px;
    }
    .hadis-trans { 
      font-size: 14px; 
      color: var(--apple-grey); 
      font-style: italic; 
      line-height: 1.6; 
    }
    
    .card-toggle { 
      color: var(--apple-grey); 
      flex-shrink: 0; 
      transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
      margin-top: 4px;
    }
    .card-toggle.open { 
      transform: rotate(180deg); 
      color: var(--apple-dark);
    }

    /* ==========================================================================
       TABS SYSTEM (Apple style pill selectors)
       ========================================================================== */
    .card-detail { 
      border-top: 1px solid var(--apple-border); 
      padding: 2rem; 
      display: none; 
      background: var(--card-detail-bg);
    }
    .card-detail.open { 
      display: block; 
    }
    
    .tab-row { 
      display: flex; 
      gap: 6px; 
      margin-bottom: 2rem;
      background: var(--apple-light-grey);
      padding: 4px;
      border-radius: var(--radius-md);
      max-width: fit-content;
    }
    .tab-btn {
      padding: 8px 18px; 
      border-radius: var(--radius-sm);
      font-size: 13px; 
      font-weight: 600; 
      border: none;
      cursor: pointer; 
      background: none; 
      color: var(--apple-grey); 
      transition: all 0.2s ease;
    }
    .tab-btn:hover { 
      color: var(--apple-dark); 
    }
    .tab-btn.active { 
      background: var(--apple-white); 
      color: var(--apple-dark);
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .tab-panel { 
      display: none; 
      animation: fadeIn 0.4s ease;
    }
    .tab-panel.active { 
      display: block; 
    }
    
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Tab: Matan Content */
    .matan-block {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-left: 4px solid var(--accent-gold);
      border-radius: var(--radius-lg);
      padding: 2rem;
      font-family: var(--font-arabic);
      font-size: 30px; 
      line-height: 1.9;
      direction: rtl; 
      text-align: right;
      color: var(--apple-dark); 
      margin-bottom: 1.5rem;
      box-shadow: var(--shadow-sm);
    }
    .trans-block {
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg); 
      padding: 1.5rem 2rem;
      font-size: 15px; 
      line-height: 1.7; 
      color: var(--apple-text-secondary);
      box-shadow: var(--shadow-sm);
    }
    .trans-label { 
      font-size: 11px; 
      font-weight: 700; 
      color: var(--apple-grey); 
      letter-spacing: 0.08em; 
      text-transform: uppercase; 
      margin-bottom: 8px; 
    }

    /* ==========================================================================
       TAB: SANAD INTERACTIVE TREE DIAGRAM
       ========================================================================== */
    .sanad-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      padding: 1rem 0;
      position: relative;
    }
    
    /* Narration direction label */
    .direction-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--apple-grey);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 1.5rem;
      background: var(--apple-white);
      padding: 4px 12px;
      border-radius: var(--radius-pill);
      border: 1px solid var(--apple-border);
    }

    .rawi-node {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md);
      padding: 12px 18px;
      width: 100%;
      max-width: 420px;
      box-shadow: var(--shadow-sm);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      position: relative;
      cursor: pointer;
      transition: all 0.25s ease;
    }
    
    /* Credibility Border and Background Indicators for Rawi Nodes (Light Mode default) */
    .rawi-node.rc-mashum-border {
      border-left: 4px solid #f0a500 !important;
      background: linear-gradient(to right, rgba(240, 165, 0, 0.03), var(--apple-white));
    }
    .rawi-node.rc-sahabat-border {
      border-left: 4px solid var(--accent-gold) !important;
      background: linear-gradient(to right, rgba(184, 134, 11, 0.03), var(--apple-white));
    }
    .rawi-node.rc-tsiqah-border {
      border-left: 4px solid var(--accent-green) !important;
      background: linear-gradient(to right, rgba(26, 71, 42, 0.03), var(--apple-white));
    }
    .rawi-node.rc-shaduq-border {
      border-left: 4px solid var(--accent-blue) !important;
      background: linear-gradient(to right, rgba(0, 102, 204, 0.03), var(--apple-white));
    }
    .rawi-node.rc-dhaif-border {
      border-left: 4px solid #dc3545 !important;
      background: linear-gradient(to right, rgba(220, 53, 69, 0.03), var(--apple-white));
    }
    .rawi-node.rc-imam-border {
      border-left: 4px solid #7048e8 !important;
      background: linear-gradient(to right, rgba(112, 72, 232, 0.03), var(--apple-white));
    }
    
    .rawi-node:hover {
      transform: translateY(-3px);
      box-shadow: 0 8px 20px rgba(184, 134, 11, 0.15);
      border-color: var(--accent-gold) !important;
    }
    
    .rawi-node:hover .rawi-info-icon {
      opacity: 1 !important;
      color: var(--accent-gold);
    }
    
    /* Glowing Connector Lines and Arrows on Rawi Hover */
    .tree-connector:has(+ .rawi-node:hover) .flow-line,
    .rawi-node:hover + .tree-connector .flow-line {
      stroke: var(--accent-gold) !important;
      stroke-width: 3px !important;
      filter: drop-shadow(0 0 3px var(--accent-gold)) !important;
    }
    .tree-connector:has(+ .rawi-node:hover) .flow-arrow,
    .rawi-node:hover + .tree-connector .flow-arrow {
      fill: var(--accent-gold) !important;
      filter: drop-shadow(0 0 3px var(--accent-gold)) !important;
    }
    
    /* Rawi Detail Modal styling */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 99999;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .modal-overlay.active {
      opacity: 1;
      pointer-events: auto;
    }
    .modal-content {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: 20px;
      padding: 24px;
      width: 90%;
      max-width: 460px;
      box-shadow: var(--shadow-lg);
      position: relative;
      transform: translateY(20px);
      transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .modal-overlay.active .modal-content {
      transform: translateY(0);
    }
    .modal-close-btn {
      position: absolute;
      top: 16px;
      right: 16px;
      background: rgba(0,0,0,0.04);
      border: none;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      font-size: 20px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--apple-dark);
      transition: all 0.2s ease;
    }
    .modal-close-btn:hover {
      background: rgba(0,0,0,0.1);
      transform: scale(1.05);
    }
    body.dark-theme .modal-content {
      background: #1c1c1e;
      border-color: rgba(255,255,255,0.1);
    }
    body.dark-theme .modal-close-btn {
      background: rgba(255,255,255,0.08);
      color: #fff;
    }
    body.dark-theme .modal-close-btn:hover {
      background: rgba(255,255,255,0.15);
    }
    
    .rawi-details {
      display: flex;
      flex-direction: column;
      flex: 1.2;
      text-align: left;
      min-width: 0;
    }
    
    .rawi-title-id {
      font-size: 13.5px;
      font-weight: 600;
      color: var(--apple-dark);
      margin-bottom: 3px;
      line-height: 1.35;
      word-break: break-word;
    }
    
    .rawi-role {
      font-size: 11px;
      color: var(--apple-grey);
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }

    .rawi-meta-ar {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 6px;
      flex: 1;
      min-width: 0;
      text-align: right;
    }
    
    .rawi-title-ar {
      font-family: var(--font-arabic);
      font-size: 18px;
      color: var(--accent-green);
      direction: rtl;
      text-align: right;
      line-height: 1.3;
      word-break: break-word;
    }
    
    /* Credibility Badges on Rawi Nodes */
    .rawi-cred {
      font-size: 10px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 6px;
      text-transform: uppercase;
      letter-spacing: 0.02em;
      min-width: 65px;
      text-align: center;
    }
    /* Specific rawi statuses */
    .rc-mashum { background: #fff9db; color: #f0a500; }
    .rc-sahabat { background: var(--accent-gold-light); color: var(--accent-gold); }
    .rc-tsiqah { background: var(--accent-green-light); color: var(--accent-green); }
    .rc-shaduq { background: var(--accent-blue-light); color: var(--accent-blue); }
    .rc-dhaif { background: #fdf2f2; color: #dc3545; }
    .rc-imam { background: #f3f0ff; color: #7048e8; }
    
    /* Animated connection lines */
    .tree-connector {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 32px;
    }
    
    .tree-connector svg {
      overflow: visible;
    }
    
    .flow-line {
      stroke: var(--apple-grey);
      stroke-width: 2px;
      stroke-dasharray: 5 4;
      animation: flowDash 0.8s linear infinite;
      transition: stroke 0.25s ease, stroke-width 0.25s ease, filter 0.25s ease;
    }
    
    .flow-arrow {
      fill: var(--apple-grey);
      transition: fill 0.25s ease, filter 0.25s ease;
    }
    
    @keyframes flowDash {
      to {
        stroke-dashoffset: -18;
      }
    }

    /* Gentle entrance for the sanad chain (respects reduced-motion) */
    @media (prefers-reduced-motion: no-preference) {
      .rawi-node, .tree-connector {
        animation: rawi-fade 0.5s ease both;
      }
      @keyframes rawi-fade {
        from { opacity: 0; }
        to   { opacity: 1; }
      }
    }

    .sanad-info-grid {
      display: grid; 
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
      gap: 12px;
      margin-top: 2rem;
    }
    .sanad-info-cell {
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md); 
      padding: 14px 18px;
      box-shadow: var(--shadow-sm);
    }
    .sanad-info-label { 
      font-size: 11px; 
      font-weight: 600;
      color: var(--apple-grey); 
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 4px; 
    }
    .sanad-info-val { 
      font-size: 15px; 
      font-weight: 600; 
      color: var(--apple-dark); 
    }

    /* ==========================================================================
       TAB: HUKUM & PENILAIAN ULAMA
       ========================================================================== */
    .hukum-top { 
      display: flex; 
      align-items: center; 
      gap: 12px; 
      margin-bottom: 1.5rem; 
    }
    .hukum-desc {
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg); 
      padding: 1.5rem 2rem;
      font-size: 14px; 
      line-height: 1.7; 
      color: var(--apple-text-secondary); 
      margin-bottom: 2rem;
      box-shadow: var(--shadow-sm);
    }
    .ulama-list { 
      display: flex; 
      flex-direction: column; 
      gap: 10px; 
    }
    .ulama-item {
      display: flex; 
      justify-content: space-between; 
      align-items: center;
      padding: 12px 18px;
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-sm);
    }
    .ulama-name { 
      font-size: 14px; 
      font-weight: 600; 
      color: var(--apple-dark);
    }

    /* ==========================================================================
       TAB: MUKHRIJ (Kumpulan Kitab)
       ========================================================================== */
    .mukhrij-list { 
      display: flex; 
      flex-direction: column; 
      gap: 10px; 
    }
    .mukhrij-item {
      display: flex; 
      align-items: center; 
      gap: 16px;
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg); 
      padding: 1.25rem 1.75rem;
      box-shadow: var(--shadow-sm);
    }
    .clickable-mukhrij:hover {
      background: rgba(184, 134, 11, 0.06) !important;
      border-color: rgba(184, 134, 11, 0.35) !important;
      transform: translateX(4px);
    }
    .muk-icon {
      width: 42px; 
      height: 42px; 
      border-radius: var(--radius-md);
      background: var(--apple-bg); 
      display: flex; 
      align-items: center; 
      justify-content: center;
      font-size: 20px; 
      flex-shrink: 0;
      border: 1px solid var(--apple-border);
    }
    .muk-info { 
      flex: 1; 
    }
    .muk-name { 
      font-size: 15px; 
      font-weight: 600; 
      color: var(--apple-dark);
    }
    .muk-detail { 
      font-size: 12.5px; 
      color: var(--apple-grey); 
      margin-top: 2px;
    }
    .muk-link {
      font-size: 12px; 
      color: var(--apple-dark); 
      font-weight: 600;
      text-decoration: none; 
      padding: 8px 16px;
      border: 1px solid var(--apple-dark); 
      border-radius: var(--radius-pill);
      transition: all 0.2s ease;
      background: transparent;
    }
    .muk-link:hover { 
      background: var(--apple-dark);
      color: var(--apple-white);
    }

    /* ==========================================================================
       RESEARCH & UTILITY FEATURES (Bookmarks, Export, Toasts)
       ========================================================================== */
    .bookmark-btn {
      background: transparent;
      border: none;
      color: var(--apple-grey);
      cursor: pointer;
      padding: 6px;
      border-radius: 50%;
      transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .bookmark-btn:hover {
      background: rgba(0, 0, 0, 0.05);
      color: var(--accent-gold);
      transform: scale(1.1);
    }
    .bookmark-btn.active {
      color: var(--accent-gold);
    }
    .bookmark-btn.active svg {
      fill: var(--accent-gold);
    }

    .export-btn {
      padding: 8px 16px;
      border-radius: var(--radius-sm);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      background: var(--apple-white);
      color: var(--apple-dark);
      border: 1px solid var(--apple-border);
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      box-shadow: var(--shadow-sm);
    }
    .export-btn:hover {
      background: var(--apple-light-grey);
      border-color: rgba(0, 0, 0, 0.15);
      transform: translateY(-1px);
    }
    .export-btn:active {
      transform: translateY(0);
    }

    .toast {
      background: rgba(29, 29, 31, 0.92);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      color: var(--apple-white);
      padding: 12px 20px;
      border-radius: var(--radius-md);
      font-size: 13.5px;
      font-weight: 500;
      box-shadow: var(--shadow-lg);
      display: flex;
      align-items: center;
      gap: 10px;
      opacity: 0;
      transform: translateY(20px);
      transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
      pointer-events: auto;
      max-width: 340px;
    }
    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }
    .toast-icon {
      color: var(--accent-gold);
      font-size: 16px;
      flex-shrink: 0;
      line-height: 0;
    }
    .toast-icon svg {
      width: 16px;
      height: 16px;
      display: block;
    }

    /* Virtual Arabic Keyboard Styling */
    .kb-trigger-btn {
      background: none;
      border: none;
      color: var(--apple-grey);
      cursor: pointer;
      padding: 6px;
      margin-right: 6px;
      border-radius: var(--radius-sm);
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .kb-trigger-btn:hover {
      color: var(--apple-dark);
      background: rgba(0, 0, 0, 0.04);
    }
    .kb-trigger-btn.active {
      color: var(--accent-gold);
      background: var(--accent-gold-light);
    }

    .arabic-keyboard-panel {
      background: rgba(255, 255, 255, 0.88);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      padding: 14px;
      margin-top: 12px;
      box-shadow: var(--shadow-md);
      display: flex;
      flex-direction: column;
      gap: 6px;
      max-width: 680px;
      margin-left: auto;
      margin-right: auto;
      animation: slideDownKeyboard 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    
    @keyframes slideDownKeyboard {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    
    .kb-row {
      display: flex;
      gap: 5px;
      justify-content: center;
    }
    
    .kb-key {
      background: var(--apple-white);
      border: 1px solid rgba(0, 0, 0, 0.08);
      border-radius: 6px;
      height: 38px;
      flex: 1;
      min-width: 28px;
      font-size: 13.5px;
      font-weight: 600;
      color: var(--apple-dark);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
      user-select: none;
    }
    
    .kb-key:hover {
      background: var(--apple-light-grey);
      border-color: rgba(0, 0, 0, 0.15);
      transform: translateY(-1px);
    }
    
    .kb-key:active {
      transform: translateY(0);
      background: #dcdce0;
    }
    
    .kb-key.arabic {
      font-family: var(--font-arabic);
      font-size: 19px;
      font-weight: 500;
      padding-top: 2px;
    }
    
    .kb-key-harakat {
      background: var(--accent-green-light);
      color: var(--accent-green);
      border-color: rgba(26, 71, 42, 0.12);
    }
    .kb-key-harakat:hover {
      background: #dfefe4;
    }
    
    .kb-key-space {
      flex: 4.5;
    }
    
    .kb-key-backspace {
      background: #fdf2f2;
      color: #dc3545;
      border-color: rgba(220, 53, 69, 0.12);
    }
    .kb-key-backspace:hover {
      background: #fbe3e3;
    }
    
    .kb-key-clear {
      background: var(--apple-bg);
      color: var(--apple-grey);
    }
    
    .kb-key-close {
      background: var(--apple-dark);
      color: var(--apple-white);
      border-color: var(--apple-dark);
    }
    .kb-key-close:hover {
      background: #333336;
    }

    /* Highlighter (Stabilo) Styling */
    mark.highlight {
      background-color: rgba(254, 249, 236, 1);
      border-bottom: 2px solid rgba(184, 134, 11, 0.5);
      color: inherit;
      border-radius: 2px;
      padding: 0 1px;
      font-weight: inherit;
    }

    /* Personal Study Notes Styling */
    .notes-textarea {
      width: 100%;
      height: 80px;
      padding: 12px;
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md);
      background: var(--apple-white);
      color: var(--apple-dark);
      font-family: var(--font-latin);
      font-size: 13.5px;
      resize: vertical;
      outline: none;
      transition: all 0.2s ease;
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
      margin-top: 8px;
    }
    .notes-textarea:focus {
      border-color: var(--accent-gold);
      box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.12);
    }

    /* ==========================================================================
       SHIMMER ANIMATION & LOADING SKELETON
       ========================================================================== */
    .loading-container {
      display: none;
      padding: 2rem 0;
    }
    
    .skeleton-card {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      padding: 2rem;
      margin-bottom: 16px;
      box-shadow: var(--shadow-sm);
    }
    
    .shimmer {
      background: linear-gradient(90deg, #eff1f3 25%, #e2e8f0 37%, #eff1f3 63%);
      background-size: 400% 100%;
      animation: skeleton-shimmer 1.4s ease infinite;
      border-radius: 4px;
    }
    
    @keyframes skeleton-shimmer {
      0% {
        background-position: -200% 0;
      }
      100% {
        background-position: 200% 0;
      }
    }
    
    .sk-badge { width: 70px; height: 18px; border-radius: var(--radius-pill); margin-bottom: 15px; }
    .sk-text-1 { width: 90%; height: 32px; margin-left: auto; margin-bottom: 10px; border-radius: 6px; }
    .sk-text-2 { width: 60%; height: 32px; margin-left: auto; margin-bottom: 20px; border-radius: 6px; }
    .sk-trans-1 { width: 100%; height: 16px; margin-bottom: 8px; }
    .sk-trans-2 { width: 75%; height: 16px; }

    /* Empty search view styling */
    .empty { 
      text-align: center; 
      padding: 5rem 1.5rem; 
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-sm);
    }
    .empty-icon { 
      font-size: 54px; 
      margin-bottom: 1.5rem; 
      opacity: 0.15; 
    }
    .empty h3 { 
      font-size: 18px; 
      font-weight: 600; 
      margin-bottom: 8px; 
    }
    .empty p { 
      font-size: 14px; 
      color: var(--apple-grey); 
    }

    /* ==========================================================================
       POJOK ILMU (Trivia Widget)
       ========================================================================== */
    .trivia-card {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      padding: 1.25rem 1.5rem;
      box-shadow: var(--shadow-sm);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1.5rem;
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
      position: relative;
      overflow: hidden;
    }
    .trivia-card:hover {
      box-shadow: var(--shadow-md);
      border-color: rgba(0, 0, 0, 0.1);
    }
    .trivia-content-wrap {
      flex: 1;
      transition: opacity 0.3s ease, transform 0.3s ease;
      opacity: 1;
      transform: translateY(0);
    }
    .trivia-text {
      font-size: 15.5px;
      color: var(--apple-dark);
      line-height: 1.75;
      font-weight: 500;
    }
    .trivia-source {
      font-size: 11px;
      font-weight: 700;
      color: var(--accent-gold);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-top: 12px;
    }
    .trivia-btn {
      background: var(--apple-bg);
      color: var(--apple-dark);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-pill);
      padding: 10px 22px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
      box-shadow: var(--shadow-sm);
    }
    .trivia-btn:hover {
      background: var(--apple-dark);
      color: var(--apple-white);
      border-color: var(--apple-dark);
      transform: scale(1.02);
    }
    .trivia-btn:active {
      transform: scale(0.98);
    }

    /* ==========================================================================
       TENTANG KAMI PAGE (Editorial Apple style)
       ========================================================================== */
    .about-wrap { 
      max-width: 760px; 
      margin: 0 auto; 
      padding: 4rem 1.5rem; 
    }
    .about-header {
      text-align: center;
      margin-bottom: 4rem;
    }
    .about-header h1 {
      font-size: 40px;
      font-weight: 700;
      letter-spacing: -0.025em;
      margin-bottom: 1rem;
    }
    .about-header p {
      font-size: 18px;
      color: var(--apple-grey);
      max-width: 560px;
      margin: 0 auto;
      line-height: 1.5;
    }
    
    .about-section {
      background: var(--apple-white); 
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg); 
      padding: 2.5rem; 
      margin-bottom: 2rem;
      box-shadow: var(--shadow-sm);
    }
    .about-section h2 { 
      font-size: 22px; 
      font-weight: 700; 
      margin-bottom: 1rem; 
      letter-spacing: -0.015em;
    }
    .about-section h3 { 
      font-size: 16px; 
      font-weight: 600; 
      color: var(--accent-green); 
    }
    .about-section p { 
      font-size: 15px; 
      line-height: 1.7; 
      color: var(--apple-text-secondary); 
      margin-bottom: 1.25rem; 
    }
    .about-section p:last-child {
      margin-bottom: 0;
    }
    
    /* Method list cards inside about page */
    .method-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin: 1.5rem 0;
    }
    .method-card {
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md);
      padding: 1.25rem;
      background: var(--apple-bg);
    }
    .method-num {
      font-size: 20px;
      font-weight: 700;
      color: var(--apple-dark);
      margin-bottom: 6px;
    }
    .method-card h4 {
      font-size: 14px;
      font-weight: 600;
      margin-bottom: 4px;
      color: var(--apple-dark);
    }
    .method-card p {
      font-size: 12px;
      color: var(--apple-grey);
      line-height: 1.5;
    }

    /* Terminology Grid */
    .istilah-grid { 
      display: grid; 
      grid-template-columns: 1fr 1fr; 
      gap: 12px; 
      margin-top: 1.5rem;
    }
    .istilah-box {
      padding: 16px; 
      border-radius: var(--radius-md); 
      border: 1px solid var(--apple-border); 
      background: var(--apple-bg);
      transition: transform 0.2s ease;
    }
    .istilah-box:hover {
      transform: translateY(-2px);
    }
    .istilah-ar { 
      font-family: var(--font-latin); 
      font-size: 14px; 
      color: var(--apple-dark); 
      font-weight: 700; 
    }
    .istilah-ar span {
      font-family: var(--font-arabic);
      font-size: 20px;
      color: var(--accent-green);
      margin-left: 6px;
      font-weight: 500;
    }
    .istilah-desc { 
      font-size: 12px; 
      color: var(--apple-grey); 
      margin-top: 6px; 
      line-height: 1.5; 
    }

    .source-row { 
      display: flex; 
      flex-direction: column; 
      gap: 12px; 
      margin-top: 1rem;
    }
    .src-item {
      display: flex; 
      align-items: flex-start; 
      gap: 14px;
      padding: 14px 18px;
      background: var(--apple-bg); 
      border-radius: var(--radius-md);
      border: 1px solid var(--apple-border);
    }
    .src-dot { 
      width: 8px; 
      height: 8px; 
      border-radius: var(--radius-pill); 
      background: var(--apple-dark); 
      margin-top: 6px; 
      flex-shrink: 0; 
    }
    .src-text { 
      font-size: 13.5px; 
      color: var(--apple-text-secondary); 
      line-height: 1.6; 
    }
    .src-text strong { 
      color: var(--apple-dark); 
    }

    /* ==========================================================================
       PAGINATION & FOOTER
       ========================================================================== */
    .pagination { 
      display: flex; 
      justify-content: center; 
      gap: 6px; 
      margin-top: 2rem; 
    }
    .pg-btn {
      padding: 8px 16px; 
      border-radius: var(--radius-pill);
      border: 1px solid var(--apple-border); 
      font-size: 13px;
      font-weight: 600;
      background: var(--apple-white); 
      color: var(--apple-grey); 
      cursor: pointer;
      transition: all 0.2s ease;
      box-shadow: var(--shadow-sm);
    }
    .pg-btn.active { 
      background: var(--apple-dark); 
      color: var(--apple-white); 
      border-color: var(--apple-dark); 
    }
    .pg-btn:hover:not(.active) { 
      background: var(--apple-light-grey); 
      color: var(--apple-dark);
    }

    .api-notice {
      background: #fffbeb; 
      border: 1px solid rgba(211, 158, 0, 0.2);
      border-radius: var(--radius-md); 
      padding: 12px 16px; 
      margin-bottom: 1.5rem;
      font-size: 13px; 
      color: #7d5a00;
      font-weight: 500;
    }
    
    .footer {
      background: var(--apple-white);
      border-top: 1px solid var(--apple-border);
      padding: 3.5rem 1.5rem;
      text-align: center;
      margin-top: auto;
      font-size: 12px;
      color: var(--apple-grey);
    }

    /* Theme Toggle Button Styles */
    .theme-toggle-btn {
      background: none;
      border: none;
      color: var(--apple-grey);
      cursor: pointer;
      width: 38px;
      height: 38px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .theme-toggle-btn:hover {
      background: rgba(0, 0, 0, 0.05);
      color: var(--apple-dark);
    }
    body.dark-theme .theme-toggle-btn:hover {
      background: rgba(255, 255, 255, 0.05);
      color: var(--apple-dark);
    }
    .sun-icon { stroke: var(--apple-dark); }
    .moon-icon { stroke: var(--apple-grey); }
    
    body.dark-theme .sun-icon { display: block; }
    body.dark-theme .moon-icon { display: none; }
    body:not(.dark-theme) .sun-icon { display: none; }
    body:not(.dark-theme) .moon-icon { display: block; }

    /* Dark Mode Badge Overrides */
    body.dark-theme .b-sahih { background: #162f1c !important; color: #51c472 !important; border-color: rgba(81, 196, 114, 0.2) !important; }
    body.dark-theme .b-hasan { background: #2f2816 !important; color: #ecc448 !important; border-color: rgba(236, 196, 72, 0.2) !important; }
    body.dark-theme .b-dhaif { background: #3c1e1e !important; color: #ff6b6b !important; border-color: rgba(255, 107, 107, 0.2) !important; }
    body.dark-theme .b-maudu { background: #242426 !important; color: #a1a1a6 !important; border-color: rgba(161, 161, 166, 0.2) !important; }
    body.dark-theme .b-hasan-sahih { background: linear-gradient(135deg, #2f2816, #162f1c) !important; color: #dfbe59 !important; border-color: rgba(223, 190, 89, 0.2) !important; }
    body.dark-theme .api-notice { background: #2c2516 !important; color: #e5b842 !important; border-color: rgba(229, 184, 66, 0.2) !important; }

    /* Dark Mode Rawi Node Background overrides */
    body.dark-theme .rawi-node.rc-mashum-border { background: linear-gradient(to right, rgba(240, 165, 0, 0.08), var(--apple-white)) !important; }
    body.dark-theme .rawi-node.rc-sahabat-border { background: linear-gradient(to right, rgba(229, 184, 66, 0.08), var(--apple-white)) !important; }
    body.dark-theme .rawi-node.rc-tsiqah-border { background: linear-gradient(to right, rgba(72, 160, 106, 0.08), var(--apple-white)) !important; }
    body.dark-theme .rawi-node.rc-shaduq-border { background: linear-gradient(to right, rgba(77, 163, 255, 0.08), var(--apple-white)) !important; }
    body.dark-theme .rawi-node.rc-dhaif-border { background: linear-gradient(to right, rgba(255, 107, 107, 0.08), var(--apple-white)) !important; }
    body.dark-theme .rawi-node.rc-imam-border { background: linear-gradient(to right, rgba(112, 72, 232, 0.08), var(--apple-white)) !important; }

    /* Dark Mode Rawi Credibility Badges overrides */
    body.dark-theme .rc-mashum { background: #2f2509 !important; color: #ecc448 !important; }
    body.dark-theme .rc-dhaif { background: #3c1e1e !important; color: #ff6b6b !important; }
    body.dark-theme .rc-imam { background: #20134a !important; color: #9c82f2 !important; }
    body.dark-theme .rc-sahabat { background: #2f2816 !important; color: #ecc448 !important; }
    body.dark-theme .rc-tsiqah { background: #162f1c !important; color: #51c472 !important; }
    body.dark-theme .rc-shaduq { background: #12253a !important; color: #4da3ff !important; }

    body.dark-theme .mobile-bottom-nav { background: rgba(29, 29, 31, 0.88) !important; }

    /* Dark Mode Highlighter Override */
    body.dark-theme mark.highlight {
      background-color: rgba(229, 184, 66, 0.35) !important;
      color: #ffffff !important;
      border-bottom: 2px solid rgba(229, 184, 66, 0.75) !important;
    }

    /* Dark Mode Virtual Keyboard Overrides */
    body.dark-theme .arabic-keyboard-panel {
      background: rgba(29, 29, 31, 0.88);
      border-color: rgba(255, 255, 255, 0.1);
    }
    body.dark-theme .kb-key {
      background: #2c2c2e;
      border-color: rgba(255, 255, 255, 0.05);
      color: #ffffff;
    }
    body.dark-theme .kb-key:hover {
      background: #3a3a3c;
    }
    body.dark-theme .kb-key:active {
      background: #48484a;
    }
    body.dark-theme .kb-key-space {
      background: #2c2c2e;
    }
    body.dark-theme .kb-key-backspace {
      background: #4a1d1d;
      color: #ff6b6b;
    }
    body.dark-theme .kb-key-clear {
      background: #3a3a3c;
      color: #aeaeb2;
    }
    body.dark-theme .kb-key-close {
      background: #ffffff;
      color: #121214;
    }
    body.dark-theme .kb-key-close:hover {
      background: #e8e8ed !important;
    }

    .mobile-bottom-nav {
      display: none;
    }

    /* ==========================================================================
       MEDIA QUERIES (Ultra responsive tuning)
       ========================================================================== */
    @media (max-width: 768px) {
      .header { 
        padding: 0 1.25rem; 
      }
      .hero { 
        padding: 4rem 1.25rem 3rem; 
      }
      .hero h1 { 
        font-size: 32px; 
      }
      .hero-arabic { 
        font-size: 28px; 
      }
      .stats-row { 
        gap: 1.5rem; 
        flex-wrap: wrap;
      }
      .stat:not(:last-child)::after {
        display: none;
      }
      .quick-grid { 
        grid-template-columns: 1fr; 
      }
      .istilah-grid, .method-grid { 
        grid-template-columns: 1fr; 
      }
      .nav a { 
        padding: 6px 12px; 
        font-size: 13px; 
      }
      .card-header {
        padding: 1.25rem 1.5rem;
        gap: 1rem;
      }
      .hadis-text {
        font-size: 22px;
      }
      .card-detail {
        padding: 1.25rem;
      }
      .tab-row {
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -ms-overflow-style: none;
        scrollbar-width: none;
      }
      .tab-row::-webkit-scrollbar {
        display: none;
      }
      .tab-btn {
        padding: 6px 12px;
        font-size: 12px;
      }
      .rawi-node {
        max-width: 100%;
      }
      .about-section {
        padding: 1.5rem;
      }
      .trivia-card {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 1.5rem;
      }
      .trivia-btn {
        align-self: flex-start;
      }
    }

    @media (max-width: 576px) {
      .header {
        justify-content: space-between !important;
        padding: 0 16px !important;
        height: 56px;
      }
      .header .nav {
        display: none !important;
      }
      .theme-toggle-btn {
        position: static !important;
      }
      .logo {
        max-width: calc(100% - 60px) !important;
      }
      .logo-tagline {
        font-size: 8.5px !important;
        letter-spacing: 0.01em !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-top: 1px solid var(--apple-border);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
      }
      .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--apple-grey);
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        gap: 3px;
        flex: 1;
        height: 100%;
        transition: all 0.2s ease;
      }
      .mobile-bottom-nav a svg {
        transition: transform 0.2s ease;
        stroke: var(--apple-grey);
      }
      .mobile-bottom-nav a.active {
        color: var(--apple-dark);
      }
      .mobile-bottom-nav a.active svg {
        transform: scale(1.05);
        stroke: var(--apple-dark);
      }
      body {
        padding-bottom: 72px;
      }
      .main {
        padding: 1.5rem 1rem !important;
      }
      .hero {
        padding: 3rem 1rem 2rem;
      }
      .hero h1 {
        font-size: 28px;
      }
      .hero-arabic {
        font-size: 21px !important;
        line-height: 1.5 !important;
        margin-bottom: 1rem !important;
        direction: rtl !important;
        font-weight: 500;
      }
      .hero p {
        font-size: 14.5px;
        margin-bottom: 2rem;
      }
      .sticky-search-container {
        top: 56px !important;
        padding: 1rem 0 !important;
        margin-bottom: 1.5rem !important;
      }
      .sticky-search-container > div {
        padding: 0 1rem !important;
      }
      .search-box {
        padding: 4px 6px 4px 12px !important;
        border-radius: var(--radius-md) !important;
      }
      .search-input {
        font-size: 15px !important;
        padding: 8px 6px !important;
      }
      .search-input:focus:not(:placeholder-shown),
      .search-input:not(:placeholder-shown) {
        font-size: 18px !important;
        padding: 4px 6px !important;
      }
      .search-btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
        border-radius: var(--radius-sm) !important;
      }
      .kb-trigger-btn {
        margin-right: 2px !important;
        padding: 4px !important;
      }
      .filter-row {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        overflow-x: auto;
        padding: 4px 1rem !important;
        margin-left: -1rem !important;
        margin-right: -1rem !important;
        -ms-overflow-style: none;
        scrollbar-width: none;
      }
      .filter-row::-webkit-scrollbar {
        display: none;
      }
      .filter-row .chip {
        flex-shrink: 0;
      }
      .stats-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
        margin-top: 2rem !important;
      }
      .stat:not(:last-child)::after {
        display: none;
      }
      .quick-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 2rem !important;
      }
      .quick-card {
        padding: 1rem !important;
      }
      .qc-icon {
        font-size: 20px !important;
        margin-bottom: 8px !important;
      }
      .qc-title {
        font-size: 13px !important;
      }
      .qc-arabic {
        font-size: 15px !important;
      }
      .trivia-card {
        padding: 1.25rem !important;
      }
      .trivia-text {
        font-size: 14px !important;
        line-height: 1.6 !important;
      }
      .trivia-btn {
        align-self: stretch !important;
        text-align: center;
        font-size: 12.5px !important;
        padding: 8px 16px !important;
      }
      .about-wrap {
        padding: 2rem 1rem !important;
      }
      .about-header {
        margin-bottom: 2rem !important;
      }
      .about-header h1 {
        font-size: 28px !important;
      }
      .about-header p {
        font-size: 15px !important;
      }
      .about-section {
        padding: 1.25rem !important;
        margin-bottom: 1.25rem !important;
      }
      .about-section h2 {
        font-size: 18px !important;
      }
      .method-grid {
        margin: 1rem 0 !important;
        gap: 12px !important;
        grid-template-columns: 1fr !important;
      }
      .method-card {
        padding: 1rem !important;
      }
      .istilah-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
      }
      .istilah-box {
        padding: 12px !important;
      }
      .card-header {
        padding: 0.75rem 1rem !important;
        gap: 12px !important;
      }
      .card-actions {
        gap: 8px !important;
        padding-top: 2px !important;
      }
      .hadis-text {
        font-size: 19px !important;
        line-height: 1.6 !important;
      }
      .hadis-trans {
        font-size: 13px !important;
      }
      .card-detail {
        padding: 1rem !important;
      }
      .card-detail > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        margin-bottom: 1.25rem !important;
      }
      .export-btn {
        width: 100%;
        justify-content: center;
        font-size: 12px !important;
        padding: 8px 16px !important;
      }
      .matan-block {
        font-size: 21px !important;
        line-height: 1.7 !important;
        padding: 1.25rem !important;
      }
      .trans-block {
        padding: 1.25rem !important;
        font-size: 13.5px !important;
      }
      .arabic-keyboard-panel {
        padding: 8px !important;
        gap: 4px !important;
        margin-top: 8px !important;
        border-radius: var(--radius-md) !important;
      }
      .kb-row {
        gap: 3px !important;
      }
      .kb-key {
        height: 32px !important;
        font-size: 11px !important;
        min-width: 0 !important;
        border-radius: 4px !important;
      }
      .kb-key.arabic {
        font-size: 15px !important;
        padding-top: 0 !important;
      }
      .kb-key-space {
        flex: 3 !important;
      }
      .hide-mobile {
        display: none !important;
}
      .pg-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
      }
    }

    /* ==========================================================================
       PENJELAJAH KITAB (Book Explorer) STYLES
       ========================================================================== */
    .book-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 20px;
      margin-bottom: 2.5rem;
    }
    .book-card {
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-lg);
      padding: 1.75rem;
      box-shadow: var(--shadow-sm);
      display: flex;
      flex-direction: column;
      gap: 12px;
      transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .book-card:hover {
      border-color: var(--apple-grey);
      box-shadow: var(--shadow-md);
      transform: translateY(-4px);
    }
    .book-header-row {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .book-icon {
      font-size: 24px;
      width: 46px;
      height: 46px;
      background: var(--apple-light-grey);
      border-radius: var(--radius-md);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    body.dark-theme .book-icon {
      background: #2c2c2e;
    }
    .book-meta {
      display: flex;
      flex-direction: column;
    }
    .book-title {
      font-size: 15.5px;
      font-weight: 700;
      color: var(--apple-dark);
      letter-spacing: -0.01em;
    }
    .book-count {
      font-size: 11.5px;
      color: var(--apple-grey);
      font-weight: 500;
      margin-top: 1px;
    }
    .hadith-num-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 8px;
      padding-top: 12px;
      border-top: 1px dashed var(--apple-border);
    }
    .hadith-num-btn {
      padding: 5px 11px;
      background: var(--apple-bg);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-pill);
      font-size: 11px;
      font-weight: 600;
      color: var(--apple-dark);
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .hadith-num-btn:hover {
      background: var(--apple-dark);
      color: var(--apple-white);
      border-color: var(--apple-dark);
      transform: scale(1.05);
    }
    .hadith-num-btn:active {
      transform: scale(0.95);
    }

    /* Klikabilitas Kartu Kitab & Hover effects */
    .book-card.clickable {
      cursor: pointer;
    }
    .book-card.clickable:hover {
      border-color: var(--apple-grey);
      box-shadow: var(--shadow-md);
      transform: translateY(-4px);
    }
    .book-card-action {
      margin-top: auto;
      font-size: 12px;
      font-weight: 600;
      color: var(--apple-blue);
      display: flex;
      align-items: center;
      gap: 4px;
      transition: gap 0.2s ease;
    }
    .book-card.clickable:hover .book-card-action {
      gap: 8px;
    }
    
    /* Detail Panel & Header */
    .book-detail-header {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-bottom: 2rem;
    }
    .book-detail-meta {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 0.5rem;
    }
    .book-detail-title {
      font-size: 24px;
      font-weight: 800;
      color: var(--apple-dark);
      letter-spacing: -0.02em;
    }
    .book-detail-count {
      font-size: 13px;
      color: var(--apple-grey);
      font-weight: 500;
      background: var(--apple-light-grey);
      padding: 4px 10px;
      border-radius: var(--radius-pill);
    }
    body.dark-theme .book-detail-count {
      background: #2c2c2e;
    }
    
    /* Tombol Kembali */
    .back-btn-container {
      display: flex;
      margin-bottom: 0.5rem;
    }
    .back-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md);
      font-size: 13px;
      font-weight: 600;
      color: var(--apple-grey);
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .back-btn:hover {
      background: var(--apple-bg);
      color: var(--apple-dark);
      border-color: var(--apple-grey);
      transform: translateX(-2px);
    }
    .back-btn:active {
      transform: translateX(0) scale(0.98);
    }
    
    /* Kolom Pencarian Detail Kitab */
    .book-search-container {
      position: relative;
      margin-bottom: 1.5rem;
      max-width: 480px;
    }
    .book-search-input {
      width: 100%;
      padding: 12px 16px 12px 42px;
      background: var(--apple-white);
      border: 1px solid var(--apple-border);
      border-radius: var(--radius-md);
      font-size: 14px;
      color: var(--apple-dark);
      font-family: inherit;
      outline: none;
      transition: all 0.2s ease;
    }
    .book-search-input:focus {
      border-color: var(--apple-blue);
      box-shadow: 0 0 0 4px rgba(0, 125, 250, 0.1);
    }
    .book-search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 16px;
      color: var(--apple-grey);
      pointer-events: none;
    }
    
    /* State Kosong untuk Pencarian */
    .empty-search-state {
      padding: 3rem 1.5rem;
      text-align: center;
      background: var(--apple-white);
      border: 1px dashed var(--apple-border);
      border-radius: var(--radius-lg);
      margin-top: 1rem;
    }
    .empty-search-icon {
      font-size: 32px;
      margin-bottom: 0.75rem;
    }
    .empty-search-state h4 {
      font-size: 16px;
      font-weight: 700;
      color: var(--apple-dark);
      margin: 0 0 6px 0;
    }
    .empty-search-state p {
      font-size: 13px;
      color: var(--apple-grey);
      margin: 0;
    }
    @media (max-width: 768px) {
      .show-on-mobile-only {
        display: flex !important;
      }
      .hide-mobile {
        display: none !important;
      }
    }

/* --- Style Block 2 --- */
@media (max-width: 480px) {
      .rawi-node {
        padding: 10px 12px !important;
        gap: 10px !important;
      }
      .rawi-title-id {
        font-size: 12px !important;
        line-height: 1.3 !important;
      }
      .rawi-role {
        font-size: 9px !important;
      }
      .rawi-meta-ar {
        gap: 4px !important;
      }
      .rawi-title-ar {
        font-size: 15px !important;
        line-height: 1.25 !important;
      }
      .rawi-cred {
        font-size: 9px !important;
        min-width: 58px !important;
        padding: 2px 6px !important;
      }
      .mukhrij-item {
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        gap: 10px 12px !important;
        padding: 1rem !important;
      }
      .muk-icon {
        grid-column: 1;
        grid-row: 1;
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
      }
      .muk-info {
        grid-column: 2;
        grid-row: 1;
      }
      .muk-name {
        font-size: 13.5px !important;
      }
      .muk-detail {
        font-size: 11.5px !important;
      }
      .muk-link {
        grid-column: 1 / span 2;
        grid-row: 2;
        text-align: center;
        width: 100%;
        font-size: 11px !important;
        padding: 6px 12px !important;
      }
    }

/* --- Style Block 3 --- */
@keyframes db-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* Responsive Loading Widget for Mobile */
@media (max-width: 768px) {
  #db-loading-overlay {
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    bottom: 80px !important;
  }
}
/* Dark Mode loading adjustments */
body.dark-theme #db-loading-overlay {
  background: rgba(28, 28, 30, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}
body.dark-theme #db-loading-icon-box {
  background: #f5f5f7 !important;
  color: #1d1d1f !important;
}
body.dark-theme #db-loading-icon-box .db-spinner {
  border-top-color: #1d1d1f !important;
}
body.dark-theme #db-loading-title {
  color: #f5f5f7 !important;
}
body.dark-theme #db-loading-status {
  color: #aeaeb2 !important;
}
body.dark-theme #db-loading-percent {
  color: #aeaeb2 !important;
}
body.dark-theme #db-loading-bar {
  background: #f5f5f7 !important;
}

/* ==========================================================================
   PREMIUM GLASSMORPHISM & DYNAMIC BACKGROUND GLOWS (ILHA24 Edition)
   ========================================================================== */
body::before {
  content: '';
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(184, 134, 11, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
  top: -100px;
  left: -100px;
  z-index: -1;
  pointer-events: none;
  filter: blur(60px);
  animation: glowPulse1 15s infinite alternate ease-in-out;
}
body::after {
  content: '';
  position: fixed;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(26, 71, 42, 0.06) 0%, rgba(255, 255, 255, 0) 70%);
  bottom: -150px;
  right: -150px;
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
  animation: glowPulse2 20s infinite alternate ease-in-out;
}
body.dark-theme::before {
  background: radial-gradient(circle, rgba(229, 184, 66, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
}
body.dark-theme::after {
  background: radial-gradient(circle, rgba(72, 160, 106, 0.04) 0%, rgba(0, 0, 0, 0) 70%);
}
@keyframes glowPulse1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(120px, 60px) scale(1.25); }
}
@keyframes glowPulse2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-100px, -80px) scale(1.2); }
}

/* Glassmorphic elements */
.result-card, .quick-card, .book-card, .search-box {
  background: rgba(255, 255, 255, 0.65) !important;
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid rgba(0, 0, 0, 0.07) !important;
}
body.dark-theme .result-card, body.dark-theme .quick-card, body.dark-theme .book-card, body.dark-theme .search-box {
  background: rgba(29, 29, 31, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
}

/* Premium card hover state */
.result-card:hover, .quick-card:hover, .book-card:hover {
  background: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(184, 134, 11, 0.35) !important;
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(184, 134, 11, 0.08), var(--shadow-md) !important;
}
body.dark-theme .result-card:hover, body.dark-theme .quick-card:hover, body.dark-theme .book-card:hover {
  background: rgba(44, 44, 46, 0.82) !important;
  border-color: rgba(229, 184, 66, 0.35) !important;
  box-shadow: 0 12px 30px rgba(229, 184, 66, 0.08), var(--shadow-md) !important;
}

/* Entering animation for grids and lists */
@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.result-card, .quick-card, .book-card {
  animation: cardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Subtle glassmorphism and glowing hover for narrator nodes */
.rawi-node {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --- Style Block 4 --- */
.sim-grid {
        display: grid; 
        grid-template-columns: 1.2fr 1fr; 
        gap: 24px; 
        align-items: start;
      }
      .musthalah-btn {
        text-align: left; 
        padding: 12px 14px; 
        border-radius: 8px; 
        border: 1px solid var(--apple-border); 
        background: var(--apple-white); 
        color: var(--apple-dark); 
        font-size: 13.5px; 
        font-weight: 600; 
        cursor: pointer; 
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
      .musthalah-btn:hover {
        border-color: var(--accent-gold);
        background: rgba(184, 134, 11, 0.02);
      }
      .musthalah-btn.active {
        border-color: var(--accent-gold);
        background: rgba(184, 134, 11, 0.06);
        color: var(--accent-gold);
      }
      .sim-visualizer {
        background: rgba(0,0,0,0.01); 
        border: 1px solid var(--apple-border); 
        border-radius: var(--radius-md); 
        padding: 1.5rem; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        justify-content: center; 
        min-height: 380px; 
        position: relative; 
        overflow: hidden;
      }
      .sim-node {
        border-radius: 8px; 
        padding: 8px 14px; 
        font-size: 12px; 
        text-align: center; 
        width: 170px; 
        font-weight: 600; 
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
        z-index: 2;
      }
      .sim-node-connected {
        background: var(--apple-white);
        border: 2px solid #2ecc71; 
        color: var(--apple-dark);
      }
      .sim-node-disconnected {
        background: rgba(231, 76, 60, 0.03); 
        border: 2px dashed #e74c3c; 
        color: var(--apple-grey);
        opacity: 0.6;
      }
      .sim-conn {
        height: 28px; 
        width: 2px; 
        transition: all 0.3s ease;
        z-index: 1;
      }
      .sim-conn-connected {
        background: #2ecc71;
        box-shadow: 0 0 4px rgba(46, 204, 113, 0.2);
      }
      .sim-conn-disconnected {
        background: transparent;
        border-left: 2px dashed #e74c3c;
      }
      @media (max-width: 768px) {
        .sim-grid {
          grid-template-columns: 1fr;
          gap: 16px;
        }
        .sim-visualizer {
          min-height: 340px;
          padding: 1rem;
        }
      }

/* ==========================================================================
   ADDITIONAL APP FEATURES (PWA, TTS, SEARCH HISTORY CHIPS)
   ========================================================================== */

.history-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--apple-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-chip:hover {
  background: var(--apple-dark);
  color: var(--apple-white);
  border-color: var(--apple-dark);
  transform: translateY(-1px);
}

body.dark-theme .history-chip {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--apple-white);
}

body.dark-theme .history-chip:hover {
  background: var(--apple-white);
  color: var(--apple-dark);
  border-color: var(--apple-white);
}

.clear-history-btn:hover {
  opacity: 0.8;
}

.clear-btn:hover {
  color: var(--apple-dark) !important;
  opacity: 1;
}

body.dark-theme .clear-btn:hover {
  color: var(--apple-white) !important;
}

/* ==========================================================================
   DESKTOP SIDEBAR LAYOUT REDESIGN
   ========================================================================== */
@media (min-width: 769px) {
  .header {
    position: fixed !important;
    left: 20px !important;
    top: 20px !important;
    bottom: 20px !important;
    width: 240px !important;
    height: auto !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 2rem 1.25rem !important;
    border: 1px solid var(--apple-border) !important;
    border-radius: 24px !important;
    z-index: 1000 !important;
    gap: 2rem !important;
    background: var(--header-bg) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02) !important;
  }
  
  /* Target the wrapper div that holds nav & theme toggle */
  .header > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1.5rem !important;
    width: 100% !important;
    height: calc(100% - 50px) !important;
    margin-top: 0.5rem !important;
  }
  
  .header .nav {
    flex-direction: column !important;
    width: 100% !important;
    gap: 6px !important;
  }
  
  .header .nav a {
    display: flex !important;
    align-items: center !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
  }
  
  .header .nav a.active {
    color: var(--apple-white) !important;
    background: var(--apple-dark) !important;
    box-shadow: var(--shadow-sm) !important;
  }
  
  .header .theme-toggle-btn {
    margin-top: auto !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid var(--apple-border) !important;
    background: var(--apple-white) !important;
    color: var(--apple-dark) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }
  
  body.dark-theme .header .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--apple-white) !important;
  }
  
  /* Page & layout alignment to the right of sidebar */
  .page {
    margin-left: 280px !important;
    margin-right: auto !important;
    max-width: 960px !important;
    padding: 2rem 2rem !important;
    width: auto !important;
  }
  
  /* Make the hero a gorgeous glassmorphic banner card */
  .hero {
    padding: 4rem 2rem 3rem !important;
    border-radius: 24px !important;
    border: 1px solid var(--apple-border) !important;
    background: rgba(255, 255, 255, 0.35) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: var(--shadow-sm) !important;
    margin-bottom: 2.5rem !important;
  }
  body.dark-theme .hero {
    background: rgba(29, 29, 31, 0.35) !important;
  }
  
  .sticky-search-container {
    top: 20px !important;
    background: rgba(245, 245, 247, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    margin-bottom: 2rem !important;
    border-radius: 16px !important;
    padding: 1rem 1.5rem !important;
    border: 1px solid var(--apple-border) !important;
    box-shadow: var(--shadow-sm) !important;
  }
  
  body.dark-theme .sticky-search-container {
    background: rgba(18, 18, 20, 0.85) !important;
  }
  
  .footer {
    margin-left: 280px !important;
    padding: 2.5rem 0 !important;
    border-top: 1px solid var(--apple-border) !important;
  }
}

