/* =====================================================
   كلية تقنية المعلومات - جامعة النصر التقنية
   ملف التصميم الشامل الموحد
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css');

/* ===== Design Tokens ===== */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  rgba(37, 99, 235, 0.12);
  --accent:         #06b6d4;
  --danger:         #ef4444;
  --danger-bg:      #fef2f2;
  --success:        #10b981;
  --success-bg:     #ecfdf5;
  --warning:        #f59e0b;
  --warning-bg:     #fffbeb;

  --bg-body:        #f1f5f9;
  --bg-card:        #ffffff;
  --bg-input:       #f8fafc;
  --text-main:      #0f172a;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --border-focus:   var(--primary);

  --header-bg:      #0d3b66;
  --header-text:    #ffffff;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.12);
  --shadow-xl:  0 20px 40px rgba(0,0,0,0.15);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --transition: all 0.25s ease;
}

/* ===== Dark Mode Tokens ===== */
body.dark {
  --bg-body:    #0f172a;
  --bg-card:    #1e293b;
  --bg-input:   #1e293b;
  --text-main:  #f1f5f9;
  --text-muted: #94a3b8;
  --border:     #334155;
  --header-bg:  #0a2540;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.4);
  --danger-bg:  rgba(239,68,68,0.1);
  --success-bg: rgba(16,185,129,0.1);
  --warning-bg: rgba(245,158,11,0.1);
  --primary-light: rgba(96, 165, 250, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
  transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: var(--primary); }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ===== Layout ===== */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-content {
  padding: 28px 20px;
  max-width: 1200px;
  margin: 0 auto;
  flex: 1;
  width: 100%;
}

/* ===== Header ===== */
.main-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 20px;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.header-title-group strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-title-group small {
  font-size: 0.75rem;
  opacity: 0.75;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,99,235,0.3); }

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-secondary:hover { background: var(--primary); color: white; transform: translateY(-2px); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(239,68,68,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-body); color: var(--text-main); transform: translateY(-1px); }

.btn-white {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(4px);
}
.btn-white:hover { background: white; color: var(--primary); }

/* Icon-only button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.25); transform: translateY(-2px); }

/* Icon button for light backgrounds */
.btn-icon-light {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}
.btn-icon-light:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: var(--transition);
  overflow: hidden;
}

.card-clickable {
  cursor: pointer;
}
.card-clickable:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.card-body { padding: 24px; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
}

/* ===== Dashboard Grid ===== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.dash-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dash-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, var(--primary-light));
  opacity: 0;
  transition: opacity 0.3s;
}

.dash-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.dash-card:hover::before { opacity: 1; }

.dash-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dash-card-icon.danger { background: var(--danger-bg); color: var(--danger); }
.dash-card-icon.success { background: var(--success-bg); color: var(--success); }
.dash-card-icon.warning { background: var(--warning-bg); color: var(--warning); }
.dash-card-icon.accent { background: rgba(6,182,212,0.1); color: var(--accent); }

.dash-card-text .title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.dash-card-text .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.dash-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  display: none;
}

/* Admin card accent */
.dash-card.admin { border-right: 4px solid var(--danger); }

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 12px 44px 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-input);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { padding-right: 44px; cursor: pointer; }
textarea.form-control { padding: 12px 14px; resize: vertical; min-height: 100px; }

.input-wrapper {
  position: relative;
}

.input-wrapper .form-control { padding-right: 44px; }
.input-icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}
.input-icon-end {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.input-icon-end:hover { color: var(--primary); }

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  font-size: 0.9rem;
}

table thead {
  background: var(--primary);
  color: white;
}

table thead th {
  padding: 14px 16px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

table tbody tr:last-child { border-bottom: none; }
table tbody tr:hover { background: var(--primary-light); }

table tbody td {
  padding: 13px 16px;
  color: var(--text-main);
}

/* ===== Badges / Tags ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-danger  { background: var(--danger-bg);    color: var(--danger); }
.badge-success { background: var(--success-bg);   color: var(--success); }
.badge-warning { background: var(--warning-bg);   color: var(--warning); }
.badge-accent  { background: rgba(6,182,212,0.1); color: var(--accent); }

/* ===== Alerts ===== */
.alert {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 16px;
  animation: slideDown 0.3s ease;
}

.alert.show { display: flex; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(37,99,235,0.2); }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.modal-overlay.show { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 22px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 16px;
  opacity: 0.3;
}
.empty-state p { font-size: 1rem; margin: 0; }

/* ===== Spinner / Loader ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-dark {
  border-color: var(--border);
  border-top-color: var(--primary);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ===== Search & Controls Bar ===== */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 40px 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  color: var(--text-main);
  background: var(--bg-card);
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }

.search-wrapper {
  position: relative;
  flex: 1;
}
.search-wrapper i {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

/* ===== Footer ===== */
.main-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ===== Toast Notifications ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  border-right: 4px solid var(--primary);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.toast.emergency { border-right-color: var(--danger); background: var(--danger-bg); }

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

.toast-icon { font-size: 1.3rem; flex-shrink: 0; }
.toast-title { font-weight: 700; font-size: 0.9rem; color: var(--text-main); }
.toast-body  { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }

/* ===== Welcome Banner ===== */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 50%, #06b6d4 100%);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  color: white;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  pointer-events: none;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}

.welcome-banner-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.25);
}

.welcome-banner-icon {
  font-size: 1.8rem;
  color: white;
}

.welcome-banner-body {
  flex: 1;
  min-width: 0;
}

.welcome-banner h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.welcome-banner p {
  font-size: 0.88rem;
  opacity: 0.85;
  margin: 0;
}

/* ===== User Card (manage-users) ===== */
.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.user-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }

.user-card-head { display: flex; align-items: center; gap: 14px; }

.user-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
  flex-shrink: 0;
}

.user-name { font-weight: 700; color: var(--text-main); font-size: 1rem; }
.user-email { font-size: 0.82rem; color: var(--text-muted); }

.user-card-actions { display: flex; gap: 8px; }
.user-card-actions .btn { flex: 1; padding: 8px 12px; font-size: 0.83rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .page-content { padding: 16px 14px; }
  .container, .container-sm { padding: 0 14px; }
  .main-header { padding: 0 14px; height: 58px; }
  .header-title-group small { display: none; }
  .header-title-group strong { font-size: 0.88rem; }
  .btn-icon { width: 38px; height: 38px; font-size: 1rem; }
  .header-logo { width: 34px; height: 34px; }

  /* Dashboard */
  .dash-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .dash-card {
    padding: 16px 14px;
    gap: 12px;
    border-radius: var(--radius-md);
  }
  .dash-card-icon {
    width: 46px;
    height: 46px;
    font-size: 1.35rem;
    border-radius: 10px;
  }
  .dash-card-text .title { font-size: 0.9rem; }
  .dash-card-text .subtitle { font-size: 0.74rem; }
  .dash-card:hover { transform: translateY(-3px); }

  /* Welcome Banner */
  .welcome-banner {
    padding: 18px 16px;
    gap: 14px;
    margin-bottom: 18px;
  }
  .welcome-banner-icon-wrap { width: 48px; height: 48px; }
  .welcome-banner-icon { font-size: 1.55rem; }
  .welcome-banner h2 { font-size: 1.1rem; }
  .welcome-banner p { font-size: 0.82rem; }

  /* Page header */
  .page-title { font-size: 1.2rem; }
  .page-header { margin-bottom: 18px; }
  .page-icon { width: 42px; height: 42px; font-size: 1.2rem; }

  /* Tables */
  table thead th, table tbody td { padding: 10px 12px; font-size: 0.83rem; }

  /* Toast */
  #toast-container { bottom: 16px; left: 12px; right: 12px; }
  .toast { min-width: unset; width: 100%; max-width: 100%; }

  /* Footer */
  .main-footer { padding: 16px 14px; font-size: 0.78rem; }

  /* Card */
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .page-content { padding: 14px 12px; }
  .main-header { padding: 0 12px; }

  /* Keep 2-column grid even on small phones for dashboard feel */
  .dash-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .dash-card {
    padding: 14px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .dash-card-icon { width: 42px; height: 42px; font-size: 1.2rem; }
  .dash-card-text .title { font-size: 0.85rem; }
  .dash-card-text .subtitle { font-size: 0.7rem; }

  .welcome-banner { padding: 16px 14px; gap: 12px; }
  .welcome-banner h2 { font-size: 1rem; }
  .welcome-banner-icon-wrap { width: 42px; height: 42px; }
  .welcome-banner-icon { font-size: 1.35rem; }

  .modal-box { width: 96%; margin: 12px; border-radius: var(--radius-lg); }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .search-wrapper { width: 100%; }
  .btn { padding: 10px 16px; font-size: 0.85rem; }

  /* Wider touch targets for table actions */
  .btn-icon-light { width: 36px; height: 36px; }
}

/* Safe area support for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  #toast-container {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ===== Stats Bar (Dashboard) ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-item > i {
  font-size: 1.8rem;
  color: var(--primary);
  flex-shrink: 0;
}

.stat-item-body {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== Submission Cards ===== */
.sub-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.sub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
}

.sub-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.sub-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-card-student {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sub-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.sub-name  { font-weight: 700; font-size: 0.95rem; color: var(--text-main); }
.sub-email { font-size: 0.75rem; color: var(--text-muted); }

.sub-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sub-card-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sub-card-meta i {
  font-size: 0.95rem;
  color: var(--primary);
}

.sub-card-actions {
  display: flex;
  gap: 8px;
}

/* Responsive for sub-cards and stats */
@media (max-width: 768px) {
  .stats-bar {
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-item {
    padding: 14px;
    gap: 10px;
  }
  .stat-item > i { font-size: 1.5rem; }
  .stat-num { font-size: 1.4rem; }

  .sub-cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .stat-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    gap: 6px;
  }
  .stat-item > i { font-size: 1.3rem; }
  .stat-num { font-size: 1.2rem; }
  .stat-label { font-size: 0.7rem; }
  .stat-item-body { align-items: center; }

  .sub-card-meta { grid-template-columns: 1fr; }
}

