/* =============================================
   منصة أنشطة جيل الصحوة - ملف التصميم الرئيسي
   ============================================= */

:root {
  --primary: #17698B;
  --primary-dark: #0f4d66;
  --primary-light: #1e87af;
  --secondary: #38A2B0;
  --light: #D3D1CC;
  --accent: #8B7055;
  --accent-dark: #6e5742;

  --bg: #f0f2f5;
  --sidebar-bg: #0d1b2a;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;

  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,.12);

  --transition: .2s ease;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
.fw-600 { font-weight: 600; }
.required::after { content: ' *'; color: #dc3545; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 72px;
}

.brand-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  flex-shrink: 0;
}

.brand-text { overflow: hidden; }
.brand-name { display: block; color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }
.brand-sub  { display: block; color: rgba(255,255,255,.45); font-size: 11px; white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 16px 8px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section-title {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  margin-bottom: 2px;
  color: rgba(255,255,255,.65);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
  background: rgba(23, 105, 139, .35);
  color: #fff;
}
.nav-item.active { background: var(--primary); color: #fff; }

.nav-item i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.user-avatar i { font-size: 28px; color: rgba(255,255,255,.5); }
.user-name { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: rgba(255,255,255,.4); }

.logout-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(220,53,69,.15);
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 15px;
  flex-shrink: 0;
  transition: var(--transition);
}
.logout-btn:hover { background: rgba(220,53,69,.3); color: #ff4757; }

/* ---- Main Wrapper ---- */
.main-wrapper {
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ---- Top Navbar ---- */
.top-navbar {
  height: 64px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}

.sidebar-toggle {
  background: none; border: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.navbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.badge-role {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
}
.badge-role.super { background: #fff8e1; color: #d97706; }
.badge-role.admin  { background: #eff6ff; color: var(--primary); }

/* ---- Page Content ---- */
.page-content {
  flex: 1;
  padding: 24px;
}

.page-footer {
  padding: 16px 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

/* ---- Content Card ---- */
.content-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.card-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.card-header-title i { color: var(--primary); font-size: 16px; }

/* ---- Stat Cards ---- */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
}

.stat-primary::before { background: var(--primary); }
.stat-secondary::before { background: var(--secondary); }
.stat-accent::before { background: var(--accent); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-primary .stat-icon  { background: #e8f4f9; color: var(--primary); }
.stat-secondary .stat-icon { background: #e6f7f8; color: var(--secondary); }
.stat-accent .stat-icon    { background: #f3ede6; color: var(--accent); }

.stat-info { flex: 1; }
.stat-number { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label  { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

.stat-link {
  width: 100%;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.stat-link:hover { color: var(--primary-dark); }

/* ---- Table ---- */
.table { font-size: 14px; }
.table thead th {
  background: #f9fafb;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}
.table tbody td { padding: 12px 16px; border-color: var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #f9fafb; }

/* ---- Activity Thumbnail ---- */
.activity-thumb {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.activity-thumb-placeholder {
  width: 40px; height: 40px;
  background: #f3f4f6;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid var(--border);
}

/* ---- Badge Cat ---- */
.badge-cat {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #e8f4f9;
  color: var(--primary);
  margin: 2px;
  border: 1px solid rgba(23,105,139,.15);
}

.badge-cat-lg { padding: 5px 14px; font-size: 13px; }

/* ---- Form Sections ---- */
.form-section {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.form-section-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title i { font-size: 15px; }

.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Cairo', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23,105,139,.12);
}

.form-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; }

/* ---- Categories Checkbox ---- */
.categories-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.cat-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.cat-checkbox input[type="checkbox"] { display: none; }

.cat-label {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: #f3f4f6;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: var(--transition);
  user-select: none;
}

.cat-checkbox input:checked + .cat-label {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.cat-label:hover { background: #e8f4f9; color: var(--primary); }

/* ---- Image Upload ---- */
.image-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.image-upload-zone:hover,
.image-upload-zone.drag-over { border-color: var(--primary); background: #f0f9ff; }

.image-preview {
  max-height: 180px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.current-image-preview {
  max-height: 160px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
}

/* ---- Activity Detail ---- */
.activity-detail-image img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
}

.activity-detail-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.detail-section {
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}
.detail-section:last-child { border-bottom: none; }

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- Info List ---- */
.info-list { list-style: none; padding: 0; margin: 0; }
.info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}
.info-item:last-child { border-bottom: none; }
.info-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.info-value  { font-size: 14px; font-weight: 600; color: var(--text); }

/* ---- Category List ---- */
.category-list { list-style: none; padding: 0; margin: 0; }
.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  font-weight: 500;
}
.category-item:last-child { border-bottom: none; }

/* ---- Log List ---- */
.log-list { padding: 0; }
.log-item {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: background var(--transition);
}
.log-item:last-child { border-bottom: none; }
.log-item:hover { background: #f9fafb; }

.log-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.log-content { flex: 1; }
.log-text { font-size: 14px; font-weight: 600; color: var(--text); }
.log-action { font-weight: 400; color: var(--primary); margin-right: 4px; }
.log-description { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.log-time { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- Admin Avatar ---- */
.admin-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-warning { font-family: 'Cairo', sans-serif; font-weight: 600; }
.btn-danger  { font-family: 'Cairo', sans-serif; font-weight: 600; }
.btn         { font-family: 'Cairo', sans-serif; }

/* ---- Alerts ---- */
.alert { border-radius: var(--radius-sm); font-weight: 500; font-size: 14px; }

/* ---- Login Page ---- */
.login-body {
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1a3a4a 50%, var(--primary-dark) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-wrapper { width: 100%; max-width: 420px; }

.login-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-brand { text-align: center; margin-bottom: 32px; }

.login-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(23,105,139,.3);
}

.login-title { font-size: 24px; font-weight: 800; color: var(--text); margin: 0; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ---- Pagination ---- */
.pagination .page-link {
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  color: var(--primary);
  border-color: var(--border);
}
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ---- Sidebar collapsed ---- */
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
.sidebar-collapsed .main-wrapper { margin-right: var(--sidebar-collapsed); }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .nav-section-title,
.sidebar-collapsed .user-details { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar-collapsed .sidebar-footer { justify-content: center; flex-direction: column; gap: 8px; }
.sidebar-collapsed .logout-btn { margin: 0; }

/* ---- Responsive ---- */
@media (max-width: 991px) {
  .sidebar { transform: translateX(100%); box-shadow: none; }
  .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-md); }
  .main-wrapper { margin-right: 0 !important; }
  .page-content { padding: 16px; }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 575px) {
  .login-card { padding: 24px; }
  .stat-card { padding: 16px; }
  .stat-number { font-size: 26px; }
}

/* ---- Bootstrap overrides ---- */
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-md); }
.modal-header { border-bottom-color: var(--border); padding: 16px 20px; }
.modal-footer { border-top-color: var(--border); padding: 12px 20px; }
.modal-body { padding: 20px; }

.dropdown-menu { border-radius: var(--radius-sm); border-color: var(--border); box-shadow: var(--shadow-md); }
