@import url('/assets/css/region_head.php');

/*shared.css*/

/* ===== Base tokens ===== */
:root{
  --brand:#0a66c2;
  --ink:#1c1c1c;
  --bg:#fff;
  --muted:#666;

  --card-border-color:#e5e7eb;
  --card-border-width:1px;
  --card-border-style:solid;
  --card-radius:10px;

 /* --leftbar-color:#0a66c2;  */ /* can be overridden per tier/region */
  --leftbar-width:6px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
}

/* Unified container */
.container{
  width:85vw;
  max-width:85vw;
  margin:1rem auto;
  padding:1rem;
  background:#fff;
  border-radius:8px;
  box-shadow:0 0 5px rgba(0,0,0,.1);
}

/* Portal-specific container (kept) */
.container.portal{
  max-width:960px;
  margin:2rem auto;
  padding:2rem;
  border-radius:10px;
  box-shadow:0 3px 8px rgba(0,0,0,0.1);
}

/* Headings */
h1{ font-size:20px; margin:0 0 1rem; display:flex; align-items:center; gap:.5rem; }
h2{ font-size:1.3rem; margin-top:1.5rem; }

/* Forms */
label{display:block;margin:.75rem 0 .25rem;font-weight:600;}
input,select,textarea{
  width:100%;
  padding:.7rem .8rem;
  border:1px solid #ddd;
  border-radius:8px;
  font:inherit;
}
/* Fix checkboxes/radios expanding to 100% width */
input[type="checkbox"], input[type="radio"]{
  width:auto;
  height:auto;
  margin:0 .4rem 0 0;
  vertical-align:middle;
}

/* Tables */
table{ width:100%; border-collapse:collapse; }
th,td{ padding:.6rem; border-bottom:1px solid #eee; text-align:left; vertical-align:middle; }

/* Cards */
.card,.panel,.region-card,.tile,.box,.container{
  border-color:var(--card-border-color);
  border-width:var(--card-border-width);
  border-style:var(--card-border-style);
  border-radius:var(--card-radius);
  box-shadow:0 2px 10px rgba(0,0,0,0.06);
  background:#fff;
  padding:12px;
}

/* Left bar stripe (canonical) */
.card,.panel,.container{ position:relative; overflow:hidden; }
.card::before,.panel::before,.container::before{
  content:"";
  position:absolute; left:0; top:0; bottom:0;
  width:var(--leftbar-width);
  background:var(--leftbar-color);
  display:block;
  border-top-left-radius:inherit;
  border-bottom-left-radius:inherit;
}

/* Make the left stripe reach the top on fieldset cards */
fieldset.card{
  overflow: visible;            /* override .card overflow:hidden */
  position: relative;           /* ensure positioning context */
}

fieldset.card::before{
  top: -0.7em;                  /* pull stripe up behind the legend */
}

/* Region card defaults */
.region-card{ border:1px solid var(--card-border-color); border-radius:.5rem; padding:1rem; background:#fff; text-align:center; }
.region-card .card-link{ display:block; text-decoration:none; color:inherit; }
.region-card .card-link:visited{ color:inherit; }
.region-card h3{ margin:.25rem 0 .5rem 0; color:inherit; }

/* Logo holder */
.logo-holder{
  width:150px; height:70px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; line-height:0; background:#fff; border-radius:4px;
}
.logo-holder img{ width:100%; height:100%; object-fit:contain; display:block; margin:0; }

/* Top nav */
.topnav{ position:sticky; top:0; z-index:100; background:#fafafa; border-bottom:1px solid #e5e7eb; padding:.5rem .75rem; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; }
.topnav-left,.topnav-right{ display:flex; align-items:center; gap:.5rem; }
.brand-name{ font-weight:600; color:var(--heading-color,#111827); }
.divider{ color:var(--link-separator-color,#9ca3af); }
.topnav a{ color:#333; text-decoration:none; padding:.25rem .4rem; border-radius:.375rem; }
.topnav a:hover{ background:#f1f5f9; }
.breadcrumbs{ width:100%; padding:.25rem 0 .1rem; color:#666; font-size:.9rem; }
.breadcrumbs a{ color:#555; }
.breadcrumbs .sep{ margin:0 .3rem; color:#bbb; }

/* Stack brand name under logo */
.topnav .brand{ display:flex; flex-direction:column; align-items:center; gap:.25rem; text-align:center; }
.topnav .logo-holder{ margin:0 auto; }
.topnav .brand-name{ display:block; line-height:1.1; }

/* Mobile */
@media (max-width:600px){
  .brand-name{ display:block; }
  .logo-holder{ width:120px; height:50px; }
}

/* Unified status message cards (site-wide) */
.msg,.flash,.notice,.alert,.message{
  padding:.75rem 1rem;
  margin:0 0 1rem;
  background:#fff;
  border:1px solid transparent;
  border-left-width:6px;
  border-radius:.5rem;
}
/* Success = green card with dark-green left border */
.msg.success,.flash.success,.notice.success,.alert.success,.message.success,.success-area, .success{
  background:#daffe7;
  border-color:#065f46;
  border-left-color:#065f46;
  color:#065f46;
    border-left-width: 15px;
}
/* Error = red card with darker-red left border */
.msg.error,.flash.error,.notice.error,.alert.error,.message.error,.error-area, .error{
  background:#ffe5e5;
  border-color:#991b1b;
  border-left-color:#991b1b;
  color:#000000;
    border-left-width: 15px;
}

/* Modal */
.modal-backdrop{
  position:fixed; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.45);
  z-index:10000;
}
.modal{
  width:min(92vw,720px);
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:.75rem;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
  overflow:hidden;
}
.modal-header{ padding:1rem; border-bottom:1px solid #e5e7eb; background:#f8fafc; }
.modal-title{ margin:0; font-size:1.1rem; font-weight:700; }
.modal-body{ padding:1rem; white-space:pre-wrap; }
.modal-actions{ display:flex; gap:.5rem; justify-content:flex-end; padding:1rem; border-top:1px solid #e5e7eb; background:#fafafa; }
@media (max-width:480px){ .modal{ border-radius:.5rem; } }

/* === Unified themed buttons for admin + rider === */

/* Base button anatomy */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
  padding:.7rem 1.1rem; margin:5px;
  font-weight:600; line-height:1; text-decoration:none; cursor:pointer;
  border:1px solid transparent; border-radius:.6rem;
  box-shadow:0 2px 6px rgba(0,0,0,.12);
  transition:transform .12s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:hover{ transform:translateY(-1px); box-shadow:0 6px 14px rgba(0,0,0,.18); }
.btn:active{ transform:translateY(0); box-shadow:0 2px 6px rgba(0,0,0,.12) inset; }
.btn:focus-visible{ outline:0; box-shadow:0 0 0 3px rgba(10,102,194,.25), 0 2px 6px rgba(0,0,0,.12); }
.btn[disabled],.btn[aria-disabled="true"]{ opacity:.55; pointer-events:none; }
.btn.sm{ padding:.5rem .85rem; border-radius:.5rem; }
.btn.lg{ padding:.9rem 1.3rem; border-radius:.7rem; }

/* Rider tier = uses rider vars */
html[data-tier="rider"] .btn{
  background:var(--btn-rider-bg,#ffffff);
  color:var(--btn-rider-text,#000000);
  border-color:var(--primary,#333);
}
html[data-tier="rider"] .btn:hover,
html[data-tier="rider"] .btn:focus{
  background:var(--btn-rider-bg-hover,#ffffff);
  color:var(--btn-rider-text-hover,var(--btn-rider-text,#000000));
}

/* Admin tier = uses admin nav button vars */
html[data-tier="admin"] .btn{
  background:var(--admin-btn-colour,#374151);
  color:var(--admin-btn-text-colour,#ffffff);
  border-color:var(--admin-btn-border-color,#1f2937);
}
html[data-tier="admin"] .btn:hover,
html[data-tier="admin"] .btn:focus{
  background:var(--admin-btn-colour-hover,#1f2937);
  color:var(--admin-btn-text-colour-hover,#ffffff);
  border-color:var(--admin-btn-border-color-hover,#111827);
}

/* Themed nav controls */
.topnav .nav-btn,.topnav .logout-btn{
  display:inline-flex; align-items:center; gap:.35rem;
  padding:.45rem .7rem; line-height:1; text-decoration:none; cursor:pointer;
  border:1px solid transparent; border-radius:.5rem;
  transition:transform .12s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.topnav .nav-btn:hover,.topnav .logout-btn:hover{ transform:translateY(-1px); box-shadow:0 6px 14px rgba(0,0,0,.18); }

/* Rider tier nav buttons */
html[data-tier="rider"] .topnav .nav-btn,
html[data-tier="rider"] .topnav .logout-btn{
  background:var(--btn-rider-bg,#fff);
  color:var(--btn-rider-text,#000);
  border-color:var(--primary,#333);
}
html[data-tier="rider"] .topnav .nav-btn:hover,
html[data-tier="rider"] .topnav .logout-btn:hover{
  background:var(--btn-rider-bg-hover,#fff);
  color:var(--btn-rider-text-hover,var(--btn-rider-text,#000));
}

/* Admin tier nav buttons */
html[data-tier="admin"] .topnav .nav-btn,
html[data-tier="admin"] .topnav .logout-btn{
  background:var(--admin-btn-colour,#374151);
  color:var(--admin-btn-text-colour,#fff);
  border-color:var(--admin-btn-border-color,#1f2937);
}
html[data-tier="admin"] .topnav .nav-btn:hover,
html[data-tier="admin"] .topnav .logout-btn:hover{
  background:var(--admin-btn-colour-hover,#1f2937);
  color:var(--admin-btn-text-colour-hover,#fff);
  border-color:var(--admin-btn-border-color-hover,#111827);
}

/* Neutralize generic link hover for themed nav buttons */
.topnav a.nav-btn:hover{ background:initial; }

/* Layout wrappers */
.wrap{ max-width:95%; margin:1rem auto; padding:0 1rem; }
.frame{ max-width:720px; margin:1rem auto; padding:1rem; }

/* Utility grid */
.grid {display: grid;grid-template-columns: 1fr;gap: 0.5rem;}

/* Admin users: permissions list one per line */
.grid .perm-item{
  grid-column: 1 / -1;          /* span full grid width */
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  /* padding: .25rem 0; */
  width: 100%;
  margin: 0px;
}
.grid .perm-item input[type="checkbox"]{
  flex: 0 0 auto;
  margin-top: .2rem;             /* optical alignment */
}
.grid .perm-item .perm-key{ font-weight: 600; }
.grid .perm-item small{ color: var(--muted); }

/* Prevent horizontal scroll and allow full wrap */
.topnav { flex-wrap: wrap; overflow-x: hidden; }

/* Let both sides wrap and shrink */
.topnav-left, .topnav-right { flex: 1 1 auto; min-width: 0; }

/* Compact spacing on small screens and stack rows */
@media (max-width: 800px){
  .topnav { row-gap: .4rem; }
  .topnav-left, .topnav-right { flex: 1 1 100%; justify-content: center; flex-wrap: wrap; }
  .topnav a, .topnav .nav-btn, .topnav .logout-btn { margin: 0 .25rem .25rem 0; }
  .topnav .logo-holder { width: 120px; height: 50px; }
  .topnav .brand-name { font-size: .95rem; }
}
