/**
 * School Kalamina — Design System
 * استخراج‌شده از school.kalamina.ir/index.html
 * فونت: Vazirmatn | جهت: RTL | زبان: فارسی
 */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Primary (بنفش گرادیان) ── */
  --color-primary-start: #667eea;
  --color-primary-end:   #764ba2;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* ── Accent (نارنجی) ── */
  --color-accent-start: #ff6b35;
  --color-accent-end:   #f7931e;
  --gradient-accent: linear-gradient(135deg, #ff6b35, #f7931e);

  /* ── Role colors ── */
  --color-admin:   #dc2626;
  --color-admin-end: #ef4444;
  --color-teacher: #16a34a;
  --color-teacher-end: #22c55e;
  --color-student: #2563eb;
  --color-student-end: #3b82f6;
  --color-parent:  #7c3aed;
  --color-parent-end: #8b5cf6;
  --color-manager: #0891b2;

  /* ── Semantic ── */
  --color-success: #16a34a;
  --color-danger:  #dc2626;
  --color-warning: #f59e0b;
  --color-info:    #2563eb;

  /* ── Neutrals ── */
  --color-bg:          #f8fafc;
  --color-surface:     #ffffff;
  --color-text:        #333333;
  --color-text-muted:  #666666;
  --color-text-light:  #999999;
  --color-border:      #e1e5e9;
  --color-border-focus:#ff6b35;

  /* ── Typography ── */
  --font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --font-size-xs:  0.75rem;
  --font-size-sm:  0.875rem;
  --font-size-base:1rem;
  --font-size-lg:  1.125rem;
  --font-size-xl:  1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;

  /* ── Spacing ── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* ── Radius ── */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   15px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm:  0 2px 10px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg:  0 10px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.2);
  --shadow-accent: 0 4px 15px rgba(255, 107, 53, 0.3);

  /* ── Layout ── */
  --header-height: 72px;
  --sidebar-width: 260px;
  --container-max: 1200px;
  --transition: all 0.25s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

body.landing-mode {
  background: var(--gradient-primary);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.3); }

.btn-danger  { background: var(--color-danger);  color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-info    { background: var(--color-info);    color: #fff; }
.btn-ghost   { background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border); }
.btn-ghost:hover { border-color: var(--color-accent-start); color: var(--color-accent-start); }

.btn-sm { padding: 6px 14px; font-size: var(--font-size-sm); }
.btn-lg { padding: 14px 32px; font-size: var(--font-size-lg); }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-stat {
  border-right: 4px solid;
  padding: var(--space-5) var(--space-6);
}
.card-stat.income  { border-right-color: var(--color-success); }
.card-stat.expense { border-right-color: var(--color-danger); }
.card-stat.profit  { border-right-color: var(--color-info); }
.card-stat.pending { border-right-color: var(--color-warning); }

.card-stat .stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.card-stat .stat-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
}

/* ── Forms ── */
.form-group { margin-bottom: var(--space-4); }

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}
.form-control::placeholder { color: var(--color-text-light); }

select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  padding: var(--space-4);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: var(--transition);
}
.modal-overlay.active .modal-box { transform: translateY(0); }

.modal-header {
  text-align: center;
  padding: var(--space-8) var(--space-6) var(--space-4);
}
.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--gradient-accent);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.modal-header h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text);
}
.modal-header p {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}
.modal-body { padding: 0 var(--space-6) var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6) var(--space-6); }

/* ── Role badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}
.badge-admin   { background: #fee2e2; color: #dc2626; }
.badge-teacher { background: #dcfce7; color: #16a34a; }
.badge-student { background: #dbeafe; color: #2563eb; }
.badge-parent  { background: #f3e8ff; color: #7c3aed; }
.badge-manager { background: #cffafe; color: #0891b2; }

/* ── Avatar ── */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar-admin   { background: linear-gradient(135deg, #dc2626, #ef4444); }
.avatar-teacher { background: linear-gradient(135deg, #16a34a, #22c55e); }
.avatar-student { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.avatar-parent  { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.avatar-manager { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.avatar-sm { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--color-accent-start); }
.tab-btn.active {
  color: var(--color-accent-start);
  border-bottom-color: var(--color-accent-start);
  font-weight: 600;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}
table.data-table th {
  background: var(--color-bg);
  padding: 12px 16px;
  text-align: right;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
}
table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}
table.data-table tr:hover td { background: #f1f5f9; }

/* ── Notification toast ── */
.toast-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 500;
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 280px;
}
.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); color: #333; }
.toast-info    { background: var(--color-info); }

@keyframes slideIn {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Status indicator ── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-online { background: var(--color-success); }
.status-offline { background: var(--color-danger); }

/* ── Grid helpers ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-5); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Utility ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
