/* ============================================================
   Fleets Hub Africa v6 — Visual Overhaul Layer (ADDITIVE ONLY)
   Loaded after app.css. Does not modify or remove any existing
   rule — only adds new classes, refines spacing/elevation on
   existing selectors via higher-specificity additions, and
   introduces opt-in customization (background styles, animated
   icons, maintenance animations). Every color still resolves
   through the existing --primary / --accent / --bg variables
   set in layout_top.php, so per-business branding is untouched.
   ============================================================ */

/* ── DESKTOP REFRESH (ref: Desktop_UI_design — soft elevated
   cards, rounded pill buttons, generous spacing) ───────────── */
@media(min-width:901px){
  .card{
    border-radius:16px;
    box-shadow:0 4px 18px rgba(20,20,20,0.05);
    border:1px solid rgba(0,0,0,0.04);
  }
  .metric-card{
    border-radius:16px;
    box-shadow:0 6px 20px rgba(20,20,20,0.06);
    transition:transform .18s ease, box-shadow .18s ease;
  }
  .metric-card:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 28px rgba(20,20,20,0.10);
  }
  .btn{
    border-radius:24px;
    padding:10px 20px;
  }
  .sidebar{
    border-radius:0 18px 18px 0;
    box-shadow:4px 0 24px rgba(0,0,0,0.12);
  }
}

/* ── MOBILE REFRESH (ref: Phone_app_UI_design — dark icon-grid
   panels, rounded selectable tiles, pill toggles) ──────────── */
@media(max-width:768px){
  .metrics-row{
    grid-template-columns:repeat(2,1fr) !important;
    gap:10px;
  }
  .metric-card{
    border-radius:14px;
    padding:14px;
    text-align:center;
  }
  .metric-icon{
    width:38px;height:38px;margin:0 auto 8px;
    display:flex;align-items:center;justify-content:center;
    background:rgba(var(--primary-rgb,45,122,58),0.12);
    border-radius:10px;font-size:18px;
  }
  .card{ border-radius:14px; }
  .btn{ min-height:44px; border-radius:22px; }
  /* App-icon-grid style tile, opt-in via class on nav/module links */
  .tile-grid{
    display:grid; grid-template-columns:repeat(3,1fr); gap:10px;
    padding:4px 0;
  }
  .tile-grid .tile{
    display:flex; flex-direction:column; align-items:center; gap:6px;
    padding:14px 6px; border-radius:14px;
    background:var(--surface2); border:1px solid var(--border);
    font-size:11px; font-weight:600; color:var(--text2);
  }
  .tile-grid .tile.active{
    background:var(--primary); color:#fff; border-color:var(--primary);
  }
  .tile-grid .tile .tile-icon{ font-size:22px; }
}

/* NOTE: platform.php's dark-glass treatment lives in its own inline
   <style> block (see the .card rules added there directly), and is
   guarded against by app-v7.css's body:not(.platform-body) selector
   so the light-glass system used elsewhere doesn't leak in. */

/* ── BACKGROUND STYLE OPTIONS (item 3)
   Selected per-business in Settings → stored in businesses.background_style
   Applied via data-bg attribute on <body> from layout_top.php ────────── */
body[data-bg="solid"]{ background:var(--bg); }

body[data-bg="gradient"]{
  background:linear-gradient(135deg, var(--bg) 0%, var(--primary-lt) 50%, var(--bg) 100%);
}

body[data-bg="pattern"]{
  background-color:var(--bg);
  background-image:
    radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size:22px 22px;
}

body[data-bg="particles"]{ background:var(--bg); overflow-x:hidden; }
body[data-bg="particles"] .bg-particles{
  position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden;
}
body[data-bg="particles"] .bg-particles span{
  position:absolute; bottom:-20px; width:6px; height:6px; border-radius:50%;
  background:var(--primary); opacity:.25;
  animation:bgParticleRise linear infinite;
}
@keyframes bgParticleRise{
  0%{ transform:translateY(0) translateX(0); opacity:.25; }
  100%{ transform:translateY(-110vh) translateX(20px); opacity:0; }
}

/* ── ANIMATED ICON OPTIONS (item 3)
   Selected per-business → stored in businesses.icon_style
   Applied via data-icons attribute on <body>, targets .nav-icon /
   .metric-icon / .logo-icon so it works across sidebar + dashboard ── */
body[data-icons="pulse"] .nav-icon,
body[data-icons="pulse"] .logo-icon{
  animation:iconPulse 2.2s ease-in-out infinite;
}
@keyframes iconPulse{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.12); }
}

body[data-icons="float"] .nav-icon,
body[data-icons="float"] .logo-icon{
  animation:iconFloat 3s ease-in-out infinite;
}
@keyframes iconFloat{
  0%,100%{ transform:translateY(0); }
  50%{ transform:translateY(-3px); }
}

body[data-icons="spin-hover"] .nav-icon:hover,
body[data-icons="spin-hover"] .logo-icon:hover{
  transform:rotate(18deg) scale(1.08);
  transition:transform .25s ease;
}

/* ── MAINTENANCE MODE ANIMATIONS (item 3)
   Rendered in index.php maintenance screen based on
   platform.maintenance_animation column ─────────────────────── */
.maint-anim-stage{
  position:relative; width:100%; max-width:420px; height:140px;
  margin:0 auto 22px; overflow:hidden;
}

/* Moving vehicles */
.maint-anim-stage.vehicles .road{
  position:absolute; bottom:18px; left:0; right:0; height:4px;
  background:repeating-linear-gradient(90deg, var(--border) 0 14px, transparent 14px 28px);
}
.maint-anim-stage.vehicles .van{
  position:absolute; bottom:22px; font-size:34px;
  animation:maintDriveAcross 5.5s linear infinite;
}
.maint-anim-stage.vehicles .van.van2{
  font-size:26px; animation-duration:7s; animation-delay:1.4s; bottom:24px;
}
@keyframes maintDriveAcross{
  0%{ left:-15%; transform:scaleX(1); }
  49%{ transform:scaleX(1); }
  50%{ left:105%; transform:scaleX(-1); }
  99%{ transform:scaleX(-1); }
  100%{ left:-15%; transform:scaleX(1); }
}

/* Turning gears */
.maint-anim-stage.gears .gear{
  position:absolute; font-size:46px; color:var(--primary);
  animation:maintGearSpin 4s linear infinite;
}
.maint-anim-stage.gears .gear.g2{
  font-size:30px; top:8px; left:58%; color:var(--accent);
  animation-duration:3s; animation-direction:reverse;
}
.maint-anim-stage.gears .gear.g1{ top:46px; left:38%; }
@keyframes maintGearSpin{
  from{ transform:rotate(0deg); }
  to{ transform:rotate(360deg); }
}

/* ── LOGIN PAGE — AUTO-SCROLLING MODULE SHOWCASE (item 2,
   ref: Front_Page_UI — split layout, right side animates
   through system modules with description, auto-scroll loop) ── */
/* ── LOGIN PAGE — TWO-COLUMN GLASSMORPHISM CAROUSEL (item 6,
   ref: Front_Page_UI — white background showing the brand
   illustration, module boxes arranged in 2 columns x 2 rows,
   scrolling like a carousel, glass effect, gradient per module,
   pauses on hover) ─────────────────────────────────────────── */
/* ── LOGIN PAGE — HERO IMAGE + DESCRIPTION + HORIZONTAL CAROUSEL
   (ref: Front_Page_UI, updated per request — white background,
   a clear image card at the top fading to transparent near its
   bottom edge, a capability description beneath it, and a
   horizontally-sliding carousel of module cards below that;
   pauses on hover) ─────────────────────────────────────────── */
.auth-showcase{
  position:relative; overflow:hidden; height:100%; width:100%;
  background:#ffffff;
  display:flex; align-items:center; justify-content:center;
  padding:32px 30px;
}
.auth-showcase-stack{
  position:relative; z-index:1; width:100%; max-width:520px;
  display:flex; flex-direction:column; gap:22px;
}

/* Hero image card: clear/sharp at the top, gradient fades it to
   transparent as it nears the bottom edge of its own box */
.auth-hero-card{
  position:relative; width:100%; height:230px;
  border-radius:20px; overflow:hidden;
  background:#f4fbf1;
  box-shadow:0 10px 30px rgba(20,30,50,0.10);
}
.auth-hero-img{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:contain; object-position:center;
}
.auth-hero-fade{
  position:absolute; left:0; right:0; bottom:0; height:65%;
  background:linear-gradient(to top, #f4fbf1 0%, rgba(244,251,241,0) 100%);
}

/* Capability description, between the image and the carousel */
.auth-hero-desc{ text-align:center; }
.auth-hero-desc h3{
  font-size:18px; font-weight:800; color:#1a3a1e; margin-bottom:8px;
}
.auth-hero-desc p{
  font-size:13px; color:#5b6b5e; line-height:1.6; margin:0 auto; max-width:440px;
}

/* Horizontal sliding carousel */
.auth-carousel{ position:relative; overflow:hidden; width:100%; }
.auth-carousel-track{
  display:flex; flex-direction:row; gap:14px; width:max-content;
  animation:showcaseScrollLeft 28s linear infinite;
}
.auth-carousel:hover .auth-carousel-track{ animation-play-state:paused; }
@keyframes showcaseScrollLeft{
  0%{ transform:translateX(0); }
  100%{ transform:translateX(-50%); }
}

.showcase-card{
  flex:0 0 auto; width:190px;
  border-radius:18px; padding:16px 15px; color:#fff;
  box-shadow:0 10px 28px rgba(20,30,50,0.18);
  border:1px solid rgba(255,255,255,0.25);
  backdrop-filter:blur(6px);
  position:relative; overflow:hidden;
}
.showcase-card::after{
  content:''; position:absolute; inset:0;
  background:rgba(255,255,255,0.06);
  backdrop-filter:blur(2px);
}
.showcase-card .sc-icon{ font-size:22px; margin-bottom:6px; display:block; position:relative; z-index:1 }
.showcase-card .sc-title{ font-weight:700; font-size:13.5px; margin-bottom:4px; position:relative; z-index:1 }
.showcase-card .sc-desc{ font-size:11px; opacity:.92; line-height:1.4; position:relative; z-index:1 }

@media(max-width:900px){
  .auth-showcase{ display:none; }
}
@media(max-width:480px){
  .auth-hero-card{ height:170px; }
  .showcase-card{ width:160px; }
}
