:root {
      --bg: #0b1220; 
      --card: rgba(78,78,78,0.9); 
      --text:#1b1b1b; 
      --muted:#94a3b8;
      --border: rgba(255,255,255,.12); 
      --primary: #10b981; 
      --accent: #6366f1; 
      --danger: #ef4444;
    }

    body.light {
      --card: rgb(255,255,255,0.9); 
      --text: #0f172a;
      --border: #e2e8f0; 
      --primary: #0ea5e9; 
      --accent: #7c3aed; 
      --danger: #dc2626;
    }

    *{box-sizing: border-box;}

    body {
      margin: 0; 
      font-family: "Vazirmatn", sans-serif; 
      background: var(--bg); 
      color: var(--text);
    }

    header {
      position:sticky; top:0; z-index:10; backdrop-filter:blur(12px);
      background:linear-gradient(to bottom,rgb(85, 85, 85),transparent);
      border-bottom:1px solid var(--border);
      padding:16px 24px;
      display:flex; justify-content: space-between; align-items: center;
    }

    h1{margin:0; font-weight:800; font-size:1.6rem;}

    .badge {
      font-size:.75rem; padding:4px 8px; border:1px solid var(--border);
      border-radius:999px; color:var(--muted);
      user-select:none;
    }

    #toggle-dark, #toggle-lang {
      font-size:1.1rem; min-width: 42px; background: var(--card);
      margin-right:8px; border: 1px solid var(--border);
      border-radius:10px; padding:8px 12px; cursor:pointer;
      color: var(--text); transition: all 0.3s;
    }

    #toggle-dark:hover, #toggle-lang:hover {
      background: var(--accent); color: #fff; transform: translateY(-2px);
    }

    main.container {
      max-width:1000px; margin:auto; padding:24px;
    }

    .controls {
      display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:10px; margin-bottom:24px;
      align-items:center;
    }

    input, select {
      width: 100%; padding: 10px; border-radius: 10px;
      border: 1px solid var(--border); background: var(--card);
      color: var(--text); outline:none; font-size: 1rem;
      transition: border-color 0.25s ease, box-shadow 0.25s ease;
    }

    input:focus, select:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
    }

    .btn {
      padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
      background: var(--card); color: var(--text); font-weight: 600; cursor: pointer;
      transition: all 0.25s ease; font-size: 1rem; user-select: none;
    }

    .btn.primary {
      background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border: none;
      box-shadow: 0 4px 15px rgba(99,102,241,0.5);
    }

    .btn.primary:hover {
      transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99,102,241,0.75);
    }

    .btn:hover {
      transform: translateY(-2px); background: var(--accent); color: #fff;
      border-color: var(--accent); box-shadow: 0 4px 15px rgba(99,102,241,0.3);
    }

    .list {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .item {
      display: grid;
      grid-template-columns: 1fr;
      align-items: center;
      gap: 10px;
      padding: 16px;
      border-radius: 12px;
      background: var(--card);
      border: 1px solid var(--border);
      box-shadow: 0 3px 10px rgba(0,0,0,0.07);
      transition: box-shadow 0.25s ease;
    }

    .item:hover {
      box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    }

    .item .desc {
      font-weight: 600;
      font-size: 1rem;
    }

    .item .read-note {
      font-size: 0.9rem;
      color: var(--muted);
      margin-top: 4px;
    }

    .item .book-footer {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      font-size: 0.85rem;
      color: var(--muted);
      gap: 10px;
      margin-top: 8px;
      margin-bottom: 8px;
    }

    .item-buttons {
      display: flex;
      gap: 10px;
      margin-top: 5px;
    }

    .item-buttons button {
      flex: 1;
      padding: 8px 0;
      font-weight: 600;
      cursor: pointer;
      border-radius: 8px;
      font-size: 0.95rem;
      user-select: none;
      box-shadow: 0 3px 10px rgba(0,0,0,0.12);
      border: none;
      color: #fff;
      transition: background 0.25s ease, box-shadow 0.25s ease;
    }

    .item-buttons button.edit-btn {
      background: var(--primary);
    }

    .item-buttons button.edit-btn:hover {
      background: #0e9f74;
      box-shadow: 0 6px 20px rgba(14,159,116,0.4);
    }

    .item-buttons button.del {
      background: var(--danger);
    }
    .item-buttons button.next-page {
      background: var(--accent);
    }

    .item-buttons button.next-page:hover {
      background: #4f46e5;
      box-shadow: 0 6px 20px rgba(79,70,229,0.4);
    }
    .item-buttons button.prev-page {
      background: #ef4444; /* قرمز روشن */
    }

    .item-buttons button.prev-page:hover {
      background: #dc2626;
      box-shadow: 0 6px 20px rgba(220,38,38,0.4);
    }

    .item-buttons button.del:hover {
      background: #be2e2e;
      box-shadow: 0 6px 20px rgba(190,46,46,0.4);
    }

    .alert {
      padding: 12px 16px;
      margin-bottom: 16px;
      border-radius: 10px;
      font-size: 1rem;
      font-weight: 600;
    }

    .alert.success {
      background: #d0f0dc;
      color: #216837;
      box-shadow: 0 0 15px #86c996ab;
    }

    .alert.error {
      background: #f9d7d4;
      color: #921c1c;
      box-shadow: 0 0 15px #e296958a;
    }

    .modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.9);
      justify-content: center;
      align-items: center;
    }

    .modal.show {
      display: flex;
    }

    .modal-content {
      background: var(--card);
      padding: 28px 24px;
      border-radius: 20px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.9);
      width: 90%;
      max-width: 450px;
      position: relative;
    }

    .close {
      position: absolute;
      top: 16px;
      right: 22px;
      font-size: 2.2rem;
      font-weight: 900;
      color: var(--primary);
      cursor: pointer;
      user-select: none;
      transition: color 0.3s ease;
    }

    .close:hover {
      color: var(--accent);
    }

    @media(max-width: 700px) {
      header {
        padding: 10px 8px;
        flex-direction: column;
        align-items: flex-start;
      }
      .header-row {
        width: 100%;
        gap: 4px;
        justify-content: space-between;
        margin-bottom: 8px;
      }
      main.container {
        max-width: 100vw;
        padding: 8px;
      }
      .controls {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
      }
      .btn, .btn.primary, input, select {
        font-size: 1rem;
        padding: 10px 8px;
      }
      .list {
        gap: 7px;
      }
      .item {
        grid-template-columns: 1fr;
        padding: 13px;
        font-size: 1rem;
      }
      .item .desc {
        font-size: 0.97rem;
      }
      .item-buttons {
        flex-direction: column;
        gap: 8px;
      }
      .item-buttons button {
        width: 100%;
        margin-top: 0;
      }
      .modal-content {
        padding: 15px 6px;
        max-width: 98vw;
      }
      .item .book-footer {
        flex-direction: column;
        gap: 3px;
      }
    }/* ===== کنترل پنل سمت چپ در دسکتاپ ===== */
#control-panel {
  position: fixed;
  left: 16px;
  top: 80px;
  width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(2,6,23,0.45);
  z-index: 9999;
  font-family: inherit;
}

#control-panel h3 {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
  color: var(--text);
}

#cp-selected {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

#cp-selected-title {
  color: var(--text);
  font-weight: 700;
}

#control-panel .cp-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

#control-panel .btn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform .18s ease, box-shadow .18s ease;
}

#control-panel .btn:hover {
  transform: translateY(-3px);
}

#control-panel .btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  box-shadow: 0 8px 22px rgba(99,102,241,0.45);
}

#control-panel .btn.del {
  background: var(--danger);
  color: #fff;
  border: none;
  box-shadow: 0 8px 22px rgba(239,68,68,0.35);
}

#cp-info {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ===== حالت موبایل ===== */
@media (max-width: 700px) {
  #control-panel {
    position: fixed;
    left: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    background: rgba(20,20,20,0.95);
    border: 1px solid var(--border);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999;
  }

  #control-panel h3 {
    display: none; /* حذف عنوان برای سادگی */
  }

  #control-panel .cp-buttons {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 8px;
  }

  #control-panel .btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  #cp-selected, #cp-info {
    font-size: 0.8rem;
    margin: 6px 0 4px 0;
    text-align: center;
  }

  body {
    padding-bottom: 90px; 
  }
}
