/* =====================================================
   СТО Booking — Design System v2
   Современный, чистый, презентабельный UI
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --brand:        #2563eb;
  --brand-dark:   #1d4ed8;
  --brand-light:  #3b82f6;
  --brand-bg:     #eff6ff;
  --brand-soft:   #dbeafe;
  --accent:       #f59e0b;
  --accent-hover: #d97706;
  --danger:       #ef4444;
  --danger-bg:    #fef2f2;
  --success:      #10b981;
  --success-bg:   #ecfdf5;
  --warning:      #f59e0b;
  --warning-bg:   #fffbeb;
  --text:         #0f172a;
  --text-secondary: #334155;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --border-light: #f1f5f9;
  --surface:      #ffffff;
  --bg:           #f8fafc;
  --bg-elevated:  #ffffff;
  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --shadow:       0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:    0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg:    0 12px 32px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.04);
  --shadow-brand: 0 4px 14px rgba(37,99,235,0.25);
  --font-head:    'Manrope', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-dark); }

img { max-width: 100%; display: block; }

/* ── ШАПКА ────────────────────────────────────────── */

.site-header {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
  box-shadow: 0 4px 24px rgba(37,99,235,0.25);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.logo-text span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.nav-link.active,
.nav-link--accent {
  color: #fff;
  background: rgba(255,255,255,0.2);
  font-weight: 600;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.btn-header:hover {
  background: rgba(255,255,255,0.28);
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

.btn-header.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1c1917;
  box-shadow: 0 2px 8px rgba(245,158,11,0.35);
}

.btn-header.primary:hover {
  background: var(--accent-hover);
  color: #1c1917;
}

/* ── КОНТЕЙНЕР ────────────────────────────────────── */

.page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

/* ── ЗАГОЛОВКИ ────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.3px;
}

h1 { font-size: 1.875rem; font-weight: 800; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }

.page-title {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 28px;
  max-width: 560px;
}

/* ── КАРТОЧКИ ─────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-accent {
  border-left: 4px solid var(--brand);
}

.card-elevated {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

/* ── КНОПКИ ───────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.3;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
  transform: translateY(-1px);
  color: #fff;
}

.btn-secondary {
  background: var(--brand-bg);
  color: var(--brand);
  border: 1px solid var(--brand-soft);
}

.btn-secondary:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-bg);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* ── ФОРМЫ ────────────────────────────────────────── */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.form-group input::placeholder {
  color: #94a3b8;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 5px;
}

/* ── АЛЕРТЫ / СООБЩЕНИЯ ───────────────────────────── */

.messages {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--success-bg);
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: var(--danger-bg);
  color: #991b1b;
  border-color: #fecaca;
}

.alert-info {
  background: var(--brand-bg);
  color: #1e40af;
  border-color: var(--brand-soft);
}

/* ── СТАНЦИИ (список + карточки) ──────────────────── */

.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.station-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: var(--transition);
  min-height: 140px;
}

.station-card:hover {
  border-color: var(--brand-soft);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  color: inherit;
}

.station-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.station-address {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.station-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.station-card-footer span:first-child {
  font-size: 13px;
  color: var(--text-muted);
}

.station-card-arrow {
  color: var(--brand);
  font-weight: 700;
  font-size: 15px;
  transition: transform var(--transition);
}

.station-card:hover .station-card-arrow {
  transform: translateX(3px);
}

/* ── КАРТА ────────────────────────────────────────── */

.map-container {
  width: 100%;
  height: 380px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  background: var(--border-light);
}

/* ── БРОНИРОВАНИЕ ─────────────────────────────────── */

.book-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: start;
}

@media (max-width: 900px) {
  .book-layout { grid-template-columns: 1fr; }
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.slot-btn {
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.slot-btn:hover {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--brand);
}

.slot-btn.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.slot-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.selected-slot-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-bg);
  color: var(--brand-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--brand-soft);
  margin-bottom: 16px;
}

/* ── ЗАПИСИ (карточки) ────────────────────────────── */

.appt-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.appt-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  align-items: center;
}

.appt-card:hover {
  box-shadow: var(--shadow-md);
}

.appt-station {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.appt-time {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 3px;
}

.appt-car {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.appt-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.appt-photos img {
  height: 72px;
  width: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
}

/* ── СТАТУС-БЕЙДЖИ ────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-booked {
  background: var(--brand-bg);
  color: var(--brand-dark);
}

.badge-done {
  background: var(--success-bg);
  color: #065f46;
}

.badge-cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.badge-noshow {
  background: var(--warning-bg);
  color: #92400e;
}

/* ── АВТО-СПИСОК ──────────────────────────────────── */

.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.car-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.car-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--brand-soft);
}

.car-icon {
  font-size: 1.75rem;
  margin-bottom: 10px;
}

.car-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.car-type {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.car-plate {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1.5px;
  background: var(--brand-bg);
  color: var(--brand-dark);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--brand-soft);
}

.car-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ── КАБИНЕТ / DASHBOARD ──────────────────────────── */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.dash-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.dash-tile:hover {
  border-color: var(--brand-soft);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  color: inherit;
}

.dash-tile-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-bg);
  border-radius: 12px;
}

.dash-tile-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
}

.dash-tile-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── STAT CARDS (station dashboard) ───────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--brand);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ── ТАБЛИЦЫ (station cabinet) ────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr:hover td {
  background: #f8fafc;
}

/* ── EMPTY STATE ──────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.7;
}

.empty-state-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state-text {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── AUTH PAGES ───────────────────────────────────── */

.auth-wrap {
  max-width: 420px;
  margin: 48px auto;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-icon {
  font-size: 2.25rem;
  text-align: center;
  margin-bottom: 8px;
}

.auth-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-footer a {
  font-weight: 600;
}

/* ── SECTION HEADER ───────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-header h2 {
  margin: 0;
}

/* ── FILTER BAR ───────────────────────────────────── */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.filter-bar input,
.filter-bar select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--brand);
}

/* ── BACK LINK ────────────────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 16px;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--brand);
}

/* ── АДАПТИВ ──────────────────────────────────────── */

@media (max-width: 700px) {
  .header-inner { padding: 0 16px; gap: 12px; height: 60px; }
  .header-nav { display: none; }
  .logo-text { font-size: 15px; }
  .logo-text span { font-size: 10px; }
  .page-wrap { padding: 24px 16px 48px; }
  .page-title { font-size: 1.4rem; }
  h1 { font-size: 1.4rem; }
  .station-grid { grid-template-columns: 1fr; }
  .appt-card { grid-template-columns: 1fr; gap: 12px; }
  .car-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .auth-wrap { margin: 24px auto; }
  .auth-card { padding: 28px 22px; }
  .map-container { height: 280px; }
  .slot-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 400px) {
  .dash-grid { grid-template-columns: 1fr; }
}
