/* ============================================================
   WaktiPlus.pro — Global Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --color-primary: #6366F1;
  --color-primary-d: #4F46E5;
  --color-primary-l: #EEF2FF;
  --color-secondary: #8B5CF6;
  --color-success: #10B981;
  --color-success-l: #D1FAE5;
  --color-danger: #EF4444;
  --color-danger-l: #FEE2E2;
  --color-warning: #F59E0B;
  --color-warning-l: #FEF3C7;
  --color-bg: #FFF5E6;
  --color-surface: #FFFFFF;
  --color-border: #DFCFAE;
  --color-text: #1A1A2E;
  --color-text-m: #64748B;
  --color-text-l: #9CA3AF;
  --font-sans: 'Inter', sans-serif;
  --font-arabic: 'Cairo', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .07);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .11);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .14);
  --transition: 0.2s ease;
  --sidebar-w: 260px;
}

/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* --- Arabic text direction --- */
[dir="rtl"],
.ar {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
}

.bilingual-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bilingual-label .fr {
  font-family: var(--font-sans);
}

.bilingual-label .ar {
  font-family: var(--font-arabic);
  font-size: 0.85em;
  color: var(--color-text-m);
  direction: rtl;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-3xl {
  font-size: 1.875rem;
}

.text-4xl {
  font-size: 2.25rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-muted {
  color: var(--color-text-m);
}

.text-center {
  text-align: center;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 4px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.gap-6 {
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-sm {
  padding: 16px;
  border-radius: var(--radius-md);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 44px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-d);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, .4);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  min-height: 36px;
}

.btn-lg {
  padding: 15px 32px;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: 10px;
  border-radius: 50%;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.badge-success {
  background: var(--color-success-l);
  color: #065f46;
}

.badge-danger {
  background: var(--color-danger-l);
  color: #991b1b;
}

.badge-warning {
  background: var(--color-warning-l);
  color: #92400e;
}

.badge-primary {
  background: var(--color-primary-l);
  color: #3730a3;
}

.badge-secondary {
  background: #F1F5F9;
  color: #475569;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-group label .label-ar {
  font-family: var(--font-arabic);
  font-size: 0.8em;
  color: var(--color-text-m);
  direction: rtl;
  display: block;
}

.form-control {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 46px;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control[dir="rtl"] {
  font-family: var(--font-arabic);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--color-text-m);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--color-danger);
  margin-top: 4px;
}

/* --- Alerts / Flash --- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-success {
  background: var(--color-success-l);
  color: #065f46;
  border-left: 4px solid var(--color-success);
}

.alert-danger {
  background: var(--color-danger-l);
  color: #991b1b;
  border-left: 4px solid var(--color-danger);
}

.alert-warning {
  background: var(--color-warning-l);
  color: #92400e;
  border-left: 4px solid var(--color-warning);
}

.alert-info {
  background: var(--color-primary-l);
  color: #3730a3;
  border-left: 4px solid var(--color-primary);
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
}

table.tbl th {
  background: #F8FAFC;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-m);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

table.tbl td {
  padding: 14px 16px;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.88rem;
  vertical-align: middle;
}

table.tbl tr:last-child td {
  border-bottom: none;
}

table.tbl tr:hover td {
  background: #FAFAFA;
}

table.tbl .actions {
  display: flex;
  gap: 6px;
}

/* --- Stats cards --- */
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card .stat-num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--color-text-m);
  margin-top: 4px;
}

.stat-card .stat-label .ar {
  font-family: var(--font-arabic);
  direction: rtl;
  display: block;
  font-size: 0.75rem;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 95%;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--color-text-m);
  cursor: pointer;
}

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Utilities --- */
.mt-0 {
  margin-top: 0;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.p-0 {
  padding: 0;
}

.hidden {
  display: none !important;
}

.overflow-hidden {
  overflow: hidden;
}

/* --- Responsive --- */
@media (max-width: 768px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .hide-mobile {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .btn-lg {
    padding: 13px 24px;
  }

  .card {
    padding: 18px;
  }
}