/* ============================================================
   SHARKS ACADEMY - GLOBAL STYLES (RTL/LTR AWARE)
   ============================================================ */

:root {
  --brand: #059dfa;
  --brand-dark: #0061ad;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.font-ar { font-family: 'Cairo', sans-serif; }
body.font-en { font-family: 'Inter', sans-serif; }

/* Smooth transitions when switching direction */
body, .sidebar, .topbar { transition: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* Card */
.sa-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  border: 1px solid #eef2f7;
}

.sa-stat-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  transition: all .15s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #f1f5f9; color: #334155; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #dcfce7; color: #15803d; }
.btn-success:hover { background: #bbf7d0; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 0.5rem; }

/* Inputs */
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(5,157,250,0.12);
}
.form-label { font-size: 0.82rem; font-weight: 600; color: #475569; margin-bottom: 0.3rem; display: block; }

/* Badge */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge-active, .badge-present, .badge-paid, .badge-approved { background: #dcfce7; color: #15803d; }
.badge-inactive, .badge-absent, .badge-rejected { background: #f1f5f9; color: #64748b; }
.badge-suspended, .badge-late { background: #fef3c7; color: #b45309; }
.badge-pending, .badge-frozen { background: #fef9c3; color: #854d0e; }
.badge-expired, .badge-cancelled { background: #fee2e2; color: #b91c1c; }

/* Table */
.sa-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.sa-table th {
  text-align: start;
  padding: 0.7rem 1rem;
  color: #64748b;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f7;
  white-space: nowrap;
}
.sa-table td { padding: 0.7rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.sa-table tbody tr:hover { background: #f8fafc; }

/* Sidebar */
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1rem; border-radius: 0.7rem;
  color: #cbd5e1; font-weight: 600; font-size: 0.9rem;
  cursor: pointer; transition: all .15s;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-link.active { background: var(--brand); color: #fff; }
.sidebar-link i { width: 1.25rem; text-align: center; flex-shrink: 0; }

/* Collapsible nav groups */
.sidebar-group-header { color: #e2e8f0; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }
.nav-chev { margin-inline-start: auto; font-size: 0.65rem; opacity: 0.7; transition: transform .15s ease; }
.nav-group-items { overflow: hidden; }
.nav-group-items .sidebar-link { padding-inline-start: 2.5rem; font-size: 0.85rem; }
.nav-group.closed .nav-group-items { display: none; }
.nav-group.closed .nav-chev { transform: rotate(-90deg); }
[dir="rtl"] .nav-group.closed .nav-chev { transform: rotate(90deg); }

/* Mobile bottom nav */
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  color: #94a3b8; font-size: 0.68rem; font-weight: 600; flex: 1; padding: 0.4rem 0;
}
.mobile-nav-item.active { color: var(--brand); }
.mobile-nav-item i { font-size: 1.15rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: #fff; border-radius: 1.1rem; width: 100%; max-width: 32rem;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

/* Toast */
#toast-container { position: fixed; top: 1rem; inset-inline-end: 1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.8rem 1.1rem; border-radius: 0.75rem; font-weight: 600; font-size: 0.88rem; box-shadow: 0 8px 24px rgba(0,0,0,0.15); color: #fff; min-width: 220px; animation: slideIn .2s ease; }
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #0079d6; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Scanner */
#qr-video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; inset: 10%; border: 3px solid rgba(255,255,255,0.85);
  border-radius: 1.5rem; box-shadow: 0 0 0 2000px rgba(0,0,0,0.35);
}
.scanner-corner { position: absolute; width: 2rem; height: 2rem; border-color: #22d3ee; }

/* Print styles for QR card & receipts */
@page { size: A5; margin: 8mm; }
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; top: 0; inset-inline-start: 0; width: 100%; }
  .no-print { display: none !important; }
}

/* Utility */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive helpers */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
}
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}
