/* assets/css/style.css */
:root {
  --primary: #0B1F3A;
  --primary-light: #123A63;
  --secondary: #D4AF37;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #111827;
  --muted: #6B7280;
  --success: #16A34A;
  --danger: #DC2626;
  --warning: #F59E0B;
  --info: #2563EB;
  --radius: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Noto Sans Arabic', sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.desktop-sidebar {
  width: 260px;
  background-color: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary);
  border-bottom: 1px solid var(--primary-light);
}

.sidebar-logo i {
  margin-left: 8px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-nav a, .logout-btn {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  color: #d1d5db;
  transition: all 0.2s;
}

.sidebar-nav a i, .logout-btn i {
  width: 24px;
  margin-left: 12px;
  font-size: 1.1rem;
}

.sidebar-nav a:hover, .logout-btn:hover {
  background-color: var(--primary-light);
  color: #fff;
}

.sidebar-nav a.active {
  background-color: var(--secondary);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--primary-light);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-right: 260px;
  display: flex;
  flex-direction: column;
}

.top-header {
  background-color: var(--primary);
  color: #fff;
  padding: 16px 24px;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-header h2 {
  font-size: 1.2rem;
  color: var(--secondary);
}

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

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 100;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
}

.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
  gap: 4px;
}

.mobile-bottom-nav a.active {
  color: var(--primary);
}

.mobile-bottom-nav a i {
  font-size: 1.2rem;
}

/* UI Elements */
.card {
  background-color: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid #f3f4f6;
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  padding: 16px;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* Tabs */
.tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  padding: 8px 16px;
  border-radius: 20px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background-color: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
  box-shadow: 0 2px 4px rgba(11,31,58,0.1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Action Buttons (Icon Only) */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px; /* iOS square-rounded */
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
}

.btn-icon:hover {
  background-color: #f3f4f6;
  color: var(--primary);
}

.btn-icon.edit:hover { color: #b45309; background: #fefce8; }
.btn-icon.delete:hover { color: var(--danger); background: #fef2f2; }
.btn-icon.view:hover { color: var(--info); background: #eff6ff; }
.btn-icon.add {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(11,31,58,0.2);
}
.btn-icon.add:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

.hidden { display: none !important; }


.form-group {
  margin-bottom: 16px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 31, 58, 0.1);
}

/* Accordion */
.accordion-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--card);
}

.accordion-header {
  padding: 16px;
  background-color: #f9fafb;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--primary);
}

.accordion-body {
  padding: 16px;
  display: none;
  border-top: 1px solid #e5e7eb;
}

.accordion-body.active {
  display: block;
}

/* Minimal Table */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.table th, .table td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.table th {
  background-color: #f9fafb;
  color: var(--muted);
  font-weight: 600;
}

.table tbody tr:hover {
  background-color: #f3f4f6;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}
.status-active { background: #dcfce7; color: #166534; }
.status-stopped { background: #fee2e2; color: #991b1b; }
.status-graduated { background: #e0e7ff; color: #3730a3; }

/* Attendance colors */
.att-status-گ { background: #dcfce7; color: var(--success); } /* ئامادە */
.att-status-م { background: #dbeafe; color: var(--info); } /* مۆڵەت */
.att-status-غ { background: #fee2e2; color: var(--danger); } /* غیاب */
.att-status-select { min-width: 80px; }

/* Export/Print helpers */
@media print {
  .desktop-sidebar, .mobile-bottom-nav, .top-header, .btn-icon, .filter-card, .tabs, .accordion-item {
    display: none !important;
  }
  .main-content { margin: 0; padding: 0; }
  .content-body { padding: 0; }
  .table th, .table td { border-color: #000; padding: 8px; }
  .table { border: 1px solid #000; direction: rtl; }
}

/* Responsiveness */
@media (max-width: 768px) {
  .desktop-sidebar {
    transform: translateX(100%);
  }
  
  .main-content {
    margin-right: 0;
    margin-bottom: 60px; /* space for bottom nav */
  }
  
  .mobile-bottom-nav {
    display: flex;
  }
}

/* Modal System */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-card {
  background-color: var(--card);
  width: 90%;
  max-width: 600px;
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  transform: scale(0.95) translateY(10px);
  transition: all 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.1rem;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background-color: #f3f4f6;
  color: var(--text);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
}
@media (max-width: 600px) {
  .modal-card {
    height: 100vh;
    max-height: 100vh;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    transform: translateY(100%);
  }
  .modal-overlay.active .modal-card {
    transform: translateY(0);
  }
}
