/* =============================================================================
   File:     app.css
   Location: css/app.css
   Purpose:  Shared component styles for all RoadDesk pages.
             Consumed via <link> — do NOT duplicate any of these rules inline.
             Page-specific styles (unique layouts, one-off components) stay in
             each page's own <style> block.

   Depends on: css/theme.css  (must be loaded first)
============================================================================= */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Page header (back link + title row) ── */
.page-header { display: flex; align-items: center; gap: 12px; padding-bottom: 4px; }
.back-link {
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  padding: 5px 0; transition: color .15s;
}
.back-link:hover { color: var(--text-primary); }
.page-title { font-size: 20px; font-weight: 700; }

/* ── Section card ── */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Form layout ── */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 0 8px; }

/* ── Form controls ── */
label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 16px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--border-focus); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
select option { background: var(--bg-card); }

/* Remove number input spinners (Safari/WebKit) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Buttons ── */
.btn {
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { color: var(--text-primary); border-color: var(--text-secondary); }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  transition: transform .25s;
  z-index: 999;
}
.toast.show    { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}
footer a { color: var(--text-muted); text-decoration: none; }

/* ── Pill / status filter tabs ── */
.pill-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.pill-tabs--scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pill-tabs--scroll::-webkit-scrollbar { display: none; }

.pill-tab {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.pill-tab:hover  { color: var(--text-primary); }
.pill-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

/* ── Responsive ── */
@media (max-width: 500px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
