body {
  margin: 0;
  min-height: 100vh;
  background: #f5f7fa;
  font-family: Arial, sans-serif;
}

/* Navbar */
.navbar {
  height: 60px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 18px;
  font-weight: bold;
  color: #e5690e;
}

.theme-btn {
  background: #e5690e;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.3s;
}

.theme-btn:hover {
  background: #9f4504;
}

/* Main Layout */
.page-container {
  display: flex;
  gap: 30px;
  padding: 30px;
  align-items: flex-start;
}

/* Form */
#bookmarkForm {
  flex: 1;
  max-width: 450px;
  background: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#bookmarkForm h2 {
  text-align: center;
  margin: 0 0 10px;
  color: #333;
}

#bookmarkForm input,
#bookmarkForm textarea {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

#bookmarkForm textarea {
  resize: none;
  height: 120px;
}

#bookmarkForm button {
  padding: 12px;
  border: none;
  border-radius: 5px;
  background: #e5690e;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: 0.3s;
}

#bookmarkForm button:hover {
  background: #9f4504;
}

#bookmarkForm select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 15px;
  align-items: center;
}

/* Groups */
.action-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Search takes full row if needed */
.action-group.grow {
  flex: 1;
}

/* Inputs & Selects */
.table-actions input,
.table-actions select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
  background: #fff;
}

.table-actions input {
  width: 90%;
}

.table-actions input:focus,
.table-actions select:focus {
  outline: none;
  border-color: #4f46e5;
}

/* Buttons */
.btn {
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: 0.3s;
}

.btn-pin,
.btn-danger,
.btn-filter {
  background: #e5690e;
  color: #fff;
}

.btn-danger:hover,
.btn-pin:hover,
.btn-filter:hover {
  background: #9f4504;
}

.btn-pin:disabled,
.btn-danger:disabled,
.btn-filter:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

th {
  background: #e5690e;
  color: #fff;
}

tr:hover {
  background: #f1f1f1;
}

/* Responsive Navbar */
@media (max-width: 600px) {
  .navbar {
    padding: 0 15px;
  }

  .nav-brand {
    font-size: 16px;
  }

  .theme-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .action-group {
    width: 100%;
    justify-content: space-between;
  }

  .bulk-actions {
    justify-content: center;
  }
}

/* Responsive */
@media (max-width: 992px) {
  .page-container {
    flex-direction: column;
    align-items: center; /* 👈 التوسيط الأفقي */
  }

  #bookmarkForm,
  .table-wrapper {
    width: 100%;
    max-width: 500px; /* اختياري */
  }
}

.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loader.hidden {
  display: none;
}

.spinner {
  width: 45px;
  height: 45px;
  border: 4px solid #ddd;
  border-top: 4px solid #e5690e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader p {
  margin-top: 12px;
  color: #333;
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== DARK MODE ========== */
body.dark {
  background: #0f172a;
  color: #e5e7eb;
}

body.dark .navbar {
  background: #020617;
}

body.dark .nav-brand {
  color: #a5b4fc;
}

body.dark #bookmarkForm,
body.dark #bookmarkForm h2,
body.dark .table-wrapper {
  background: #020617;
  color: #e5e7eb;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

body.dark .table-wrapper a {
  color: #e5690e;
}

body.dark input,
body.dark textarea,
body.dark select {
  background: #020617;
  border-color: #1e293b;
  color: #e5e7eb;
}

body.dark table th {
  background: #e5690e;
}

body.dark table td {
  border-color: #1e293b;
}

body.dark tr:hover {
  background: #1e293b;
}

body.dark .loader {
  background: rgba(2, 6, 23, 0.85);
}

body.dark .loader p {
  color: #e5e7eb;
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: capitalize;
}

.badge-youtube {
  background: #ff0000;
  color: #fff;
}

.badge-course {
  background: #16a34a;
  color: #fff;
}

.badge-website {
  background: #2563eb;
  color: #fff;
}

.badge-article {
  background: #9333ea;
  color: #fff;
}
