/* =========================================================
   MOJA+ — Premium UI Redesign
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=DM+Mono:wght@300;400;500&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  --bg:          #070d1a;
  --surface:     #0d1628;
  --surface2:    #111f36;
  --surface3:    #162540;
  --border:      rgba(255,255,255,.07);
  --border-hi:   rgba(62,207,207,.18);
  --text:        #e8edf5;
  --text-muted:  #6b7f9e;
  --text-dim:    #3d5070;
  --teal:        #3ecfcf;
  --teal-dim:    rgba(62,207,207,.12);
  --teal-glow:   rgba(62,207,207,.06);
  --blue:        #2a7fff;
  --blue-dim:    rgba(42,127,255,.12);
  --ok:          #22c97a;
  --ok-dim:      rgba(34,201,122,.1);
  --err:         #f0566a;
  --err-dim:     rgba(240,86,106,.1);
  --warn:        #f0a730;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ff-head:  'Syne', sans-serif;
  --ff-body:  'DM Sans', sans-serif;
  --ff-mono:  'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(62,207,207,.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 90% 110%, rgba(42,127,255,.05) 0%, transparent 60%);
  min-height: 100vh;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* Header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: fadeUp .25s ease both;
}
.top::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--teal-glow), transparent 40%);
  pointer-events: none;
}
.top > div:first-child { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 48px; height: 48px;
  object-fit: contain;
  border-radius: var(--r);
  background: rgba(255,255,255,.04);
  padding: 5px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.top h1 {
  font-family: var(--ff-head);
  font-size: 17px; font-weight: 600;
  color: var(--text); margin: 0;
}
.muted, p.muted {
  color: var(--text-muted);
  font-size: 12px; font-weight: 300; margin: 0;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  animation: fadeUp .3s ease .05s both;
}
.card h2 {
  font-family: var(--ff-head);
  font-size: 16px; font-weight: 600;
  color: var(--text); margin: 0 0 4px;
}
.card h3 {
  font-family: var(--ff-head);
  font-size: 12px; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--teal); margin: 28px 0 12px;
  text-align: center;
}
.card h3:first-child { margin-top: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r);
  font-family: var(--ff-body); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface3); color: var(--text);
  transition: all .18s ease; white-space: nowrap; line-height: 1.4;
}
.btn:hover { border-color: rgba(255,255,255,.15); background: var(--surface2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn2 {
  background: var(--teal-dim);
  border-color: rgba(62,207,207,.3);
  color: var(--teal);
}
.btn2:hover { background: rgba(62,207,207,.18); border-color: rgba(62,207,207,.5); color: var(--teal); }

/* Actions group */
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
label {
  font-size: 11px; font-weight: 500;
  letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-muted); display: block; margin-bottom: 5px;
}

/* NOTE: many legacy pages use <input> without a type attribute.
   Style all inputs except checkboxes/radios/buttons to keep UI consistent. */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
textarea,
select {
  width: 100%; padding: 10px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: var(--ff-body); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none; outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

/* File input (upload logo) */
input[type="file"]{
  width: 100%;
  padding: 10px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(62,207,207,.4);
  box-shadow: 0 0 0 3px rgba(62,207,207,.07);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7f9e' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px; cursor: pointer;
}
textarea { resize: vertical; min-height: 80px; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-top: 16px;
}
table { width: 100%; border-collapse: collapse; min-width: 600px; font-size: 13px; }
thead tr { background: var(--surface3); }
thead th {
  padding: 11px 14px; text-align: left;
  font-family: var(--ff-head); font-size: 11px;
  font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }
td { padding: 12px 14px; vertical-align: middle; color: var(--text); }
td .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Status Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 500; letter-spacing: .4px; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-pending     { color: var(--warn);      background: rgba(240,167,48,.1);  border: 1px solid rgba(240,167,48,.2); }
.badge-confirmed   { color: var(--ok);        background: rgba(34,201,122,.1);  border: 1px solid rgba(34,201,122,.2); }
.badge-cancelled   { color: var(--err);       background: rgba(240,86,106,.1);  border: 1px solid rgba(240,86,106,.2); }
.badge-checked_in  { color: var(--teal);      background: rgba(62,207,207,.1);  border: 1px solid rgba(62,207,207,.2); }
.badge-checked_out { color: var(--text-muted);background: rgba(107,127,158,.1); border: 1px solid rgba(107,127,158,.2);}
.badge-active      { color: var(--ok);        background: var(--ok-dim);        border: 1px solid rgba(34,201,122,.2); }
.badge-blocked     { color: var(--err);       background: var(--err-dim);       border: 1px solid rgba(240,86,106,.2); }

/* Alert overrides for PHP inline styles */
p[style*="rgba(0,255,120"] {
  display: flex !important; align-items: center; gap: 8px;
  padding: 12px 16px !important; border-radius: var(--r) !important;
  border: 1px solid rgba(34,201,122,.2) !important;
  background: var(--ok-dim) !important;
  color: #7de8b4 !important; font-size: 13px; margin-bottom: 16px;
}
p[style*="rgba(255,0,0"] {
  display: flex !important; align-items: center; gap: 8px;
  padding: 12px 16px !important; border-radius: var(--r) !important;
  border: 1px solid rgba(240,86,106,.2) !important;
  background: var(--err-dim) !important;
  color: #f89aa5 !important; font-size: 13px; margin-bottom: 16px;
}

hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* Filter bar (inline GET forms) */
form[method="get"] {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 16px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 20px;
}
form[method="get"] label { min-width: 100px; }
form[method="get"] select, form[method="get"] input { min-width: 150px; width: auto; }

/* Table action forms */
td form[method="post"] {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 0; background: none; border: none; margin: 0;
}
td form[method="post"] select {
  min-width: 120px; width: auto;
  padding: 6px 28px 6px 10px; font-size: 12px; border-radius: 8px;
}

/* Card number mono */
.card-no {
  font-family: var(--ff-mono); font-size: 13px;
  letter-spacing: 2px; color: var(--teal);
}

/* Dashboard tiles */
.tile-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.tile {
  flex: 0 0 180px;
}
.tile {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none; color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: all .18s;
}
.tile:hover {
  border-color: rgba(62,207,207,.3); background: var(--surface3);
  transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.tile .icon {
  font-size: 18px; width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--teal-dim); flex-shrink: 0;
}
.tile.sec .icon { background: var(--blue-dim); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* Animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 640px) {
  .wrap { padding: 16px 12px 40px; }
  .top { border-radius: var(--r-lg); padding: 12px 14px; }
  .card { padding: 16px; }
  .tile-group {
  justify-items: center; grid-template-columns: 1fr 1fr; }
}

/* ── Alert boxes ────────────────────────────────────── */
.alert-ok  { border:1px solid rgba(34,201,122,.25); background:rgba(34,201,122,.08); padding:10px 14px; border-radius:var(--r); margin-bottom:12px; color:var(--ok); }
.alert-err { border:1px solid rgba(240,86,106,.25);  background:rgba(240,86,106,.08);  padding:10px 14px; border-radius:var(--r); margin-bottom:12px; color:var(--err); }

/* ── EV status dots ─────────────────────────────────── */
.dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:5px; }
.dot-green, .dot.free     { background:var(--ok); }
.dot-red,   .dot.busy     { background:var(--err); }
.dot-yellow,.dot.arrival  { background:var(--warn); }
.dot-blue,  .dot.depart   { background:var(--blue); }
.dot.na     { background:var(--text-dim); }

/* ── Dashboard board (Gantt) ────────────────────────── */
.board-wrap { overflow-x:auto; }
.board { min-width:600px; border:1px solid var(--border); border-radius:var(--r-lg); overflow:hidden; }
.board-row { display:flex; border-bottom:1px solid var(--border); min-height:44px; }
.board-row:last-child { border-bottom:none; }
.board-head { background:var(--surface3); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); }
.board-room { width:140px; flex-shrink:0; padding:8px 14px; border-right:1px solid var(--border); background:var(--surface2); display:flex; align-items:center; gap:8px; }
.board-room .meta { display:flex; flex-direction:column; }
.board-room .meta b { font-size:13px; }
.board-room .meta small { font-size:10px; color:var(--text-muted); }
.board-days { position:relative; overflow:hidden; }
.days-grid { display:grid; grid-auto-columns:48px; grid-auto-flow:column; height:100%; }
.daycell { border-right:1px solid rgba(255,255,255,.04); padding:4px 2px; text-align:center; font-size:10px; color:var(--text-muted); }
.daycell .d { font-weight:600; color:var(--text); }
.daycell .w { font-size:9px; letter-spacing:.5px; }
.bars { position:absolute; inset:0; pointer-events:none; }
.bar { position:absolute; top:5px; bottom:5px; border-radius:6px; display:flex; align-items:center; padding:0 8px; font-size:10px; font-weight:600; overflow:hidden; pointer-events:all; cursor:pointer; white-space:nowrap; }
.bar a { color:inherit; text-decoration:none; display:block; overflow:hidden; text-overflow:ellipsis; }
.bar.confirmed   { background:rgba(34,201,122,.18);  border:1px solid rgba(34,201,122,.4);  color:#22c97a; }
.bar.checked_in  { background:rgba(62,207,207,.18);  border:1px solid rgba(62,207,207,.4);  color:#3ecfcf; }
.bar.checked_out { background:rgba(107,127,158,.12); border:1px solid rgba(107,127,158,.3); color:#6b7f9e; }
.bar.pending     { background:rgba(240,167,48,.12);  border:1px solid rgba(240,167,48,.4);  color:#f0a730; }
.board-tools { display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:12px; }
.board-tools .left { display:flex; gap:8px; align-items:flex-end; flex-wrap:wrap; }
.board-tools .right { display:flex; gap:8px; flex-wrap:wrap; }
.board-tools label { font-size:10px; letter-spacing:1px; text-transform:uppercase; color:var(--text-muted); display:flex; flex-direction:column; gap:4px; }
.board-tools select, .board-tools input[type=date] { background:var(--surface2); border:1px solid var(--border); border-radius:var(--r); color:var(--text); padding:7px 10px; font-size:13px; }

/* ── Standard table (used in dashboard, print_day etc) ── */
.table { width:100%; border-collapse:collapse; }
.table th { padding:10px 14px; text-align:left; font-size:11px; font-weight:500; letter-spacing:1px; text-transform:uppercase; color:var(--text-muted); border-bottom:1px solid var(--border); background:var(--surface3); }
.table td { padding:11px 14px; border-bottom:1px solid var(--border); font-size:13px; }
.table tr:last-child td { border-bottom:none; }
.table tr:hover td { background:rgba(255,255,255,.02); }
.row-muted { color:var(--text-muted); font-size:12px; }

/* ── EV charger pill/kv ─────────────────────────────── */
.ev-pill { border:1px solid var(--border); background:var(--surface2); padding:12px 16px; border-radius:var(--r-lg); display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:16px; }
.ev-kv { display:grid; grid-template-columns:220px 1fr; gap:8px 16px; margin-top:12px; }
.ev-kv .k { color:var(--text-muted); font-size:12px; }
.ev-kv .v { font-weight:600; font-family:var(--ff-mono); font-size:13px; }

/* FINAL SELECT DROPDOWN FIX */
select,
select option,
select optgroup {
  background-color: #172238 !important;
  color: #eaf2ff !important;
}

select:focus {
  background-color: #172238 !important;
  color: #eaf2ff !important;
}

select option:checked,
select option:hover {
  background-color: #1f6feb !important;
  color: #ffffff !important;
}
