/* ==========================================================================
   style.css — Design System
   Abattoir Régional – Portail des Services Numériques
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

:root {
  /* — Brand palette — */
  --color-primary:        #2AADA6;
  --color-primary-dark:   #1e8e88;
  --color-primary-deeper: #166b66;
  --color-primary-light:  #eaf7f6;
  --color-primary-glow:   rgba(42, 173, 166, .18);

  /* — Neutrals — */
  --color-dark:           #0f1923;
  --color-text:           #2c3a47;
  --color-muted:          #6b7c8d;
  --color-subtle:         #9baab8;
  --color-border:         #e2eaef;
  --color-border-strong:  #c8d6de;

  /* — Surfaces — */
  --color-bg:             #ffffff;
  --color-bg-alt:         #f4f8fb;
  --color-bg-raised:      #ffffff;
  --color-bg-dark:        #0f1923;
  --color-bg-dark-alt:    #162230;

  /* — Semantic — */
  --color-success:        #0d9e6e;
  --color-success-light:  #e4f7f0;
  --color-danger:         #d63b3b;
  --color-danger-light:   #fceaea;
  --color-warning:        #c28a00;
  --color-warning-light:  #fef8e1;
  --color-info:           var(--color-primary);
  --color-info-light:     var(--color-primary-light);

  /* — Inactive tab — */
  --color-tab-inactive:   #a8b8c4;

  /* — Typography — */
  --font-primary: 'Cairo', 'Tajawal', system-ui, sans-serif;

  /* — Radius — */
  --radius-xs:  3px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-pill: 999px;

  /* — Elevation — */
  --shadow-xs:  0 1px 3px rgba(15, 25, 35, .06);
  --shadow-sm:  0 2px 8px rgba(15, 25, 35, .08), 0 1px 2px rgba(15, 25, 35, .05);
  --shadow-md:  0 6px 24px rgba(15, 25, 35, .10), 0 2px 6px rgba(15, 25, 35, .06);
  --shadow-lg:  0 16px 48px rgba(15, 25, 35, .12), 0 4px 12px rgba(15, 25, 35, .07);
  --shadow-primary: 0 4px 20px rgba(42, 173, 166, .30);

  /* — Motion — */
  --ease:        cubic-bezier(.22, .68, 0, 1.2);
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --transition:  0.22s ease;
  --transition-slow: 0.38s cubic-bezier(.16, 1, .3, 1);

  /* — Layout — */
  --navbar-height: 68px;
  --container-max: 1220px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  direction: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  outline: none;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-dark);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 4.5vw, 3.2rem);  font-weight: 900; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem);  font-weight: 800; }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 700; }
h4 { font-size: 1.1rem; font-weight: 700; }

p {
  color: var(--color-muted);
  font-size: 0.96rem;
  line-height: 1.8;
}

.text-lead {
  font-size: 1.1rem;
  color: var(--color-text);
  line-height: 1.75;
}

/* --------------------------------------------------------------------------
   4. Layout Utilities
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 28px;
}

.section {
  padding-block: 72px;
}

.section--alt {
  background: var(--color-bg-alt);
}

.section--dark {
  background: var(--color-bg-dark);
  color: #fff;
}

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.text-center { text-align: center; }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform 0.15s ease;
  text-align: center;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(.97); }

/* Primary */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 6px 28px rgba(42, 173, 166, .38);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--color-dark);
  border: 1.5px solid var(--color-border-strong);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border: 1.5px solid transparent;
}

.btn-ghost:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

/* Sizes */
.btn-block { width: 100%; }

.btn-lg {
  padding: 14px 32px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.84rem;
}

/* --------------------------------------------------------------------------
   6. Navbar
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  height: var(--navbar-height);
  transition: box-shadow var(--transition);
}

.navbar.is-scrolled {
  box-shadow: var(--shadow-sm);
}

.navbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Brand */
.navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  overflow: visible;
}

.navbar__brand a img,
.navbar__brand .navbar__emblem-img,
.navbar__brand .navbar__logo-img {
  height: 44px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.navbar__brand-sep {
  width: 1px;
  height: 36px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* Legacy alias */
.navbar__logo { display: flex; align-items: center; gap: 12px; }
.navbar__logo img { height: 48px; width: auto; }

.navbar__logo-text {
  font-size: 0.73rem;
  color: var(--color-muted);
  line-height: 1.5;
  text-align: right;
}

/* Nav links */
.navbar__nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.navbar__nav a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-muted);
  position: relative;
  padding-bottom: 3px;
  transition: color var(--transition);
}

.navbar__nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  transition: width var(--transition-slow);
}

.navbar__nav a:hover,
.navbar__nav a.active {
  color: var(--color-dark);
}

.navbar__nav a:hover::after,
.navbar__nav a.active::after {
  width: 100%;
}

/* Actions */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* User greeting */
.navbar__user-greeting {
  font-size: .88rem;
  color: var(--color-muted);
  margin-left: 8px;
}

/* Logo image */
.navbar__logo-img {
  height: 46px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* Emblem */
.navbar__emblem { display: flex; align-items: center; gap: 12px; }
.navbar__emblem-img {
  height: 50px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Logo mark */
.navbar__logo-mark {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Auth logo */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.auth-logo img { height: 62px; }

.auth-logo__img {
  height: 80px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Mobile brand */
.navbar__mobile-logo {
  display: none;
  align-items: center;
  gap: 10px;
}

.navbar__mobile-logo img { height: 38px; }

.navbar__mobile-logo-text { text-align: right; }
.navbar__mobile-logo-text .brand-ar {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--color-primary);
}
.navbar__mobile-logo-text .brand-fr {
  font-size: 0.68rem;
  color: var(--color-subtle);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.hamburger:hover { background: var(--color-bg-alt); }

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-dark);
  border-radius: var(--radius-pill);
  transition: transform var(--transition), opacity var(--transition);
}

/* Mobile drawer */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--navbar-height);
  right: 0;
  width: 276px;
  height: calc(100vh - var(--navbar-height));
  background: var(--color-bg);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  flex-direction: column;
  padding: 20px;
  gap: 4px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.mobile-menu.is-open { transform: translateX(0); }

.mobile-menu a {
  display: block;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--color-muted);
  transition: background var(--transition), color var(--transition);
}

.mobile-menu a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.mobile-menu__logo {
  padding: 6px 0 14px;
  display: flex;
  justify-content: center;
}

.mobile-menu__logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 35, .45);
  backdrop-filter: blur(2px);
  z-index: 998;
}

.mobile-menu-overlay.is-open { display: block; }

/* --------------------------------------------------------------------------
   7. Hero Section
   -------------------------------------------------------------------------- */
.hero {
  padding-block: 88px 48px;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.hero__content { text-align: right; }

.hero__title {
  font-size: clamp(1.9rem, 3.8vw, 3rem);
  font-weight: 900;
  line-height: 1.3;
  color: var(--color-dark);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero__illustration {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__illustration img {
  max-height: 320px;
  object-fit: contain;
  filter: grayscale(15%);
}

/* --------------------------------------------------------------------------
   8. Tabs
   -------------------------------------------------------------------------- */
.tabs__list {
  display: flex;
  gap: 0;
  border-bottom: none;
}

.tabs__btn {
  flex: 1;
  padding: 15px 24px;
  font-size: 0.97rem;
  font-weight: 700;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--color-tab-inactive);
  color: #fff;
  transition: background var(--transition);
  border: none;
}

.tabs__btn + .tabs__btn { margin-right: 3px; }

.tabs__btn.active { background: var(--color-primary); }

.tabs__btn:hover:not(.active) { background: #96a9b6; }

/* --------------------------------------------------------------------------
   9. Services Grid
   -------------------------------------------------------------------------- */
.services {
  background: var(--color-bg-alt);
  padding-block: 48px;
}

.service-card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 28px 22px;
  border: 1px solid var(--color-border);
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition-slow);
}

.service-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--color-primary-light);
  transform: translateY(-4px);
}

.service-card__icon {
  width: 48px;
  height: 48px;
  margin-right: auto;
  margin-left: 0;
}

.service-card__title {
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--color-dark);
}

.service-card__body {
  font-size: 0.87rem;
  color: var(--color-muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   10. Auth Pages
   -------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  padding: 24px;
}

.auth-logo__text .brand-ar {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--color-primary);
}

.auth-logo__text .brand-fr {
  font-size: 0.83rem;
  color: var(--color-subtle);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.auth-card__header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card__header h2 {
  font-size: 1.5rem;
  font-weight: 900;
}

.auth-card__header p {
  margin-top: 4px;
  font-size: 0.9rem;
}

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

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 7px;
  text-align: right;
}

.form-control {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
}

.form-control:hover {
  border-color: var(--color-border-strong);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

.form-control.is-invalid { border-color: var(--color-danger); }
.form-control.is-valid   { border-color: var(--color-success); }

/* Toggle switch */
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-dark);
}

.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 25px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  transition: background var(--transition);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  height: 19px;
  width: 19px;
  right: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition);
}

.toggle input:checked + .toggle__slider { background: var(--color-primary); }
.toggle input:checked + .toggle__slider::before { transform: translateX(-21px); }

/* Register illustration */
.register-illustration {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  object-fit: cover;
  max-height: 200px;
}

/* OTP inputs */
.otp-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
  direction: ltr;
}

.otp-input {
  width: 44px;
  height: 52px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-dark);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.otp-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.otp-hint {
  text-align: center;
  font-size: 0.84rem;
  color: var(--color-subtle);
  margin-bottom: 24px;
}

/* Auth links */
.auth-links { display: flex; flex-direction: column; gap: 12px; }

.auth-switch {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 16px;
}

.auth-switch a {
  color: var(--color-primary);
  font-weight: 700;
}

/* Alert success */
.alert-success {
  background: var(--color-success-light);
  color: var(--color-success);
  border-right: 3px solid var(--color-success);
}

/* --------------------------------------------------------------------------
   12. Dashboard Cards
   -------------------------------------------------------------------------- */
.dashboard-card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  border: 1px solid var(--color-border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition-slow);
}

.dashboard-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.dashboard-card__icon {
  width: 54px;
  height: 54px;
  background: var(--color-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition-slow);
}

.dashboard-card:hover .dashboard-card__icon {
  background: var(--color-primary);
  transform: scale(1.08);
}

.dashboard-card__icon svg {
  width: 26px;
  height: 26px;
  fill: var(--color-primary);
  transition: fill var(--transition);
}

.dashboard-card:hover .dashboard-card__icon svg { fill: #fff; }

.dashboard-card__title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-dark);
}

.dashboard-card__body {
  font-size: 0.84rem;
  color: var(--color-muted);
  flex: 1;
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--color-bg-dark);
  color: #8fa0b0;
  padding-block: 48px 24px;
}

.footer__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.footer__col-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__links a {
  font-size: 0.87rem;
  color: #6e8394;
  transition: color var(--transition);
}

.footer__links a:hover { color: var(--color-primary); }

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  font-size: 0.8rem;
  color: #4a5f6e;
}

/* --------------------------------------------------------------------------
   14. Badges & Alerts
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary-deep, var(--color-primary-dark));
}

/* --------------------------------------------------------------------------
   15. Section Heading utility
   -------------------------------------------------------------------------- */
.section-heading {
  text-align: center;
  margin-bottom: 48px;
}

.section-heading__eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 10px;
}

.section-heading h2 {
  margin-bottom: 12px;
}

.section-heading p {
  max-width: 540px;
  margin-inline: auto;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   16. Scroll reveal utility (JS adds .is-visible)
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
