/* ===== ADMIN DASHBOARD STYLES ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --bg-input: #0f172a;
  --border: #2a3550;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent-gold: #ffd700;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-purple: #a855f7;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --radius: 12px;
  --transition: .3s ease;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1a3e 50%, #0a0e1a 100%);
  padding: 20px;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 50px 40px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow), 0 0 60px rgba(255,215,0,.05);
  text-align: center;
  animation: fadeUp .6s ease;
}

@keyframes fadeUp {
  from { opacity:0; transform:translateY(30px); }
  to { opacity:1; transform:translateY(0); }
}

.login-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 20px;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(255,215,0,.3));
}

.login-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: .95rem;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
  text-align: right;
}

.form-group label {
  display: block;
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: .95rem;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(255,215,0,.15);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.input-icon-wrap input {
  padding-right: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), #e6a800);
  color: #0a0e1a;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,215,0,.3);
}

.btn-success { background: var(--accent-green); color: #fff; }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-info { background: var(--accent-blue); color: #fff; }
.btn-warning { background: var(--accent-orange); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-xs { padding: 5px 10px; font-size: .8rem; border-radius: 6px; }

.login-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--accent-red);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
  display: none;
}

.login-error.show { display: block; animation: shake .4s ease; }

@keyframes shake {
  0%,100% { transform:translateX(0); }
  25% { transform:translateX(-8px); }
  75% { transform:translateX(8px); }
}

.login-footer {
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: .8rem;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-brand img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: contain;
}

.sidebar-brand h3 {
  font-size: 1.1rem;
  color: var(--accent-gold);
}

.sidebar-brand span {
  font-size: .75rem;
  color: var(--text-secondary);
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  transition: var(--transition);
  border-right: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  color: var(--accent-gold);
  background: rgba(255,215,0,.05);
  border-right-color: var(--accent-gold);
}

.sidebar-nav li a i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-right: 260px;
  padding: 30px;
  min-height: 100vh;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.top-bar h1 {
  font-size: 1.6rem;
  color: var(--accent-gold);
}

.top-bar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-gold);
}

.stat-card .stat-label {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Section Panels */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,215,0,.02);
}

.panel-header h2 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  padding: 24px;
}

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

.books-table th {
  background: var(--bg-input);
  padding: 12px 16px;
  font-size: .85rem;
  color: var(--text-secondary);
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.books-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: middle;
}

.books-table tr:hover td {
  background: rgba(255,215,0,.03);
}

.books-table .book-thumb {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
}

.badge-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}

.badge-tag.sale { background: rgba(239,68,68,.15); color: var(--accent-red); }
.badge-tag.new { background: rgba(34,197,94,.15); color: var(--accent-green); }
.badge-tag.best { background: rgba(168,85,247,.15); color: var(--accent-purple); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
}

.status-dot.active { background: var(--accent-green); }
.status-dot.inactive { background: var(--accent-red); }

/* Actions */
.action-btns {
  display: flex;
  gap: 6px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity:0; }
  to { opacity:1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: slideUp .3s ease;
}

@keyframes slideUp {
  from { transform:translateY(30px); opacity:0; }
  to { transform:translateY(0); opacity:1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--accent-gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.modal-close:hover { color: var(--accent-red); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

/* Form Grid */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

.form-group.full { grid-column: 1 / -1; }

/* FAQ Builder */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  position: relative;
}

.faq-item .remove-faq {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent-red);
  color: #fff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-faq-btn {
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-secondary);
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: .9rem;
  transition: var(--transition);
  width: 100%;
}

.add-faq-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Videos Builder */
.video-list { display: flex; flex-direction: column; gap: 8px; }

.video-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.video-item input { flex: 1; }

.video-item .remove-video {
  background: var(--accent-red);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 30px;
  background: var(--bg-card);
  border: 1px solid var(--accent-green);
  color: var(--text-primary);
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error { border-color: var(--accent-red); }

/* View Toggle */
.view-section { display: none; }
.view-section.active { display: block; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    width: 0;
    padding: 0;
    overflow: hidden;
  }
  .sidebar.open { width: 260px; padding: 20px 0; }
  .main-content { margin-right: 0; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr; }
  .top-bar { flex-direction: column; gap: 12px; text-align: center; }
}

@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .books-table { font-size: .8rem; }
  .books-table th, .books-table td { padding: 8px; }
  .modal { margin: 10px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-gold); }
