/* ═══════════════════════════════════════════════════════════
   نظام النادي الصيفي - التخطيط (Layout)
   ═══════════════════════════════════════════════════════════ */

/* ════════════════════════════════════
   الحاوي الرئيسي
   ════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm {
  max-width: 640px;
}

.container-md {
  max-width: 860px;
}

.container-fluid {
  width: 100%;
  padding: 0 var(--space-6);
}

/* ════════════════════════════════════
   الشبكة (Grid)
   ════════════════════════════════════ */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ════════════════════════════════════
   صفحات تسجيل الدخول والتسجيل (Auth Layout)
   ════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

/* خلفية متحركة */
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
  z-index: 0;
}

.auth-page::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 120%;
  height: 60%;
  background: radial-gradient(ellipse at center bottom, rgba(255,255,255,0.15) 0%, transparent 70%);
  z-index: 0;
}

/* دوائر الخلفية المتحركة */
.auth-bg-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.auth-bg-shapes .shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.08;
  background: white;
}

.auth-bg-shapes .shape:nth-child(1) {
  width: 400px; height: 400px;
  top: -100px; right: -100px;
  animation: floatShape 15s ease-in-out infinite;
}

.auth-bg-shapes .shape:nth-child(2) {
  width: 250px; height: 250px;
  bottom: -50px; left: 10%;
  animation: floatShape 20s ease-in-out infinite reverse;
}

.auth-bg-shapes .shape:nth-child(3) {
  width: 180px; height: 180px;
  top: 30%; left: 5%;
  animation: floatShape 18s ease-in-out infinite 2s;
}

.auth-bg-shapes .shape:nth-child(4) {
  width: 120px; height: 120px;
  bottom: 20%; right: 15%;
  animation: floatShape 12s ease-in-out infinite 1s;
}

@keyframes floatShape {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -20px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(10px, -10px) scale(1.02); }
}

.auth-container {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-2xl);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  background: var(--gradient-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  font-size: var(--font-size-3xl);
  color: var(--text-white);
  box-shadow: var(--shadow-orange);
}

.auth-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.auth-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 0;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--ocean-blue);
  font-weight: var(--font-weight-semibold);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ════════════════════════════════════
   تخطيط لوحة التحكم (Dashboard Layout)
   ════════════════════════════════════ */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* ── الشريط الجانبي (Sidebar) ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gradient-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sidebar);
  transition: all var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--gradient-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  flex-shrink: 0;
}

.sidebar-brand {
  flex: 1;
  overflow: hidden;
}

.sidebar-brand-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}

.sidebar-brand-sub {
  font-size: var(--font-size-xs);
  opacity: 0.7;
  white-space: nowrap;
}

.sidebar-nav {
  padding: var(--space-4) var(--space-3);
  flex: 1;
}

.sidebar-section-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.4);
  padding: var(--space-3) var(--space-3) var(--space-2);
  margin-top: var(--space-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  color: rgba(255,255,255,0.75);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-family: var(--font-family);
}

.sidebar-item i {
  width: 22px;
  text-align: center;
  font-size: var(--font-size-base);
  flex-shrink: 0;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-white);
}

.sidebar-item.active {
  background: rgba(255,255,255,0.15);
  color: var(--text-white);
  font-weight: var(--font-weight-semibold);
}

.sidebar-item .badge {
  margin-right: auto;
  margin-left: 0;
  background: rgba(255,255,255,0.2);
  color: var(--text-white);
  font-size: 10px;
  padding: 2px 8px;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── المحتوى الرئيسي ── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── الشريط العلوي (Topbar) ── */
.topbar {
  height: var(--topbar-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.topbar-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.topbar-user:hover {
  background: var(--bg-secondary);
}

.topbar-user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.topbar-user-role {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* زر القائمة للجوال */
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-size-xl);
}

/* ── محتوى الصفحة ── */
.page-content {
  flex: 1;
  padding: var(--space-6);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: 0;
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
  margin-bottom: 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ════════════════════════════════════
   بوابة ولي الأمر (Parent Portal Layout)
   ════════════════════════════════════ */
.parent-page {
  min-height: 100vh;
  background: var(--bg-primary);
}

.parent-header {
  background: var(--gradient-hero);
  padding: var(--space-8) var(--space-6);
  color: var(--text-white);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.parent-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg-primary);
  border-radius: 40px 40px 0 0;
}

.parent-content {
  padding: var(--space-6);
  max-width: 700px;
  margin: 0 auto;
  margin-top: -20px;
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════
   واجهة الطالب (Student Mobile Layout)
   ════════════════════════════════════ */
.student-page {
  min-height: 100vh;
  background: var(--bg-primary);
  padding-bottom: 80px; /* مساحة للزر العائم */
  max-width: 480px;
  margin: 0 auto;
}

.student-header {
  background: var(--gradient-hero);
  padding: var(--space-6);
  padding-bottom: var(--space-12);
  color: var(--text-white);
  position: relative;
  overflow: hidden;
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.student-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.student-greeting {
  font-size: var(--font-size-md);
  opacity: 0.9;
  margin-bottom: var(--space-1);
  position: relative;
}

.student-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  position: relative;
}

.student-body {
  padding: var(--space-5);
  margin-top: calc(-1 * var(--space-8));
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════
   تخطيط شاشة QR
   ════════════════════════════════════ */
.qr-display-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  color: var(--text-white);
  padding: var(--space-6);
  text-align: center;
}

.qr-display-card {
  background: var(--bg-white);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-2xl);
  max-width: 400px;
  width: 100%;
}

.qr-timer {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--ocean-blue);
  margin-top: var(--space-4);
}

/* ════════════════════════════════════
   غطاء الشريط الجانبي (Mobile Overlay)
   ════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: calc(var(--z-sidebar) - 1);
}

.sidebar-overlay.active {
  display: block;
}

/* ════════════════════════════════════
   قسم الصفحة
   ════════════════════════════════════ */
.section {
  margin-bottom: var(--space-8);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-title i {
  color: var(--ocean-blue);
}
