﻿/* =========================================================
   PSMA Maroc – Module Pages Shared Stylesheet
   ========================================================= */

:root {
  --navy:   #0f1e3c;
  --teal:   #1a6b72;
  --gold:   #c9a84c;
  --ivory:  #f9f6f0;
  --white:  #ffffff;
  --text:   #2c2c2c;
  --muted:  #6b7280;
  --border: #e5e0d8;
  --card-bg:#ffffff;
  --shadow: 0 4px 24px rgba(15,30,60,.08);
  --radius: 14px;
  --transition: .25s ease;
}

/* ── Base Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Tajawal', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--ivory);
  line-height: 1.7;
  direction: ltr;
}
body[dir="rtl"] { font-family: 'Tajawal', 'Cairo', sans-serif; }

/* ── Lang Bar ───────────────────────────────────────────── */
.lang-bar {
  background: var(--navy);
  padding: .45rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.lang-bar .site-name {
  color: var(--gold);
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  letter-spacing: .04em;
}
.lang-buttons { display: flex; gap: .4rem; }
.lang-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.75);
  border-radius: 6px;
  padding: .2rem .65rem;
  font-size: .78rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.lang-btn:hover, .lang-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  font-weight: 700;
}

/* ── Module Nav ─────────────────────────────────────────── */
.mod-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .7rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 2.5rem;
  z-index: 999;
}
.mod-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  padding: .3rem .65rem;
  border-radius: 20px;
  transition: var(--transition);
  flex-shrink: 0;
}
.mod-nav a:hover { color: var(--teal); }
.mod-nav a.active {
  background: var(--teal);
  color: var(--white);
}
.mod-nav .sep { color: var(--border); font-size: .8rem; }

/* ── Hero ───────────────────────────────────────────────── */
.mod-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%);
  color: var(--white);
  padding: 5rem 2rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.mod-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.mod-hero-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
  position: relative;
  z-index: 1;
}
.mod-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin-bottom: .75rem;
  position: relative;
  z-index: 1;
}
.mod-hero .tagline {
  font-size: 1.1rem;
  opacity: .85;
  max-width: 640px;
  margin: 0 auto 2rem;
  position: relative;
  z-index: 1;
}
.hero-badges {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.hero-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  padding: .35rem 1rem;
  font-size: .82rem;
  backdrop-filter: blur(4px);
}

/* ── Section Layout ─────────────────────────────────────── */
.section {
  padding: 4.5rem 2rem;
}
.section.alt { background: var(--white); }
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.section-label {
  color: var(--teal);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}
.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 1rem;
  line-height: 1.2;
}
.section-desc {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 680px;
  margin-bottom: 3rem;
}

/* ── Cards Grid ─────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(15,30,60,.12);
}
.card-icon {
  font-size: 2rem;
  margin-bottom: .85rem;
  display: block;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .5rem;
}
.card-desc {
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.6;
}
.card.highlight {
  border-color: var(--teal);
  border-left: 4px solid var(--teal);
}
body[dir="rtl"] .card.highlight {
  border-left: none;
  border-right: 4px solid var(--teal);
}

/* ── Feature List ───────────────────────────────────────── */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: .95rem;
  color: var(--text);
}
.feature-list li::before {
  content: '✓';
  color: var(--teal);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .1rem;
}

/* ── Workflow Steps ─────────────────────────────────────── */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.steps::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--teal), var(--gold));
  opacity: .3;
}
[dir="rtl"] .steps::before { left: auto; right: 28px; }
.step {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.5rem 0;
}
.step-num {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--navy));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-content {}
.step-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .35rem;
}
.step-desc {
  font-size: .92rem;
  color: var(--muted);
}

/* ── State Machine ──────────────────────────────────────── */
.states-flow {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}
.state-pill {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: .4rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy);
}
.state-pill.draft { border-color: var(--muted); color: var(--muted); }
.state-pill.active { border-color: var(--teal); color: var(--teal); background: rgba(26,107,114,.06); }
.state-pill.done { border-color: #16a34a; color: #16a34a; background: rgba(22,163,74,.06); }
.state-pill.gold { border-color: var(--gold); color: #8b6914; background: rgba(201,168,76,.08); }
.state-arrow { color: var(--muted); font-size: 1.1rem; }

/* ── Roles Table ────────────────────────────────────────── */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.role-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.role-icon { font-size: 2rem; margin-bottom: .5rem; display: block; }
.role-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .4rem;
}
.role-desc { font-size: .82rem; color: var(--muted); }

/* ── CTA ────────────────────────────────────────────────── */
.mod-cta {
  background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%);
  color: var(--white);
  text-align: center;
  padding: 4rem 2rem;
}
.mod-cta h2 { font-size: clamp(1.6rem,3vw,2.2rem); margin-bottom: 1rem; }
.mod-cta p { opacity: .85; margin-bottom: 2rem; max-width: 560px; margin-left: auto; margin-right: auto; }
.btn-gold {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  padding: .85rem 2.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 1rem;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}
.btn-gold:hover { background: #d4a730; transform: translateY(-2px); }
.btn-outline {
  display: inline-block;
  border: 2px solid rgba(255,255,255,.5);
  color: var(--white);
  font-weight: 600;
  padding: .8rem 2rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: .95rem;
  transition: var(--transition);
  margin-left: 1rem;
}
.btn-outline:hover { border-color: var(--white); background: rgba(255,255,255,.1); }
body[dir="rtl"] .btn-outline { margin-left: 0; margin-right: 1rem; }

/* ── Footer ─────────────────────────────────────────────── */
.mod-footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 1.5rem 2rem;
  font-size: .83rem;
}
.mod-footer a { color: var(--gold); text-decoration: none; }

/* ── Two-col layout ─────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .lang-bar { padding: .4rem 1rem; }
  .mod-nav { padding: .6rem 1rem; }
  .section { padding: 3rem 1.25rem; }
  .mod-hero { padding: 3.5rem 1.25rem 3rem; }
  .steps::before { display: none; }
}

/* ── Image Gallery ──────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  background: var(--card-bg);
  margin: 0;
}
.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 36px rgba(15,30,60,.15);
}
.gallery-thumb {
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, #1a3564 45%, var(--teal) 100%);
}
/* Decorative shimmer bars — visible when image hasn't loaded yet */
.gallery-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  pointer-events: none;
}
.gallery-thumb::after {
  content: '🖥️';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: .18;
}
.gallery-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform .4s ease;
}
.gallery-item:hover .gallery-thumb img { transform: scale(1.04); }
.gallery-caption {
  padding: .65rem 1rem;
  font-size: .88rem;
  font-weight: 600;
  color: var(--navy);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.gallery-caption::before {
  content: '';
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--teal);
  flex-shrink: 0;
}
/* RTL: grid flows right-to-left */
[dir="rtl"] .gallery-grid { direction: rtl; }

/* RTL: flip the accent bar side */
[dir="rtl"] .gallery-caption { flex-direction: row-reverse; }

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 36, .95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem;
}
.lightbox.open { display: flex; }
.lb-img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  object-fit: contain;
  display: block;
}
.lb-cap {
  color: rgba(255,255,255,.8);
  font-size: .95rem;
  text-align: center;
  max-width: 600px;
}
.lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,.25); }
.lb-prev,
.lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  line-height: 1;
}
.lb-prev { left: 1.25rem; }
.lb-next { right: 1.25rem; }
.lb-prev:hover,
.lb-next:hover { background: rgba(255,255,255,.25); }
/* RTL: keep image centered as in LTR */
[dir="rtl"] .gallery-thumb img { object-position: center center; }

/* RTL: close button moves to left */
[dir="rtl"] .lb-close { right: auto; left: 1.25rem; }

/* RTL: prev/next buttons swap sides AND arrows flip direction */
[dir="rtl"] .lb-prev {
  left: auto;
  right: 1.25rem;
  transform: translateY(-50%) scaleX(-1);
}
[dir="rtl"] .lb-next {
  right: auto;
  left: 1.25rem;
  transform: translateY(-50%) scaleX(-1);
}
@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .lb-prev { left: .5rem; }
  .lb-next { right: .5rem; }
  .lb-close { top: .5rem; right: .5rem; }
  [dir="rtl"] .lb-close { right: auto; left: .5rem; }
  [dir="rtl"] .lb-prev { left: auto; right: .5rem; }
  [dir="rtl"] .lb-next { right: auto; left: .5rem; }
}

/* ── RTL supplemental rules ─────────────────────────────── */
/* Global text alignment for RTL (mirrors css/styles.css) */
[dir="rtl"] { text-align: right; }

/* Navbar: override direction:ltr on body so flex rows reverse properly */
[dir="rtl"] .lang-bar,
[dir="rtl"] .mod-nav {
  direction: rtl;
}

/* Feature lists: ✓ marker moves to right side, text flows right-to-left */
[dir="rtl"] .feature-list {
  direction: rtl;
}

/* Steps: number circle moves to right, vertical line stays aligned at right: 28px */
[dir="rtl"] .step {
  direction: rtl;
}

/* States flow: pills flow right-to-left (arrows already flip via .state-arrow rule) */
[dir="rtl"] .states-flow {
  direction: rtl;
}

/* Flip directional arrows (→ becomes ←) in RTL reading order */
[dir="rtl"] .state-arrow {
  display: inline-block;
  transform: scaleX(-1);
}

/* ── Tablet (601px – 768px) ─────────────────────────────── */
@media (min-width:601px) and (max-width:768px) {
  .section { padding:3.5rem 1.5rem; }
  .cards-grid { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); }
}

/* ── Small phones (≤ 380px) ─────────────────────────────── */
@media (max-width:380px) {
  .mod-hero h1 { font-size:1.8rem; }
  .section { padding:2.5rem 1rem; }
  .mod-hero { padding:3rem 1rem 2.5rem; }
  .gallery-grid { grid-template-columns:1fr; }
}

/* ── Hamburger button ────────────────────────────────────── */
.nav-hamburger {
  display: flex;
  flex-direction: column; justify-content: center; gap: 5px;
  background: transparent; border: none; cursor: pointer; padding: 8px; flex-shrink: 0;
}
@media(min-width:601px) { .nav-hamburger { display: none; } }
.nav-hamburger span { display:block; width:24px; height:2px; background:#fff; border-radius:2px; transition:transform .3s,opacity .3s; }
.nav-hamburger.open span:nth-child(1) { transform:translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity:0; }
.nav-hamburger.open span:nth-child(3) { transform:translateY(-7px) rotate(-45deg); }

/* ── Drawer backdrop ─────────────────────────────────────── */
.drawer-backdrop {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.55); z-index:1100; backdrop-filter:blur(2px);
}
.drawer-backdrop.open { display:block; }

/* ── Mobile drawer ───────────────────────────────────────── */
.mobile-drawer {
  position:fixed; top:0; right:-280px; width:280px; height:100%;
  background:var(--navy); border-left:2px solid var(--gold);
  z-index:1200; padding:4rem 2rem 2rem;
  display:flex; flex-direction:column; gap:0;
  transition:right .3s ease; overflow-y:auto;
}
.mobile-drawer.open { right:0; }
.drawer-close {
  position:absolute; top:1rem; right:1rem;
  background:transparent; border:1px solid rgba(255,255,255,.25); color:#fff;
  font-size:1.2rem; width:36px; height:36px; border-radius:50%;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.drawer-home-link {
  display:block; padding:.75rem 0 1rem;
  border-bottom:2px solid var(--gold);
  color:var(--gold); text-decoration:none;
  font-size:.95rem; font-weight:700; margin-bottom:.5rem;
}
.drawer-links { list-style:none; display:flex; flex-direction:column; gap:0; }
.drawer-links li a {
  display:block; padding:.75rem 0;
  border-bottom:1px solid rgba(255,255,255,.08);
  color:rgba(255,255,255,.8); text-decoration:none;
  font-size:.95rem; font-weight:500; transition:color .2s;
}
.drawer-links li a:hover { color:var(--gold); }

/* ── RTL drawer ──────────────────────────────────────────── */
[dir="rtl"] .mobile-drawer { right:auto; left:-280px; border-left:none; border-right:2px solid var(--gold); transition:left .3s ease; }
[dir="rtl"] .mobile-drawer.open { left:0; }
[dir="rtl"] .drawer-close { right:auto; left:1rem; }
[dir="rtl"] .drawer-links li a { text-align:right; }
[dir="rtl"] .drawer-home-link { text-align:right; }
