/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; }

body {
  background: url('bg.jpg') center center / cover fixed no-repeat;
  font-family: Georgia, serif;
  color: #fcd34d;
  position: relative;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background: rgba(10, 6, 0, 0.45);
  pointer-events: none;
  z-index: 0;
}

.hidden { display: none !important; }

/* ── Hub Header ── */
#hub-view header {
  position: relative; z-index: 1;
  text-align: center;
  padding: 40px 20px 28px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, rgba(10,6,0,0.75) 0%, transparent 100%);
}

#hub-view h1 {
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 700;
  color: #fcd34d;
  letter-spacing: 5px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
}

#hub-view .sub {
  color: rgba(252,211,77,0.55);
  font-size: 0.72rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 6px;
  font-family: sans-serif;
  font-weight: 300;
}

/* ── Trip Grid ── */
#trip-grid {
  position: relative; z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Maintenance Section ── */
#maint-section {
  position: relative; z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

#maint-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 10px;
  cursor: pointer;
  user-select: none;
}

.maint-label {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.28);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: sans-serif;
  white-space: nowrap;
}

.maint-arrow {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
}

.maint-hr {
  flex: 1;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.overdue-badge {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  color: #ef4444;
  font-size: 0.58rem;
  font-family: sans-serif;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

#maint-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#maint-list.collapsed { display: none; }

.maint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(10,6,0,0.65);
  border: 1px solid rgba(251,191,36,0.2);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s;
  user-select: none;
}

.maint-row:hover { border-color: rgba(251,191,36,0.45); }

.maint-icon { font-size: 16px; flex-shrink: 0; }

.maint-name {
  color: #fcd34d;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: sans-serif;
  flex: 1;
}

.maint-last {
  color: rgba(255,255,255,0.8);
  font-size: 0.65rem;
  font-family: sans-serif;
  font-weight: 500;
}

.maint-never {
  color: rgba(255,255,255,0.45);
  font-size: 0.65rem;
  font-family: sans-serif;
}

.maint-dot { font-size: 9px; margin-left: 2px; flex-shrink: 0; }

/* ── Live indicator ── */
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.live-badge {
  position: absolute;
  top: 8px;
  right: 9px;
  font-size: 0.58rem;
  font-weight: 700;
  font-family: sans-serif;
  color: #f59e0b;
  letter-spacing: 0.05em;
  animation: pulse-live 1.4s ease-in-out infinite;
}

.live-dot {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: sans-serif;
  color: #f59e0b;
  white-space: nowrap;
  flex-shrink: 0;
  animation: pulse-live 1.4s ease-in-out infinite;
}

.area-card {
  background: rgba(10,6,0,0.65);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 10px;
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s, transform 0.15s;
  user-select: none;
  position: relative;
}

.area-card:hover {
  border-color: rgba(251,191,36,0.55);
  transform: translateY(-2px);
}

.area-card .card-icon { font-size: 30px; margin-bottom: 10px; }

.area-card .card-name {
  color: #fcd34d;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: sans-serif;
  margin-bottom: 6px;
}

.area-card .card-last {
  color: rgba(255,255,255,0.85);
  font-size: 0.68rem;
  font-family: sans-serif;
  font-weight: 500;
}

.area-card .card-overdue {
  color: #ef4444;
  font-size: 0.68rem;
  font-family: sans-serif;
  font-weight: 600;
}

.area-card .card-never {
  color: rgba(255,255,255,0.5);
  font-size: 0.68rem;
  font-family: sans-serif;
}

/* ── Section View ── */
#section-view {
  position: relative; z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid rgba(245,158,11,0.2);
  margin-bottom: 20px;
  background: linear-gradient(180deg, rgba(10,6,0,0.6) 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

#section-icon { font-size: 22px; }

#section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fcd34d;
  font-family: sans-serif;
}

#back-btn, #edit-toggle {
  background: rgba(10,6,0,0.5);
  border: 1px solid rgba(251,191,36,0.3);
  color: #fcd34d;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: sans-serif;
  transition: border-color 0.2s;
}

#back-btn:hover, #edit-toggle:hover {
  border-color: rgba(251,191,36,0.6);
}

/* ── Progress Bar ── */
#progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

#progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(251,191,36,0.15);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

#progress-bar::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: #f59e0b;
  border-radius: 3px;
  width: var(--progress, 0%);
  transition: width 0.3s ease;
}

#progress-label {
  color: rgba(252,211,77,0.7);
  font-size: 0.72rem;
  font-family: sans-serif;
  white-space: nowrap;
}

/* ── Checklist ── */
#checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

#checklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10,6,0,0.55);
  border: 1px solid rgba(251,191,36,0.15);
  border-radius: 8px;
  padding: 12px 14px;
  backdrop-filter: blur(4px);
  cursor: default;
}

#checklist li.active { cursor: pointer; }
#checklist li.active:hover { border-color: rgba(251,191,36,0.35); }

#checklist li input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #f59e0b;
  cursor: inherit;
  flex-shrink: 0;
}

.item-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

#checklist li .item-text {
  color: #e2c97a;
  font-size: 0.88rem;
  font-family: sans-serif;
  line-height: 1.4;
}

#checklist li .item-last {
  color: rgba(255,255,255,0.45);
  font-size: 0.65rem;
  font-family: sans-serif;
}

#checklist li.checked .item-text {
  color: rgba(226,201,122,0.4);
  text-decoration: line-through;
}

#checklist li.checked .item-last {
  color: rgba(255,255,255,0.2);
}

/* ── Session Footer (date + notes) ── */
#session-footer {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#session-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-date-label {
  font-size: 0.68rem;
  color: rgba(252,211,77,0.55);
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

#session-date {
  background: rgba(10,6,0,0.55);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 8px;
  color: #e2c97a;
  font-family: sans-serif;
  font-size: 0.88rem;
  padding: 7px 12px;
  backdrop-filter: blur(4px);
  flex: 1;
  color-scheme: dark;
}

#session-date:focus { outline: none; border-color: rgba(251,191,36,0.5); }

#session-notes {
  width: 100%;
  background: rgba(10,6,0,0.55);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 8px;
  color: #e2c97a;
  font-family: sans-serif;
  font-size: 0.88rem;
  padding: 10px 14px;
  resize: vertical;
  min-height: 70px;
  backdrop-filter: blur(4px);
}

#session-notes::placeholder { color: rgba(226,201,122,0.35); }
#session-notes:focus { outline: none; border-color: rgba(251,191,36,0.5); }

/* ── Action Buttons ── */
.action-row {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.primary-btn {
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(251,191,36,0.5);
  color: #fcd34d;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-family: sans-serif;
  transition: background 0.2s, border-color 0.2s;
}

.primary-btn:hover {
  background: rgba(245,158,11,0.28);
  border-color: rgba(251,191,36,0.8);
}

/* ── Edit Mode ── */
#edit-mode { margin-bottom: 24px; }

#edit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

#edit-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10,6,0,0.55);
  border: 1px solid rgba(251,191,36,0.15);
  border-radius: 8px;
  padding: 10px 12px;
  backdrop-filter: blur(4px);
}

#edit-list li .edit-text {
  flex: 1;
  color: #e2c97a;
  font-size: 0.88rem;
  font-family: sans-serif;
}

.move-btn, .delete-btn {
  background: none;
  border: 1px solid rgba(251,191,36,0.2);
  color: rgba(252,211,77,0.6);
  font-size: 0.75rem;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.move-btn:hover { border-color: rgba(251,191,36,0.5); color: #fcd34d; }
.delete-btn { border-color: rgba(239,68,68,0.2); color: rgba(239,68,68,0.5); }
.delete-btn:hover { border-color: rgba(239,68,68,0.6); color: #ef4444; }

.add-row {
  display: flex;
  gap: 8px;
}

#new-item-input {
  flex: 1;
  background: rgba(10,6,0,0.55);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 8px;
  color: #e2c97a;
  font-family: sans-serif;
  font-size: 0.88rem;
  padding: 9px 12px;
}

#new-item-input::placeholder { color: rgba(226,201,122,0.35); }
#new-item-input:focus { outline: none; border-color: rgba(251,191,36,0.5); }

#add-item-btn {
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(251,191,36,0.4);
  color: #fcd34d;
  font-size: 0.8rem;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: sans-serif;
}

#add-item-btn:hover { background: rgba(245,158,11,0.25); }

/* ── History Panel ── */
#history-panel { margin-top: 32px; }

.history-heading {
  color: rgba(252,211,77,0.5);
  font-size: 0.65rem;
  font-family: sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.history-entry {
  background: rgba(10,6,0,0.45);
  border: 1px solid rgba(251,191,36,0.1);
  border-radius: 8px;
  margin-bottom: 10px;
  backdrop-filter: blur(4px);
  overflow: hidden;
}

.history-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
}

.history-date-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-date-btn {
  background: none;
  border: none;
  color: rgba(252,211,77,0.35);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.edit-date-btn:hover { color: #fcd34d; }

.history-date-edit {
  background: rgba(10,6,0,0.6);
  border: 1px solid rgba(251,191,36,0.4);
  border-radius: 6px;
  color: #e2c97a;
  font-family: sans-serif;
  font-size: 0.78rem;
  padding: 3px 8px;
  color-scheme: dark;
}

.history-date-edit:focus { outline: none; border-color: rgba(251,191,36,0.7); }

.history-date {
  color: rgba(252,211,77,0.8);
  font-size: 0.8rem;
  font-family: sans-serif;
}

.history-toggle {
  color: rgba(252,211,77,0.4);
  font-size: 0.7rem;
  font-family: sans-serif;
}

.history-notes {
  color: rgba(226,201,122,0.55);
  font-size: 0.78rem;
  font-family: sans-serif;
  font-style: italic;
  padding: 0 14px 8px;
}

.history-items {
  padding: 0 14px 12px;
  display: none;
}

.history-items.open { display: block; }

.history-items li {
  color: rgba(226,201,122,0.55);
  font-size: 0.78rem;
  font-family: sans-serif;
  padding: 3px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-items li::before { content: '✓'; color: rgba(74,222,128,0.5); font-size: 0.7rem; }
.history-items li.unchecked::before { content: '–'; color: rgba(252,211,77,0.2); }

.history-empty {
  color: rgba(252,211,77,0.3);
  font-size: 0.8rem;
  font-family: sans-serif;
  text-align: center;
  padding: 20px 0;
}

/* ── Hub Dashboard ── */
#hub-dashboard {
  position: relative; z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

#vehicle-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(10,6,0,0.65);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  backdrop-filter: blur(6px);
}

.vc-icon { font-size: 34px; flex-shrink: 0; }

.vc-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fcd34d;
  font-family: Georgia, serif;
}

.vc-meta {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
  font-family: sans-serif;
  margin-top: 3px;
  letter-spacing: 1px;
}

.vc-sessions {
  font-size: 0.63rem;
  color: rgba(255,255,255,0.28);
  font-family: sans-serif;
  margin-top: 3px;
  letter-spacing: 1px;
}

.health-block { margin-left: auto; text-align: center; flex-shrink: 0; }

.health-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: sans-serif;
  margin: 0 auto;
}

.health-label {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
  font-family: sans-serif;
}

#stats-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.stat-pill {
  flex: 1;
  background: rgba(10,6,0,0.65);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  backdrop-filter: blur(6px);
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fcd34d;
  font-family: Georgia, serif;
  line-height: 1;
}

.stat-lbl {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 4px;
  font-family: sans-serif;
}

#activity-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.activity-panel {
  background: rgba(10,6,0,0.65);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 8px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
}

.panel-heading {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  font-family: sans-serif;
}

.act-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: sans-serif;
}

.act-entry:last-child { border-bottom: none; }

.act-icon { font-size: 13px; flex-shrink: 0; }

.act-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-date {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.28);
  white-space: nowrap;
  flex-shrink: 0;
}

.act-overdue {
  font-size: 0.65rem;
  color: #ef4444;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.act-due-soon {
  font-size: 0.65rem;
  color: #f59e0b;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.act-empty {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.2);
  font-family: sans-serif;
  text-align: center;
  padding: 8px 0;
}

.status-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  font-size: 10px;
  line-height: 1;
}
