/* evchargerhub.lk portal theme — re-themed 2026-05-22 to match the public
   landing at /var/www/evchargerhub/index.html. Single visual identity across
   the static landing and the OCPI hub portal/admin/docs. */

:root {
  /* Pulled from the landing's :root in /var/www/evchargerhub/index.html.
     --primary-grad now drives the portal hero AND is reused for the primary
     CTA gradient (was --red-grad pointing at #AB171B). */
  --primary:      #FF6B35;       /* orange — landing's --primary */
  --secondary:    #004E89;       /* deep blue — landing's --secondary */
  --accent:       #F77F00;       /* lighter orange — landing's --accent */
  --dark:         #1A1A2E;       /* landing's --dark */
  --primary-grad: linear-gradient(135deg, #FF6B35 0%, #F77F00 100%);
  --red-grad:     linear-gradient(135deg, #FF6B35 0%, #F77F00 100%); /* unified with primary-grad */

  --text:         #1A1A2E;
  --text-muted:   #6c757d;
  --surface:      #ffffff;
  --surface-alt:  #f8f9fa;
  --border:       #e6e6e6;
  --success:      #198754;
  --warning:      #c47b00;
  --danger:       #AB171B;        /* keep red for danger/destructive states only */
  --info:         #0d6efd;
  --radius:       8px;
  --radius-pill:  50px;            /* matches landing's .btn border-radius */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 14px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--surface-alt);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  margin-top: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Navigation ---------- */
/* Orange gradient bar across the top of every portal/admin page — matches
   the home page hero so the two surfaces feel like one site. */
.nav {
  background: var(--primary-grad);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.20);
  position: relative;
  z-index: 10;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
}
.nav__brand:hover { text-decoration: none; }
.nav__brand img { height: 40px; width: auto; }
.nav__links { display: flex; align-items: center; gap: 18px; }
.nav__links a {
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Sora', sans-serif;
  font-weight: 500;
}
.nav__links a:hover { color: #fff; text-decoration: none; }
.nav__user { color: rgba(255, 255, 255, 0.85); font-size: 14px; }

/* Button overrides INSIDE the nav: the orange-gradient pill (Sign up) needs
   to invert to white-on-orange so it's readable on the orange nav. The
   outline (Logout) flips to a light outline. */
.nav .theme-btn--gradient {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}
.nav .theme-btn--gradient:hover {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  opacity: 1;
}
.nav .theme-btn--outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.55);
}
.nav .theme-btn--outline:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ---------- Hero (gradient banner used on landing + apply) ---------- */
.hero {
  background: var(--primary-grad);
  color: #fff;
  padding: 60px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  /* Soft mesh overlay to mirror the landing's hero gradient depth. */
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(at 20% 30%, rgba(255, 107, 53, 0.15) 0, transparent 50%),
    radial-gradient(at 80% 70%, rgba(0, 78, 137, 0.15) 0, transparent 50%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.15);
}
.hero p {
  font-size: 18px;
  max-width: 680px;
  margin: 0 auto 24px;
  opacity: 0.95;
}

/* ---------- Layout containers ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px;
}
.container--narrow { max-width: 560px; }
.container--medium { max-width: 800px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card__title {
  margin: 0 0 12px;
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 600;
}
.card__meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---------- Buttons (matches .theme-btn family on landing page) ---------- */
.theme-btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.05s, box-shadow 0.2s;
}
.theme-btn:hover { text-decoration: none; opacity: 0.92; }
.theme-btn:active { transform: translateY(1px); }
.theme-btn--gradient {
  background: var(--primary-grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 107, 53, 0.25);
}
.theme-btn--gradient:hover { box-shadow: 0 10px 24px rgba(255, 107, 53, 0.35); opacity: 1; }
.theme-btn--primary  { background: var(--primary); color: #fff; }
.theme-btn--outline  {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
}
.theme-btn--outline:hover { border-color: var(--primary); color: var(--primary); }
.theme-btn--ghost    { background: transparent; color: var(--text); border-radius: var(--radius); }
.theme-btn--danger   { background: var(--danger); color: #fff; }
.theme-btn--sm       { padding: 7px 14px; font-size: 13px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="file"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
}
.field textarea { min-height: 80px; resize: vertical; }
.field__hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.field__error { color: var(--danger); font-size: 13px; margin-top: 4px; }
.field--checkbox { display: flex; align-items: flex-start; gap: 8px; }
.field--checkbox input { margin-top: 4px; }
.field--checkbox label { margin: 0; font-weight: 400; }

/* ---------- Alerts / banners ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert--success { background: #e7f5ec; color: var(--success); border: 1px solid #b6dec3; }
.alert--warning { background: #fff4e1; color: var(--warning); border: 1px solid #ffd896; }
.alert--danger  { background: #fde9ea; color: var(--danger);  border: 1px solid #f3b3b5; }
.alert--info    { background: #e7f1ff; color: var(--info);    border: 1px solid #b6d4fe; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl th, .tbl td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tbl th { font-weight: 600; background: var(--surface-alt); }
.tbl tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge--neutral  { background: #eee; color: var(--text); }
.badge--success  { background: #e7f5ec; color: var(--success); }
.badge--warning  { background: #fff4e1; color: var(--warning); }
.badge--danger   { background: #fde9ea; color: var(--danger); }
.badge--info     { background: #e7f1ff; color: var(--info); }

/* ---------- Code / monospace ---------- */
code, pre, .mono {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
}
pre {
  background: #1e2127;
  color: #d7dae0;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0;
}
.code-block { position: relative; margin-bottom: 16px; }
.code-block__copy {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(255,255,255,0.1);
  color: #d7dae0;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.code-block__copy:hover { background: rgba(255,255,255,0.2); }
.code-block__copy.copied { background: var(--success); color: #fff; }

/* ---------- Tabs ---------- */
.tabs { border-bottom: 1px solid var(--border); display: flex; gap: 4px; margin-bottom: 16px; }
.tabs__tab {
  padding: 8px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.tabs__tab--active { color: var(--text); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel--active { display: block; }

/* ---------- Footer ---------- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 40px;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--primary); }

/* ---------- Grid helpers ---------- */
.row  { display: flex; gap: 16px; flex-wrap: wrap; }
.col  { flex: 1 1 0; min-width: 240px; }
.col-2 { flex: 2 1 0; min-width: 360px; }
.spacer { height: 16px; }
.text-right { text-align: right; }
.muted { color: var(--text-muted); }
.secret { font-family: 'Menlo', 'Consolas', monospace; letter-spacing: 0.5px; }
.secret.masked { color: transparent; background: repeating-linear-gradient(90deg, #ddd 0 6px, transparent 6px 8px); }

/* ---------- Integration path radios (apply form) ---------- */
.field--path { display: flex; flex-direction: column; gap: 12px; }
.field__radio {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.field__radio:hover { border-color: var(--primary); }
.field__radio input[type="radio"] { margin-top: 4px; accent-color: var(--primary); }
.field__radio:has(input:checked) {
  border-color: var(--primary);
  background: rgba(255, 107, 53, 0.06);
}
.field__radio span { font-size: 14px; line-height: 1.5; color: var(--text); }

/* ---------- Mobile breakpoints ---------- */
/* The top nav uses flex with space-between, which on phones AND in narrow
   tablet windows jams the brand against the right-side links and forces
   the "Apply for access" pill to wrap to three lines. Stack the two halves
   vertically once the viewport drops under tablet-portrait width. */
@media (max-width: 900px) {
  .nav {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .nav__brand {
    justify-content: center;
    font-size: 16px;
    gap: 8px;
  }
  .nav__brand img { height: 32px; }
  .nav__links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 14px;
    font-size: 14px;
  }
  .nav__links a { font-size: 14px; }
  .nav .theme-btn--sm {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  .nav__user { font-size: 13px; width: 100%; text-align: center; }
}

@media (max-width: 640px) {
  .container { padding: 24px 16px; }
  .hero { padding: 40px 16px; }
  .hero p { font-size: 16px; }
  .card { padding: 18px; }
  .row { gap: 12px; }
  .col, .col-2 { min-width: 100%; flex-basis: 100%; }
  /* Default mobile fallback for wide tables: horizontal scroll. */
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tbl th, .tbl td { padding: 8px 10px; font-size: 13px; }

  /* The connectors editor on /locations/submit is a *form*, not a data
     table — horizontal scroll is awful UX there. Override the generic
     .tbl rules above and restructure into a card-per-row stacked layout
     using the data-label attribute the JS emits on each <td>. */
  #evses-tbl { display: block; overflow-x: visible; white-space: normal; }
  #evses-tbl thead { display: none; }
  #evses-tbl tbody, #evses-tbl tr { display: block; width: 100%; }
  #evses-tbl tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--surface);
  }
  #evses-tbl td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: none;
    padding: 6px 0;
  }
  #evses-tbl td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  #evses-tbl td > select,
  #evses-tbl td > input { flex: 1; max-width: 60%; width: auto !important; }
  /* Hide the empty ::before on the row-delete cell so the × sits on its own. */
  #evses-tbl td[data-label=""]::before { content: none; }
  #evses-tbl td[data-label=""] { justify-content: flex-end; padding-top: 4px; }
  .field input, .field select, .field textarea {
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
  }
}
