/* ===== Rakeen Dashboard - Custom Styles ===== */

:root {
  --rk-primary: #1f6f5c;
  --rk-primary-dark: #155544;
  --rk-accent: #c9a35b;
  --rk-bg: #f4f6f9;
  --rk-sidebar-bg: #1a2733;
  --rk-sidebar-hover: #243646;
  --rk-text-light: #cdd5df;
  --rk-border: #e3e7ee;
}

* {
  font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
}

body {
  background-color: var(--rk-bg);
  margin: 0;
  min-height: 100vh;
}

/* ===== Login Page ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--rk-primary) 0%, var(--rk-primary-dark) 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.login-header {
  background: var(--rk-primary);
  color: #fff;
  padding: 32px 24px 24px;
  text-align: center;
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.login-header p {
  margin: 0;
  opacity: 0.85;
  font-size: 0.95rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: var(--rk-accent);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 28px;
  color: #fff;
}

.login-body {
  padding: 28px 24px 24px;
}

.login-credentials-hint {
  background: #f8f9fa;
  border: 1px dashed var(--rk-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 16px;
}

.login-credentials-hint code {
  color: var(--rk-primary);
  font-weight: 600;
}

/* ===== App Shell ===== */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--rk-sidebar-bg);
  color: var(--rk-text-light);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand .logo-circle {
  width: 130px;
  height: 64px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-brand .logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand h2 {
  font-size: 1.15rem;
  margin: 0;
  color: #fff;
  font-weight: 700;
}

.sidebar-brand small {
  display: block;
  font-size: 0.72rem;
  opacity: 0.65;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.sidebar-nav .nav-section {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 12px 6px;
  letter-spacing: 0.5px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--rk-text-light);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 4px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: var(--rk-sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--rk-primary);
  color: #fff;
}

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

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== Main content ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--rk-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: #2c3e50;
}

.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4f6f9;
  padding: 6px 14px 6px 6px;
  border-radius: 30px;
}

.topbar .user-avatar {
  width: 36px;
  height: 36px;
  background: var(--rk-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.topbar .user-info strong {
  display: block;
  font-size: 0.9rem;
  color: #2c3e50;
}

.topbar .user-info small {
  font-size: 0.72rem;
  color: #6c757d;
}

.content {
  padding: 24px;
  flex: 1;
}

/* ===== KPI Cards ===== */
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--rk-border);
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.kpi-card .kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  flex-shrink: 0;
}

.kpi-card .kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 2px;
}

.kpi-icon.bg-primary { background: var(--rk-primary); }
.kpi-icon.bg-info    { background: #3498db; }
.kpi-icon.bg-warning { background: #f39c12; }
.kpi-icon.bg-success { background: #27ae60; }
.kpi-icon.bg-danger  { background: #e74c3c; }
.kpi-icon.bg-accent  { background: var(--rk-accent); }

/* ===== Cards & Panels ===== */
.panel {
  background: #fff;
  border: 1px solid var(--rk-border);
  border-radius: 12px;
  margin-bottom: 24px;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rk-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: #2c3e50;
}

.panel-body {
  padding: 20px;
}

/* ===== Tables ===== */
.table {
  margin: 0;
}

.table thead th {
  background: #f8f9fa;
  border-bottom: 2px solid var(--rk-border);
  color: #495057;
  font-weight: 700;
  font-size: 0.85rem;
}

.table tbody td {
  vertical-align: middle;
  font-size: 0.92rem;
}

/* ===== Role Badges ===== */
.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.role-admin      { background: #f0e6ff; color: #6f42c1; }
.role-supervisor { background: #d1ecf1; color: #0c5460; }
.role-organizer  { background: #d4edda; color: #155724; }

/* ===== Zone Cards ===== */
.zone-card {
  background: #fff;
  border: 1px solid var(--rk-border);
  border-radius: 12px;
  padding: 18px;
  height: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}

.zone-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.zone-card .zone-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rk-primary);
  margin-bottom: 8px;
}

.zone-card .zone-supervisor {
  font-size: 0.82rem;
  color: #6c757d;
  margin-bottom: 14px;
}

.zone-card .capacity-bar {
  background: #f0f3f7;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin: 10px 0 6px;
}

.zone-card .capacity-fill {
  background: var(--rk-primary);
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

.zone-card .capacity-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #6c757d;
  margin-bottom: 14px;
}

/* ===== Form file preview ===== */
.form-file-preview {
  border: 1px dashed var(--rk-border);
  border-radius: 8px;
  padding: 8px;
  background: #f8f9fa;
  text-align: center;
}

.form-file-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
  display: inline-block;
}

/* ===== About Us Page ===== */

/* --- Animations --- */
@keyframes about-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes about-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes about-pop-in {
  0%   { opacity: 0; transform: translateY(20px) scale(0.96); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes about-pulse-decor {
  0%, 100% { transform: scale(1)   translate(0, 0);   opacity: 0.18; }
  50%      { transform: scale(1.15) translate(8px, -6px); opacity: 0.28; }
}

@keyframes about-pulse-decor-rev {
  0%, 100% { transform: scale(1)   translate(0, 0);     opacity: 0.06; }
  50%      { transform: scale(1.12) translate(-10px, 6px); opacity: 0.12; }
}

@keyframes about-shine {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Hero --- */
.about-hero {
  background: linear-gradient(135deg, var(--rk-primary) 0%, var(--rk-primary-dark) 50%, var(--rk-primary) 100%);
  background-size: 200% 200%;
  color: #fff;
  border: none;
  position: relative;
  overflow: hidden;
  animation:
    about-fade-up 0.7s ease-out both,
    about-shine 12s ease-in-out infinite;
}

/* Hero with custom background image: image + translucent primary overlay */
.about-hero.has-bg-image {
  background:
    linear-gradient(135deg,
      rgba(31, 111, 92, 0.82) 0%,
      rgba(21, 85, 68, 0.78) 50%,
      rgba(31, 111, 92, 0.82) 100%),
    var(--about-hero-bg, none) center/cover no-repeat;
  background-size: cover;
  /* Disable the shine animation when an image is present */
  animation: about-fade-up 0.7s ease-out both;
}

/* Admin controls in the corner of the hero */
.about-hero-edit-controls {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 3;
  display: flex;
  gap: 6px;
}

.about-hero-edit-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(4px);
  font-size: 0.95rem;
}

.about-hero-edit-btn:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(1.08);
}

.about-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  inset-inline-end: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(201, 163, 91, 0.18);
  animation: about-pulse-decor 6s ease-in-out infinite;
}

.about-hero::after {
  content: '';
  position: absolute;
  bottom: -60px;
  inset-inline-start: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  animation: about-pulse-decor-rev 7s ease-in-out infinite;
}

.about-hero-body {
  padding: 36px 32px;
  position: relative;
  z-index: 1;
}

.about-hero-badge {
  display: inline-block;
  background: var(--rk-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
  animation: about-fade-in 0.8s ease-out 0.15s both;
  box-shadow: 0 4px 12px rgba(201, 163, 91, 0.4);
}

.about-hero-badge i {
  display: inline-block;
  animation: about-pulse-decor 2.4s ease-in-out infinite;
}

.about-hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 16px;
  color: #fff;
  animation: about-fade-up 0.7s ease-out 0.3s both;
}

.about-hero-text {
  font-size: 1rem;
  line-height: 2;
  margin: 0;
  white-space: pre-wrap;
  color: rgba(255, 255, 255, 0.92);
  max-width: 850px;
  animation: about-fade-up 0.8s ease-out 0.5s both;
}

/* --- Gallery panel --- */
.about-gallery-panel {
  animation: about-fade-up 0.7s ease-out 0.7s both;
}

/* --- Image cards (staggered) --- */
.about-image-card {
  background: #fff;
  border: 1px solid var(--rk-border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  height: 100%;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: about-pop-in 0.5s ease-out both;
  animation-delay: calc(var(--card-index, 0) * 80ms + 0.8s);
}

.about-image-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.12);
}

.about-image-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f0f3f7;
}

.about-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.about-image-card:hover .about-image-wrap img {
  transform: scale(1.08);
}

.about-image-caption {
  padding: 10px 12px;
  font-size: 0.88rem;
  color: #2c3e50;
  font-weight: 600;
  border-top: 1px solid var(--rk-border);
}

.about-image-actions {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.about-image-card:hover .about-image-actions {
  opacity: 1;
  transform: translateY(0);
}

/* --- Respect reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .about-hero,
  .about-hero::before,
  .about-hero::after,
  .about-hero-badge,
  .about-hero-badge i,
  .about-hero-title,
  .about-hero-text,
  .about-gallery-panel,
  .about-image-card,
  .about-image-wrap img {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Holy Site Cards ===== */
.site-card {
  background: #fff;
  border: 1px solid var(--rk-border);
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}

.site-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.site-card-image {
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: var(--rk-primary);
  position: relative;
}

.site-card-dates {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: var(--rk-accent) !important;
  color: #fff;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 20px;
}

.site-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.site-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 10px;
}

.site-card-desc {
  font-size: 0.9rem;
  color: #5a6573;
  line-height: 1.7;
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.site-card-coords {
  font-size: 0.82rem;
  color: #6c757d;
  background: #f8f9fa;
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: auto;
}

.site-card-coords code {
  color: var(--rk-primary);
  font-weight: 600;
  background: transparent;
  padding: 0;
}

/* ===== Tabs ===== */
.nav-tabs .nav-link {
  color: #6c757d;
  font-weight: 600;
  border: none;
  padding: 10px 18px;
  border-bottom: 3px solid transparent;
}

.nav-tabs .nav-link.active {
  color: var(--rk-primary);
  background: transparent;
  border-bottom-color: var(--rk-primary);
}

.nav-tabs {
  border-bottom: 1px solid var(--rk-border);
  margin-bottom: 18px;
}

/* ===== Buttons ===== */
.btn-primary {
  background-color: var(--rk-primary);
  border-color: var(--rk-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--rk-primary-dark);
  border-color: var(--rk-primary-dark);
}

/* ===== Mobile Sidebar Toggle ===== */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  color: #2c3e50;
  cursor: pointer;
}

@media (max-width: 991.98px) {
  .sidebar-toggle {
    display: inline-block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 1050;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
  }

  .sidebar-backdrop.show {
    display: block;
  }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #adb5bd;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

/* ===== Loading Spinner ===== */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--rk-primary);
}
