/* ======================================================
   OUTRIGHT PORTAL — assets/app.css (CLEAN)
   NOTE: This file must contain ONLY CSS (NO PHP).
====================================================== */

:root{
  --pagebg:#e6f5ff;
  --brand:#17285c;
  --text:#0f1b3d;
  --muted:rgba(0,0,0,.6);
  --card:#ffffff;
  --border:rgba(23,40,92,.12);
  --danger:#ef4444;
  --ok:#16a34a;
}

/* Base */
html, body{ height:100%; }
body{
  margin:0;
  min-height:100vh;
  background: var(--pagebg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* Main wrapper */
.wrap{
  max-width:980px;
  margin:18px auto;
  padding:0 14px;
}

/* Card */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(0,0,0,.06);
}

/* Headings */
h1,h2,h3{ margin:0 0 10px; }
h2{ font-size:20px; }
small{ color: var(--muted); }

/* Layout helpers */
.row{ display:flex; gap:12px; flex-wrap:wrap; }
.col{ flex:1; min-width:220px; }

.grid{ display:grid; grid-template-columns:repeat(12,1fr); gap:12px; }
.g4{ grid-column:span 4; }
.g6{ grid-column:span 6; }
.g12{ grid-column:span 12; }

@media (max-width: 900px){
  .g4,.g6{ grid-column:span 12; }
}

/* Form elements */
label{
  font-size:13px;
  color: var(--muted);
  display:block;
  margin-bottom:6px;
}

/* ✅ IMPORTANT:
   do NOT apply width:100% to checkbox/radio inputs */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  font-size:14px;
  background:#fff;
}

textarea{
  min-height:90px;
  resize:vertical;
}

/* Buttons */
.btn{
  display:inline-block;
  padding:10px 14px;
  border-radius:10px;
  border:1px solid transparent;
  background: var(--brand);
  color:#fff;
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
  text-align:center;
}
.btn:hover{ filter:brightness(.95); }

.btn.primary{ background: var(--brand); color:#fff; }
.btn.secondary{
  background:#fff;
  color: var(--brand);
  border-color: var(--brand);
}
.btn.gray{ background:#475569; }
.btn.danger{ background: var(--danger); }
.btn.ok, .btn.success{ background: var(--ok); }

/* Alerts */
.alert{
  padding:10px 12px;
  border-radius:10px;
  margin:12px 0;
  border:1px solid transparent;
}
.alert.success{
  background:#ecfdf5;
  border-color:#86efac;
  color:#166534;
}
.alert.danger{
  background:#fef2f2;
  border-color:#fca5a5;
  color:#991b1b;
}
.alert.secondary{
  background:#f8fafc;
  border-color:#e2e8f0;
  color:#334155;
}

/* Pills */
.pill{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  background:#eff6ff;
  color: var(--brand);
  font-weight:800;
  font-size:12px;
  border:1px solid var(--brand);
}

/* ✅ Status pills for modules (reference checks etc.) */
.status-pill{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  white-space:nowrap;
}
.status-pending{ border-color:rgba(245,158,11,.45); background:rgba(245,158,11,.10); }
.status-completed{ border-color:rgba(34,197,94,.45); background:rgba(34,197,94,.10); }
.status-expired{ border-color:rgba(239,68,68,.45); background:rgba(239,68,68,.10); }
.status-revoked{ border-color:rgba(100,116,139,.45); background:rgba(100,116,139,.10); }

/* ✅ Rating rows (clean + mobile safe) */
.rating-grid{
  display:grid;
  grid-template-columns: 1fr 220px;
  gap:10px;
  align-items:center;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.rating-grid:last-child{ border-bottom:none; }
.rating-label{
  font-weight:900;
  color:var(--text);
}
@media(max-width: 820px){
  .rating-grid{
    grid-template-columns: 1fr;
    gap:8px;
  }
}

/* Tables */
.table{
  width:100%;
  border-collapse:collapse;
  margin-top:10px;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}
.table th,.table td{
  border-bottom:1px solid var(--border);
  padding:10px;
  text-align:left;
  font-size:14px;
  vertical-align:top;
}
.table th{
  font-size:12px;
  color: var(--muted);
  font-weight:800;
  background:#fbfdff;
}
.table-wrap{ overflow:auto; -webkit-overflow-scrolling:touch; }

/* ======================================================
   PHASE 10 — Mobile UI Polish
====================================================== */
@media (max-width: 820px){
  .wrap{ padding: 12px !important; }
  .card{ padding: 14px !important; border-radius: 16px !important; }

  label{ font-size: 14px; font-weight: 800; }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea{
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 12px 12px !important;
    border-radius: 14px !important;
  }

  textarea{ min-height: 120px; }

  /* ✅ IMPORTANT FIX:
     Do NOT apply full-width + big padding to the password eye toggle button */
  button:not(.pw-toggle), .btn, input[type="submit"]{
    width: 100%;
    padding: 14px 14px !important;
    border-radius: 14px !important;
    font-size: 16px !important;
    font-weight: 900 !important;
  }

  /* Tables scroll instead of breaking layout */
  table{
    display:block;
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  th, td{ padding: 10px 10px !important; }
}

/* ======================================================
   ✅ STRONGEST OVERRIDE (keep at VERY BOTTOM)
   Fixes form fields overflowing cards (desktop + mobile)
====================================================== */
*, *::before, *::after { box-sizing: border-box; }

.wrap, .card, form { max-width: 100%; }
.card { overflow: hidden; }

input, select, textarea, button{
  max-width:100%;
  box-sizing:border-box;
}

.row{ flex-wrap: wrap; }
.row > *{ min-width: 0; }

input[type="file"]{ width:100%; }

.grid, .grid2, .grid3{ min-width:0; }

/* =========================
   ✅ GLOBAL CHECKBOX FIX (NO TRANSFORM)
   - Removes scaling that was breaking alignment
   - Keeps size + brand color
========================= */
input[type="checkbox"]{
  width:18px;
  height:18px;
  cursor:pointer;
  accent-color: var(--brand);
  margin:0;
  vertical-align: middle;
}

/* Standard checkbox row helper (safe for long labels) */
.checkrow{
  display:flex;
  align-items:flex-start;
  gap:10px;
}

.checkrow input[type="checkbox"]{
  flex:0 0 auto;
  margin-top:2px;
}

.checkrow label{
  margin:0;
  flex:1 1 auto;
  min-width:0;
  white-space:normal;
  word-break:break-word;
  line-height:1.25;
}

/* Mobile: slightly larger without transform (still stable) */
@media (max-width: 768px){
  input[type="checkbox"]{
    width:20px;
    height:20px;
  }
}
/* ===== MOBILE HARD WIDTH FIX ===== */
html, body {
  max-width:100%;
  overflow-x:hidden;
}

.wrap {
  width:100%;
  max-width:100%;
  padding-left:12px;
  padding-right:12px;
}

.card {
  width:100%;
  max-width:100%;
  margin-left:0;
  margin-right:0;
  box-sizing:border-box;
}

.avail-table {
  width:100%;
  max-width:100%;
}