/* ============================================
   Ahlul Bayt Wisdom — Shared Styles
   ============================================ */

:root {
  --primary: #1a3a2a;
  --primary-light: #2d5a3f;
  --accent: #c9a84c;
  --accent-light: #e6c75a;
  --bg: #f8f6f0;
  --bg-card: #ffffff;
  --text: #2c2c2c;
  --text-light: #666666;
  --text-muted: #999999;
  --border: #e0ddd4;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --danger: #c62828;
  --danger-bg: #ffebee;
  --warning: #f57f17;
  --warning-bg: #fff8e1;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-arabic: 'Amiri', 'Traditional Arabic', serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Header / Navbar ---- */
.navbar {
  background: var(--primary);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}

.navbar-brand .logo-icon {
  font-size: 1.8rem;
}

.navbar-brand h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.navbar-brand .subtitle {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  display: block;
  margin-top: -2px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---- Language Flags ---- */
.lang-switcher {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-btn {
  width: 32px;
  height: 22px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,0.15);
  transition: all 0.2s;
  text-decoration: none;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.lang-btn.active {
  border-color: var(--accent);
  background: rgba(201,168,76,0.3);
}

.lang-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Hero Section (Public page) ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 4rem 2rem;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a84c' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
}

.hero h2 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 550px;
  margin: 0 auto;
}

.bismillah {
  font-family: var(--font-arabic);
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 1rem;
  direction: rtl;
}

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

/* ---- Video Grid (Public) ---- */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.video-card .thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.video-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-card .thumb .play-icon {
  position: absolute;
  width: 56px;
  height: 56px;
  background: rgba(201,168,76,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.video-card .thumb .play-icon:hover {
  transform: scale(1.1);
}

.video-card .thumb .play-icon::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 18px solid #fff;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  margin-left: 4px;
}

.video-card .card-body {
  padding: 1rem 1.2rem;
}

.video-card .card-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.video-card .card-body .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.video-card .card-body .tag {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 0.5rem;
}

/* ---- Login Overlay (Alims page) ---- */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary) 0%, #0d1f15 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-box .logo-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.login-box h2 {
  color: var(--primary);
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.login-box .login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-box input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 4px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus {
  border-color: var(--accent);
}

.login-box .error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  display: none;
}

.login-box .btn-login {
  width: 100%;
  margin-top: 1rem;
  padding: 12px;
  background: var(--primary);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-box .btn-login:hover {
  background: var(--primary-light);
}

.login-lang-picker {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.login-flag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.login-flag:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.5);
}

.login-flag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(42,100,62,0.4);
}

/* ---- Dashboard (Alims page) ---- */
.dashboard {
  display: none;
}

.dashboard.active {
  display: block;
}

.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.pending .stat-number { color: var(--warning); }
.stat-card.approved .stat-number { color: var(--success); }
.stat-card.rejected .stat-number { color: var(--danger); }

/* ---- Video Review List ---- */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.review-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: 1rem;
  align-items: center;
  transition: box-shadow 0.2s;
}

.review-item:hover {
  box-shadow: var(--shadow-lg);
}

.review-item .thumb-sm {
  width: 160px;
  min-width: 160px;
  aspect-ratio: 16/9;
  background: var(--primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 2rem;
}

.review-item .thumb-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-item .review-info {
  flex: 1;
}

.review-item .review-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.review-item .review-info .desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-item .review-info .review-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.review-actions {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  min-width: 110px;
}

.btn-approve {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}
.btn-approve:hover {
  background: var(--success);
  color: #fff;
}

.btn-reject {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-reject:hover {
  background: var(--danger);
  color: #fff;
}

.btn-preview {
  background: var(--bg);
  color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-preview:hover {
  background: var(--border);
  color: var(--text);
}

/* ---- Status badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }

/* ---- Video Preview Modal ---- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 1.1rem;
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-body video,
.modal-body iframe {
  width: 100%;
  aspect-ratio: 9/16;
  max-height: 400px;
  border-radius: var(--radius-sm);
  background: #000;
}

.modal-body .video-details {
  margin-top: 1rem;
}

.modal-body .video-details h4 {
  margin-bottom: 0.3rem;
}

.modal-body .video-details p {
  font-size: 0.9rem;
  color: var(--text-light);
}

.modal-footer {
  padding: 1rem 1.5rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ---- Loading spinner ---- */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 3rem;
  color: var(--text-muted);
}

/* ---- Filter/Search bar ---- */
.toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar select,
.toolbar input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-card);
  outline: none;
}

.toolbar select:focus,
.toolbar input:focus {
  border-color: var(--accent);
}

/* ---- Logout button ---- */
.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .hero {
    padding: 2.5rem 1rem;
  }

  .hero h2 {
    font-size: 1.6rem;
  }

  .container {
    padding: 1rem;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .review-item {
    flex-direction: column;
    align-items: stretch;
  }

  .review-item .thumb-sm {
    width: 100%;
  }

  .review-actions {
    flex-direction: row;
  }

  .stats-bar {
    flex-direction: column;
  }
}
