    /* ===== ROOT ===== */
    * { margin: 0; padding: 0; box-sizing: border-box; }
    :root {
      --primary: #0a1e3d;
      --primary-light: #1e4a7a;
      --primary-gradient: linear-gradient(145deg, #0a1e3d, #2a6a9a);
      --accent: #f5b342;
      --bg-body: #f0f4fa;
      --bg-card: #ffffff;
      --text-primary: #0a1e3d;
      --text-secondary: #3a4e6b;
      --text-muted: #6a7e9a;
      --border-light: rgba(10, 30, 61, 0.06);
      --shadow-sm: 0 4px 20px rgba(10, 30, 61, 0.04);
      --shadow-md: 0 12px 40px rgba(10, 30, 61, 0.06);
      --shadow-lg: 0 24px 60px rgba(10, 30, 61, 0.08);
      --shadow-xl: 0 32px 80px rgba(10, 30, 61, 0.12);
      --radius: 20px;
      --radius-sm: 12px;
      --transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
      --font: 'Cairo', sans-serif;
    }
    body {
      font-family: var(--font);
      background: var(--bg-body);
      color: var(--text-primary);
      line-height: 1.7;
      transition: background 0.4s, color 0.4s;
    }
    body.night-mode {
      --bg-body: #0d1421;
      --bg-card: #162035;
      --text-primary: #e8edf5;
      --text-secondary: #a0b3cc;
      --text-muted: #6a7e9a;
      --border-light: rgba(255, 255, 255, 0.06);
    }
    /* الوضع الليلي للقارئ فقط */
    .reader-night-mode {
      --bg-body: #0d1421;
      --bg-card: #162035;
      --text-primary: #e8edf5;
      --text-secondary: #a0b3cc;
      --text-muted: #6a7e9a;
      --border-light: rgba(255, 255, 255, 0.04);
    }
    .reader-night-mode .reader-content,
    .reader-night-mode .reader-toolbar,
    .reader-night-mode .reader-nav button,
    .reader-night-mode .reader-progress {
      background: #162035;
      color: #e8edf5;
      border-color: rgba(255,255,255,0.05);
    }
    .reader-night-mode .reader-toolbar button {
      background: #1a2332;
      color: #a0b3cc;
      border-color: rgba(255,255,255,0.05);
    }
    .reader-night-mode .reader-toolbar button:hover {
      background: var(--primary-gradient);
      color: white;
    }
    .reader-night-mode .reader-content {
      background: #162035;
      color: #e8edf5;
    }
    ::-webkit-scrollbar { width: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

    /* ===== NAVBAR ===== */
    .navbar {
      background: rgba(10, 30, 61, 0.92);
      backdrop-filter: blur(18px);
      padding: 0.5rem 2.8rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      position: sticky;
      top: 0;
      z-index: 1100;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .nav-brand { display: flex; align-items: center; gap: 0.7rem; font-size: 1.5rem; font-weight: 800; color: white; }
    .nav-brand i { font-size: 2rem; color: var(--accent); }
    .nav-brand span { color: white; }
    .nav-links { display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; list-style: none; }
    .nav-links a {
      text-decoration: none; color: rgba(255, 255, 255, 0.7); font-weight: 500; font-size: 0.92rem;
      transition: var(--transition); display: flex; align-items: center; gap: 6px; cursor: pointer;
      padding: 0.3rem 0; position: relative;
    }
    .nav-links a::after {
      content: ''; position: absolute; bottom: -2px; right: 0; width: 0; height: 2.5px;
      background: var(--accent); border-radius: 10px; transition: var(--transition);
    }
    .nav-links a:hover::after { width: 100%; }
    .nav-links a:hover { color: white; }
    .dropdown { position: relative; cursor: pointer; }
    .dropdown-menu {
      display: none; position: absolute; right: -10px; top: 2.6rem;
      background: var(--bg-card); border-radius: var(--radius-sm); box-shadow: var(--shadow-xl);
      padding: 0.5rem 0; min-width: 190px; border: 1px solid var(--border-light); z-index: 999;
    }
    .dropdown:hover .dropdown-menu { display: block; animation: fadeDown 0.2s ease; }
    @keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
    .dropdown-menu a { padding: 0.5rem 1.8rem; display: block; color: var(--text-secondary); font-weight: 400; border-right: 3px solid transparent; }
    .dropdown-menu a:hover { background: var(--bg-body); border-right-color: var(--accent); color: var(--text-primary); }
    .nav-icons { display: flex; align-items: center; gap: 1.2rem; }
    .nav-icons i { font-size: 1.2rem; color: rgba(255, 255, 255, 0.7); transition: var(--transition); cursor: pointer; }
    .nav-icons i:hover { color: white; transform: scale(1.05); }
    .btn-outline {
      background: transparent; border: 1.5px solid var(--accent); padding: 0.3rem 1.2rem;
      border-radius: 50px; font-weight: 600; color: var(--accent); transition: var(--transition);
      cursor: pointer; font-size: 0.82rem;
    }
    .btn-outline:hover { background: var(--accent); color: var(--primary); box-shadow: 0 6px 20px rgba(245, 179, 66, 0.25); }
    .btn-primary {
      background: var(--primary-gradient); border: none; padding: 0.45rem 1.8rem;
      border-radius: 50px; color: white; font-weight: 600; font-size: 0.88rem;
      transition: var(--transition); cursor: pointer; box-shadow: 0 4px 16px rgba(10, 30, 61, 0.15);
    }
    .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(10, 30, 61, 0.25); }
    .btn-primary-sm { padding: 0.25rem 1.2rem; font-size: 0.75rem; }
    .container { max-width: 1440px; margin: 0 auto; padding: 0 2.5rem; }

    /* ===== HERO SEARCH ===== */
    .hero-search {
      background: var(--primary-gradient); padding: 3rem 3rem; border-radius: var(--radius);
      margin: 2rem 0 3rem; box-shadow: var(--shadow-xl); color: white; position: relative; overflow: hidden;
    }
    .hero-search::before {
      content: ''; position: absolute; top: -40%; right: -10%; width: 60%; height: 200%;
      background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.06) 0%, transparent 70%);
      pointer-events: none;
    }
    .hero-search h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.8rem; }
    .hero-search h1 i { margin-left: 10px; opacity: 0.8; }
    .search-wrapper {
      display: flex; flex-wrap: wrap; align-items: center; background: white;
      border-radius: 60px; padding: 0.2rem 0.2rem 0.2rem 1.8rem;
      box-shadow: 0 8px 32px rgba(0,0,0,0.12); position: relative; z-index: 2;
    }
    .search-wrapper input {
      flex: 1; border: none; outline: none; padding: 0.9rem 0.5rem; font-size: 1rem;
      background: transparent; min-width: 160px; font-family: var(--font); color: #000000 !important;
    }
    .search-wrapper input::placeholder { color: #666; }
    .search-wrapper .search-actions {
      display: flex; align-items: center; gap: 0.5rem;
    }
    .search-wrapper .mini-search-input {
      display: none;
      padding: 0.4rem 0.8rem;
      border: 1px solid var(--border-light);
      border-radius: 30px;
      font-family: var(--font);
      font-size: 0.85rem;
      background: var(--bg-body);
      color: var(--text-primary);
      width: 150px;
    }
    .search-wrapper .mini-search-input.active {
      display: block;
    }
    .search-wrapper button {
      background: var(--primary-gradient); border: none; color: white; padding: 0.65rem 2.2rem;
      border-radius: 60px; font-weight: 600; display: flex; align-items: center; gap: 10px;
      transition: var(--transition); cursor: pointer; font-family: var(--font);
    }
    .search-wrapper button:hover { transform: scale(1.02); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
    .search-suggestions {
      display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0.6rem 0.2rem 0; position: relative; z-index: 2;
    }
    .search-suggestions span {
      background: rgba(255,255,255,0.12); padding: 0.15rem 1.2rem; border-radius: 50px;
      font-size: 0.78rem; backdrop-filter: blur(4px); cursor: pointer; transition: var(--transition);
      border: 1px solid rgba(255,255,255,0.05);
    }
    .search-suggestions span:hover { background: rgba(255,255,255,0.25); transform: translateY(-1px); }
    .search-suggestions span i { margin-left: 5px; }

    /* ===== SECTION ===== */
    .section-header {
      display: flex; justify-content: space-between; align-items: center;
      margin: 2.8rem 0 1.5rem; flex-wrap: wrap; gap: 0.5rem;
    }
    .section-title {
      font-size: 1.6rem; font-weight: 700; display: flex; align-items: center;
      gap: 12px; color: var(--text-primary);
    }
    .section-title i { color: var(--primary-light); font-size: 1.4rem; }
    .section-more {
      color: var(--primary-light); font-weight: 500; cursor: pointer; transition: var(--transition);
      display: flex; align-items: center; gap: 4px; font-size: 0.88rem;
      padding: 0.3rem 0.8rem; border-radius: 50px; background: rgba(26, 74, 122, 0.04);
    }
    .section-more:hover { background: rgba(26, 74, 122, 0.08); transform: translateX(-4px); color: var(--primary); }

    /* ===== HORIZONTAL SCROLL (بديل السلايدر) ===== */
    .section-scroll-wrapper {
      position: relative;
      overflow: hidden;
      padding: 0.5rem 0 1.5rem;
    }
    .section-scroll-track {
      display: flex;
      gap: 1.8rem;
      overflow-x: auto;
      padding: 0.5rem 0.2rem 1.2rem;
      scroll-behavior: smooth;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
      scrollbar-color: var(--primary-light) transparent;
    }
    .section-scroll-track::-webkit-scrollbar {
      height: 4px;
    }
    .section-scroll-track::-webkit-scrollbar-thumb {
      background: var(--primary-light);
      border-radius: 10px;
    }
    .section-scroll-track .card {
      min-width: 220px;
      flex: 0 0 220px;
      transition: var(--transition);
      cursor: pointer;
      border: 2px solid transparent;
      position: relative;
      box-shadow: var(--shadow-sm);
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 1.2rem 1.2rem 1rem;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 0.4rem;
    }
    .section-scroll-track .card:hover {
      transform: translateY(-4px);
      box-shadow: var(--shadow-md);
      border-color: var(--accent);
    }
    .section-scroll-track .card .card-icon {
      font-size: 2.8rem;
      color: var(--primary-light);
      width: 100%;
      text-align: center;
      padding: 0.4rem 0;
      background: var(--bg-body);
      border-radius: var(--radius-sm);
      margin-bottom: 0.3rem;
      transition: var(--transition);
    }
    .section-scroll-track .card:hover .card-icon {
      transform: scale(1.05);
      color: var(--accent);
    }
    .section-scroll-track .card .badge {
      background: var(--bg-body);
      padding: 0.05rem 0.8rem;
      border-radius: 50px;
      font-size: 0.6rem;
      color: var(--primary-light);
      font-weight: 700;
      text-transform: uppercase;
    }
    .section-scroll-track .card h4 {
      font-size: 1rem;
      font-weight: 700;
      margin: 0.2rem 0;
      color: var(--text-primary);
      line-height: 1.3;
    }
    .section-scroll-track .card p {
      font-size: 0.78rem;
      color: var(--text-secondary);
      margin: 0.1rem 0;
    }
    .section-scroll-track .card .meta {
      display: flex;
      flex-wrap: wrap;
      gap: 0.3rem 0.8rem;
      font-size: 0.7rem;
      color: var(--text-muted);
      width: 100%;
    }
    .section-scroll-track .card .actions {
      display: flex;
      justify-content: space-between;
      width: 100%;
      margin-top: 0.4rem;
      border-top: 1px solid var(--border-light);
      padding-top: 0.5rem;
    }
    .section-scroll-track .card .actions i {
      color: var(--text-muted);
      transition: var(--transition);
      cursor: pointer;
      font-size: 0.9rem;
    }
    .section-scroll-track .card .actions i:hover {
      color: var(--primary);
      transform: scale(1.15);
    }

    /* ===== CARDS GRID ===== */
    .card-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 2rem; margin-bottom: 1rem;
    }
    .card-grid .card {
      background: var(--bg-card); border-radius: var(--radius); padding: 1.2rem 1.2rem 1rem;
      box-shadow: var(--shadow-sm); transition: var(--transition);
      border: 1px solid var(--border-light); display: flex; flex-direction: column;
      align-items: flex-start; gap: 0.4rem; cursor: pointer; position: relative;
    }
    .card-grid .card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: rgba(26,74,122,0.08); }
    .card-grid .card .card-icon {
      font-size: 3rem;
      color: var(--primary-light);
      width: 100%;
      text-align: center;
      padding: 0.8rem 0;
      background: var(--bg-body);
      border-radius: var(--radius-sm);
      margin-bottom: 0.3rem;
      transition: var(--transition);
    }
    .card-grid .card:hover .card-icon {
      transform: scale(1.05);
      color: var(--accent);
    }
    .card-grid .card .badge {
      background: var(--bg-body); padding: 0.05rem 0.8rem; border-radius: 50px;
      font-size: 0.6rem; color: var(--primary-light); font-weight: 700; letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    .card-grid .card h4 { font-size: 1.05rem; font-weight: 700; margin: 0.2rem 0; color: var(--text-primary); line-height: 1.3; }
    .card-grid .card p { font-size: 0.82rem; color: var(--text-secondary); margin: 0.1rem 0; }
    .card-grid .card .meta {
      display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; font-size: 0.72rem;
      color: var(--text-muted); width: 100%;
    }
    .card-grid .card .actions {
      display: flex; justify-content: space-between; width: 100%; margin-top: 0.5rem;
      border-top: 1px solid var(--border-light); padding-top: 0.6rem;
    }
    .card-grid .card .actions i { color: var(--text-muted); transition: var(--transition); cursor: pointer; font-size: 0.95rem; }
    .card-grid .card .actions i:hover { color: var(--primary); transform: scale(1.15); }
    .rating-stars { color: var(--accent); letter-spacing: 0.5px; font-size: 0.85rem; }

    /* ===== CHAT ===== */
    .chat-float {
      position: fixed; bottom: 2rem; left: 2rem; z-index: 999;
      background: var(--primary-gradient); color: white; width: 62px; height: 62px;
      border-radius: 50%; display: flex; align-items: center; justify-content: center;
      font-size: 1.8rem; box-shadow: 0 8px 32px rgba(10,30,61,0.3);
      transition: var(--transition); cursor: pointer; border: none;
    }
    .chat-float:hover { transform: scale(1.06) rotate(-4deg); }
    .chat-widget {
      position: fixed; bottom: 90px; left: 20px; width: 400px; max-height: 520px;
      background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-xl);
      display: none; flex-direction: column; overflow: hidden; z-index: 1000;
      border: 1px solid var(--border-light);
    }
    .chat-widget.active { display: flex; animation: fadeUp 0.3s ease; }
    .chat-header {
      background: var(--primary-gradient); color: white; padding: 0.9rem 1.5rem;
      font-weight: 600; display: flex; justify-content: space-between; align-items: center;
    }
    .chat-body {
      padding: 1rem 1.2rem; overflow-y: auto; flex: 1; max-height: 300px;
      background: var(--bg-card); display: flex; flex-direction: column;
    }
    .chat-body .msg {
      background: var(--bg-body); padding: 0.6rem 1rem; border-radius: 16px;
      margin: 0.3rem 0; max-width: 85%; color: var(--text-primary); font-size: 0.9rem;
      word-wrap: break-word; position: relative; align-self: flex-start;
      width: fit-content; min-width: 40px; transition: all 0.2s ease;
    }
    .chat-body .msg.user {
      background: var(--primary-gradient); color: white; align-self: flex-end;
    }
    .chat-body .msg .msg-actions {
      display: flex; gap: 0.5rem; margin-top: 0.3rem; font-size: 0.7rem; opacity: 0.6;
    }
    .chat-body .msg .msg-actions i { cursor: pointer; transition: var(--transition); }
    .chat-body .msg .msg-actions i:hover { opacity: 1; transform: scale(1.1); }
    .chat-input {
      display: flex; border-top: 1px solid var(--border-light); background: var(--bg-card);
    }
    .chat-input input {
      flex: 1; border: none; padding: 0.8rem 1.2rem; outline: none;
      font-family: var(--font); background: transparent; color: var(--text-primary); font-size: 0.9rem;
    }
    .chat-input button {
      background: var(--primary-gradient); border: none; color: white;
      padding: 0.8rem 1.4rem; cursor: pointer; font-size: 1.1rem;
    }

    /* ===== PAGES ===== */
    .page { display: none; animation: fadeUp 0.45s ease; }
    .page.active { display: block; }
    @keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

    /* ===== DETAIL ===== */
    .detail-hero { display: flex; flex-wrap: wrap; gap: 2.5rem; align-items: flex-start; }
    .detail-hero .detail-icon {
      font-size: 5rem;
      color: var(--primary-light);
      width: 180px;
      height: 180px;
      background: var(--bg-body);
      border-radius: var(--radius);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: var(--shadow-md);
      flex-shrink: 0;
    }
    .detail-info { flex: 1; }
    .detail-info h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.2rem; color: var(--text-primary); }
    .detail-info .meta-line { color: var(--text-secondary); margin-bottom: 0.5rem; font-size: 0.95rem; }
    .detail-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.2rem 0; }
    .detail-section { margin-top: 2rem; }
    .detail-section h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--primary-light); display: flex; align-items: center; gap: 8px; }
    .similar-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 1.2rem; margin-top: 0.5rem;
    }
    .similar-grid .card { padding: 0.8rem; cursor: pointer; }
    .similar-grid .card .card-icon { font-size: 2rem; padding: 0.4rem 0; }

    /* ===== READER ===== */
    .reader-toolbar {
      display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0;
      padding: 0.6rem 1.2rem; background: var(--bg-body); border-radius: var(--radius-sm); align-items: center;
    }
    .reader-toolbar button {
      background: var(--bg-card); border: 1px solid var(--border-light); padding: 0.25rem 1rem;
      border-radius: 50px; cursor: pointer; transition: var(--transition);
      font-family: var(--font); color: var(--text-secondary); font-size: 0.8rem;
    }
    .reader-toolbar button:hover { background: var(--primary-gradient); color: white; border-color: transparent; }
    .reader-content {
      padding: 2rem; border-radius: var(--radius-sm); background: var(--bg-card);
      border: 1px solid var(--border-light); min-height: 350px; transition: all 0.3s;
      color: var(--text-primary); font-size: 1.05rem; line-height: 1.9; position: relative;
    }
    .reader-content .page-number {
      text-align: center; color: var(--text-muted); font-size: 0.85rem;
      margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-light);
    }
    .reader-content .highlighted {
      background: #f5b342;
      color: #0a1e3d;
      padding: 0.1rem 0.2rem;
      border-radius: 4px;
    }
    .reader-nav {
      display: flex; justify-content: center; gap: 1rem; margin-top: 1rem;
    }
    .reader-nav button {
      background: var(--bg-card); border: 1px solid var(--border-light); padding: 0.3rem 1.5rem;
      border-radius: 50px; cursor: pointer; transition: var(--transition);
      font-family: var(--font); color: var(--text-secondary);
    }
    .reader-nav button:hover { background: var(--primary-gradient); color: white; border-color: transparent; }
    .reader-progress { margin-top: 1.2rem; }
    .reader-progress progress {
      width: 100%; height: 6px; border-radius: 10px; background: var(--bg-body); -webkit-appearance: none; appearance: none;
    }
    .reader-progress progress::-webkit-progress-bar { background: var(--bg-body); border-radius: 10px; }
    .reader-progress progress::-webkit-progress-value { background: var(--primary-gradient); border-radius: 10px; }

    /* ===== NOTES ===== */
    .note-marker {
      display: inline-block; color: #f5b342; font-weight: 700; cursor: pointer;
      margin: 0 2px; font-size: 1.1rem; position: relative;
    }
    .note-marker:hover { color: #1e4a7a; }
    .note-marker .note-preview {
      display: none;
      position: absolute; bottom: 100%; right: -10px;
      background: var(--bg-card); border: 1px solid var(--border-light);
      border-radius: var(--radius-sm); padding: 0.5rem 0.8rem;
      box-shadow: var(--shadow-lg); min-width: 150px; max-width: 250px;
      font-size: 0.75rem; color: var(--text-primary); z-index: 100;
    }
    .note-marker:hover .note-preview { display: block; }
    .note-tooltip {
      position: fixed; background: var(--bg-card); border: 1px solid var(--border-light);
      border-radius: var(--radius-sm); padding: 0.8rem 1rem; box-shadow: var(--shadow-xl);
      z-index: 2000; max-width: 300px; font-size: 0.85rem; color: var(--text-primary); display: none;
    }
    .note-tooltip.active { display: block; animation: fadeUp 0.2s ease; }
    .note-input-popup {
      position: fixed; background: var(--bg-card); border-radius: var(--radius-sm);
      padding: 1.2rem; box-shadow: var(--shadow-xl); z-index: 2001;
      border: 1px solid var(--border-light); min-width: 300px; display: none;
    }
    .note-input-popup.active { display: block; animation: fadeUp 0.2s ease; }
    .note-input-popup textarea {
      width: 100%; padding: 0.5rem; border: 1px solid var(--border-light);
      border-radius: var(--radius-sm); font-family: var(--font); background: var(--bg-body);
      color: var(--text-primary); min-height: 80px; resize: vertical;
    }
    .note-input-popup .note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
    .note-input-popup .note-actions button { padding: 0.2rem 1rem; border-radius: 50px; border: none; cursor: pointer; font-family: var(--font); }
    .note-input-popup .note-actions .save-note { background: var(--primary-gradient); color: white; }
    .note-input-popup .note-actions .delete-note { background: #e74c3c; color: white; }
    .note-input-popup .note-actions .cancel-note { background: var(--bg-body); color: var(--text-secondary); }

    /* ===== CONTEXT MENU ===== */
    .context-menu {
      position: fixed; background: var(--bg-card); border-radius: var(--radius-sm);
      box-shadow: var(--shadow-xl); border: 1px solid var(--border-light);
      padding: 0.4rem 0; min-width: 180px; z-index: 2002; display: none;
    }
    .context-menu.active { display: block; animation: fadeUp 0.15s ease; }
    .context-menu .menu-item {
      padding: 0.4rem 1.5rem; cursor: pointer; transition: var(--transition);
      color: var(--text-secondary); font-size: 0.85rem; display: flex; align-items: center; gap: 8px;
    }
    .context-menu .menu-item:hover { background: var(--bg-body); color: var(--text-primary); }
    .context-menu .menu-item i { width: 18px; font-size: 0.9rem; }

    /* ===== MODAL – بحث متقدم ===== */
    .modal-overlay {
      display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
      background: rgba(10, 30, 61, 0.5); backdrop-filter: blur(8px); z-index: 1200;
      align-items: center; justify-content: center;
    }
    .modal-overlay.active { display: flex; animation: fadeUp 0.3s ease; }
    .modal-box {
      background: var(--bg-card); border-radius: var(--radius); padding: 0;
      max-width: 620px; width: 92%; max-height: 90vh;
      box-shadow: var(--shadow-xl); border: 1px solid var(--border-light);
      display: flex; flex-direction: column; overflow: hidden;
    }
    .modal-header {
      background: var(--primary-gradient); padding: 1.2rem 2rem;
      display: flex; justify-content: space-between; align-items: center; color: white;
      flex-shrink: 0;
    }
    .modal-header h2 { font-weight: 700; font-size: 1.4rem; margin: 0; }
    .modal-header .close-modal {
      cursor: pointer; font-size: 1.5rem; transition: var(--transition);
      background: none; border: none; color: white;
    }
    .modal-header .close-modal:hover { transform: scale(1.1); opacity: 0.8; }
    .modal-body {
      padding: 1.8rem 2rem; overflow-y: auto; flex: 1;
    }
    .modal-body .form-group { margin-bottom: 1rem; }
    .modal-body label {
      display: block; font-weight: 600; margin-bottom: 0.2rem;
      color: var(--text-secondary); font-size: 0.85rem;
    }
    .modal-body input, .modal-body select {
      width: 100%; padding: 0.5rem 1rem; border: 1.5px solid var(--border-light);
      border-radius: var(--radius-sm); font-family: var(--font);
      background: var(--bg-body); color: var(--text-primary); transition: var(--transition);
      font-size: 0.9rem;
    }
    .modal-body input:focus, .modal-body select:focus {
      border-color: var(--primary-light); outline: none;
      box-shadow: 0 0 0 3px rgba(26, 74, 122, 0.08);
    }
    .modal-body .range-group { display: flex; gap: 1rem; align-items: center; }
    .modal-body .range-group input { flex: 1; }
    .modal-body .range-group span { color: var(--text-muted); font-size: 0.85rem; }

    /* تصنيفات قابلة للاختيار مع زر إظهار/إخفاء */
    .category-selector-wrapper {
      margin-top: 0.3rem;
    }
    .category-selector-toggle {
      background: var(--bg-body);
      border: 1px solid var(--border-light);
      border-radius: 50px;
      padding: 0.2rem 1rem;
      cursor: pointer;
      font-family: var(--font);
      font-size: 0.8rem;
      color: var(--text-secondary);
      transition: var(--transition);
      margin-bottom: 0.5rem;
    }
    .category-selector-toggle:hover {
      border-color: var(--primary-light);
      color: var(--primary);
    }
    .category-selector {
      display: none;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-top: 0.3rem;
    }
    .category-selector.active {
      display: flex;
    }
    .category-selector .cat-chip {
      background: var(--bg-body); padding: 0.2rem 1rem; border-radius: 50px;
      font-size: 0.8rem; border: 1.5px solid var(--border-light);
      cursor: pointer; transition: var(--transition); color: var(--text-secondary);
    }
    .category-selector .cat-chip:hover { border-color: var(--primary-light); }
    .category-selector .cat-chip.selected {
      background: var(--primary-gradient); color: white; border-color: transparent;
    }
    .selected-categories-display {
      display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem;
    }
    .selected-categories-display .sel-chip {
      background: var(--primary-gradient); color: white; padding: 0.15rem 0.8rem;
      border-radius: 50px; font-size: 0.75rem; display: flex; align-items: center; gap: 4px;
    }
    .selected-categories-display .sel-chip .remove-sel {
      cursor: pointer; font-weight: 700; opacity: 0.7;
    }
    .selected-categories-display .sel-chip .remove-sel:hover { opacity: 1; }

    .modal-footer {
      padding: 1rem 2rem; border-top: 1px solid var(--border-light);
      display: flex; gap: 0.8rem; justify-content: flex-end; flex-shrink: 0;
      background: var(--bg-card);
      flex-wrap: wrap;
    }

    /* ===== RESULTS ===== */
    .results-container {
      display: none;
      padding: 1.5rem 0;
      background: var(--bg-card);
      border-radius: var(--radius);
      margin: 1rem 0;
      box-shadow: var(--shadow-sm);
      border: 1px solid var(--border-light);
    }
    .results-container.active { display: block; }
    .results-container .results-header {
      padding: 0 1.5rem 1rem;
      border-bottom: 1px solid var(--border-light);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
    }
    .results-container .results-header h3 {
      color: var(--text-primary);
      font-weight: 700;
    }
    .results-container .results-header .close-results {
      cursor: pointer;
      color: var(--text-muted);
      transition: var(--transition);
    }
    .results-container .results-header .close-results:hover { color: var(--primary); }
    .results-container .result-section {
      padding: 1rem 1.5rem;
      border-bottom: 1px solid var(--border-light);
    }
    .results-container .result-section:last-child { border-bottom: none; }
    .results-container .result-section h4 {
      color: var(--primary-light);
      font-size: 0.95rem;
      margin-bottom: 0.5rem;
    }
    .results-container .result-section .mini-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 0.8rem;
    }
    .results-container .result-section .mini-grid .mini-card {
      background: var(--bg-body);
      border-radius: var(--radius-sm);
      padding: 0.5rem;
      cursor: pointer;
      transition: var(--transition);
      border: 1px solid transparent;
      text-align: center;
    }
    .results-container .result-section .mini-grid .mini-card:hover {
      border-color: var(--primary-light);
      transform: translateY(-2px);
    }
    .results-container .result-section .mini-grid .mini-card .mini-icon {
      font-size: 2.5rem;
      color: var(--primary-light);
      display: block;
      margin-bottom: 0.3rem;
    }
    .results-container .result-section .mini-grid .mini-card h5 {
      font-size: 0.8rem;
      color: var(--text-primary);
      margin: 0.2rem 0;
    }
    .results-container .result-section .mini-grid .mini-card p {
      font-size: 0.65rem;
      color: var(--text-muted);
    }

    /* ===== FOOTER ===== */
    .footer-full {
      background: var(--bg-card);
      padding: 2.5rem 2rem 1.5rem;
      margin-top: 3.5rem;
      border-radius: var(--radius) var(--radius) 0 0;
      border-top: 1px solid var(--border-light);
    }
    .footer-full .footer-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 2rem;
      margin-bottom: 2rem;
    }
    .footer-full .footer-grid h4 {
      color: var(--text-primary);
      font-weight: 700;
      margin-bottom: 0.6rem;
    }
    .footer-full .footer-grid ul {
      list-style: none;
      padding: 0;
    }
    .footer-full .footer-grid ul li {
      padding: 0.2rem 0;
      color: var(--text-secondary);
      font-size: 0.9rem;
      cursor: pointer;
      transition: var(--transition);
    }
    .footer-full .footer-grid ul li:hover {
      color: var(--primary-light);
      padding-right: 0.3rem;
    }
    .footer-full .footer-bottom {
      border-top: 1px solid var(--border-light);
      padding-top: 1.5rem;
      text-align: center;
      color: var(--text-muted);
      font-size: 0.8rem;
    }
    /* إخفاء الفوتر في صفحة المساعد */
    .page-assistant.active ~ .footer-full {
      display: none;
    }

    /* ===== COLOR PICKER ===== */
    .color-picker-circle {
      display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.3rem 0;
    }
    .color-picker-circle .color-option {
      width: 28px; height: 28px; border-radius: 50%;
      cursor: pointer; border: 2px solid transparent;
      transition: var(--transition);
    }
    .color-picker-circle .color-option:hover { transform: scale(1.1); }
    .color-picker-circle .color-option.active { border-color: var(--primary); box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary); }

    /* ===== LOGIN / REGISTER / FORGOT MODALS ===== */
    .auth-modal .modal-box { max-width: 420px; }
    .auth-modal .form-group { margin-bottom: 1.2rem; }
    .auth-modal .form-group label { display: block; font-weight: 600; margin-bottom: 0.2rem; color: var(--text-secondary); }
    .auth-modal .form-group input { width: 100%; padding: 0.6rem 1rem; border: 1.5px solid var(--border-light); border-radius: var(--radius-sm); font-family: var(--font); background: var(--bg-body); color: var(--text-primary); }
    .auth-modal .form-group input:focus { border-color: var(--primary-light); outline: none; box-shadow: 0 0 0 3px rgba(26,74,122,0.08); }
    .auth-modal .modal-footer { flex-direction: column; gap: 0.6rem; }
    .auth-modal .modal-footer .btn-primary { width: 100%; }
    .auth-modal .modal-footer .btn-outline { width: 100%; }
    .auth-modal .auth-link {
      text-align: center;
      margin-top: 0.8rem;
      color: var(--text-secondary);
      font-size: 0.85rem;
    }
    .auth-modal .auth-link a {
      color: var(--primary-light);
      cursor: pointer;
      font-weight: 600;
      text-decoration: none;
    }
    .auth-modal .auth-link a:hover { text-decoration: underline; }

    /* ===== SECTION NAVIGATION SCROLLBAR ===== */
    .section-nav-scroll {
      display: flex;
      gap: 0.5rem;
      overflow-x: auto;
      padding: 0.5rem 0 1rem;
      scrollbar-width: thin;
      scrollbar-color: var(--primary-light) transparent;
      -webkit-overflow-scrolling: touch;
      margin-top: -0.5rem;
    }
    .section-nav-scroll::-webkit-scrollbar {
      height: 4px;
    }
    .section-nav-scroll::-webkit-scrollbar-thumb {
      background: var(--primary-light);
      border-radius: 10px;
    }
    .section-nav-scroll .nav-item {
      background: var(--bg-card);
      padding: 0.3rem 1.2rem;
      border-radius: 50px;
      white-space: nowrap;
      border: 1px solid var(--border-light);
      font-size: 0.8rem;
      color: var(--text-secondary);
      cursor: pointer;
      transition: var(--transition);
      flex-shrink: 0;
    }
    .section-nav-scroll .nav-item:hover {
      border-color: var(--primary-light);
      color: var(--primary);
      transform: translateY(-2px);
    }
    .section-nav-scroll .nav-item.active {
      background: var(--primary-gradient);
      color: white;
      border-color: transparent;
    }

    /* ===== RESPONSIVE ===== */
    @media (max-width: 768px) {
      .container { padding: 0 1.2rem; }
      .navbar { padding: 0.4rem 1rem; }
      .nav-links { gap: 0.6rem; }
      .nav-links a { font-size: 0.8rem; }
      .hero-search { padding: 2rem 1.5rem; }
      .hero-search h1 { font-size: 1.4rem; }
      .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.2rem; }
      .section-title { font-size: 1.3rem; }
      .detail-hero .detail-icon { width: 120px; height: 120px; font-size: 3.5rem; }
      .chat-widget { width: 320px; left: 10px; bottom: 80px; max-height: 440px; }
      .section-scroll-track .card { min-width: 180px; flex: 0 0 180px; }
      .modal-body { padding: 1.2rem 1.2rem; }
      .modal-footer { padding: 0.8rem 1.2rem; }
      .search-wrapper .mini-search-input { width: 100px; }
    }
    @media (max-width: 480px) {
      .card-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
      .card-grid .card { padding: 0.8rem; }
      .card-grid .card .card-icon { font-size: 2.2rem; padding: 0.4rem 0; }
      .card-grid .card h4 { font-size: 0.9rem; }
      .section-scroll-track .card { min-width: 150px; flex: 0 0 150px; }
      .section-scroll-track .card .card-icon { font-size: 2rem; }
      .chat-widget { width: 280px; max-height: 400px; }
    }