/* ==========================================================================
   Vätterleden Logistik — Boka pass
   Samma visuella identitet som portalens startsida: ljust, blått, mjukt
   och rundat, i linje med vatterledenlogistik.se.
   ========================================================================== */

:root {
  --blue-deep:  #0F3C6E;
  --blue:       #1D5FA8;
  --blue-light: #EAF2FB;
  --ink:        #1A2733;
  --steel:      #5C6B7A;
  --line:       #DDE3EC;
  --paper:      #FFFFFF;
  --bg:         #EBEFF5;
  --cell-bg:    #F5F7FA;
  --ok:         #1E7A4C;
  --ok-bg:      #E4F3EA;
  --full:       #B23B3B;
  --full-bg:    #FBEAEA;

  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-deep); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Topbar ---------- */

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--blue-deep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.brand-word {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--blue-deep);
  line-height: 1.15;
  display: flex;
  flex-direction: column;
}
.brand-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--steel);
}

.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topnav > a { color: var(--ink); font-size: 0.92rem; font-weight: 500; text-decoration: none; }
.topnav > a:hover { color: var(--blue); }
.user-pill {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--blue-deep);
  background: var(--blue-light);
  padding: 5px 12px;
  border-radius: 20px;
}
.btn-link { color: var(--steel) !important; }
.btn-primary-small {
  background: var(--blue-deep);
  color: #fff !important;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
}
.btn-primary-small:hover { background: var(--blue) !important; text-decoration: none; }

.page { max-width: 1040px; margin: 0 auto; padding: 32px 20px 70px; }

.page-header h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 4px;
  color: var(--blue-deep);
}
.muted { color: var(--steel); }

.footer {
  text-align: center;
  color: var(--steel);
  font-size: 0.82rem;
  padding: 34px 0;
}

/* ---------- Auth ---------- */

.auth-card {
  max-width: 420px;
  margin: 56px auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px;
  box-shadow: 0 4px 14px rgba(15, 60, 110, 0.09);
}
.auth-card h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.4rem;
  margin-top: 0;
  color: var(--blue-deep);
}

.form { display: flex; flex-direction: column; gap: 15px; margin-top: 12px; }
.form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.85rem; font-weight: 600; color: var(--steel);
}
.form input, .form textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
}
.form input:focus, .form textarea:focus {
  border-color: var(--blue);
  background: #fff;
}
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }

.btn-primary, .btn-secondary {
  border: none;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-primary { background: var(--blue-deep); color: #fff; }
.btn-primary:hover { background: var(--blue); }
.btn-primary:disabled { background: var(--line); color: var(--steel); cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--blue-deep); border: 1px solid var(--line) !important; }
.btn-secondary:hover { border-color: var(--blue) !important; background: var(--blue-light); }
.btn-secondary:disabled { color: var(--line); cursor: not-allowed; background: #fff; }
.btn-link-danger {
  background: none; border: none; color: var(--full);
  cursor: pointer; font-size: 0.85rem; padding: 0; font-weight: 600;
}
.btn-link-danger:hover { text-decoration: underline; }

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}
.alert-error { background: var(--full-bg); color: var(--full); }
.alert-success { background: var(--ok-bg); color: var(--ok); }

/* ---------- Calendar (desktop grid) ---------- */

.calendar-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-top: 20px;
  box-shadow: 0 4px 14px rgba(15, 60, 110, 0.09);
}
.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 10px;
}
.calendar-controls h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--blue-deep);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--steel);
  padding: 6px 0;
}
.cal-cell {
  min-height: 92px;
  background: var(--cell-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.cal-cell:hover { border-color: var(--blue); background: #EFF4FB; }
.cal-cell-open { background: var(--ok-bg); border-color: #C7E6D3; }
.cal-cell-open:hover { border-color: var(--ok); }
.cal-cell-full { background: var(--full-bg); border-color: #F0CDCD; }
.cal-cell-full:hover { border-color: var(--full); }
.cal-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-empty:hover { border-color: transparent; }
.cal-cell-head { display: flex; align-items: baseline; justify-content: space-between; }
.cal-daynum { font-weight: 600; font-size: 0.92rem; }
.cal-weekday-label { display: none; } /* shown only in mobile list view */
.cal-today .cal-daynum {
  background: var(--blue-deep); color: #fff;
  padding: 1px 7px; border-radius: 20px;
}
.cal-badges { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.cal-badge {
  font-size: 0.68rem;
  padding: 3px 7px;
  font-weight: 600;
  width: fit-content;
  border-radius: 6px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}
.cal-badge-status {
  font-weight: 700;
  font-size: 0.72rem;
}
.cal-badge-count { opacity: 0.85; font-size: 0.64rem; }
.cal-badge-open { background: var(--ok); color: #fff; }
.cal-badge-full { background: var(--full); color: #fff; }
.cal-badge-mine { background: var(--blue-deep); color: #fff; font-weight: 600; font-size: 0.7rem; }
.cal-badge-none { background: transparent; color: var(--line); font-weight: 500; }
.cal-cell-empty-day:hover .cal-badge-none { color: var(--steel); }

/* ---------- Calendar (mobile agenda list) ---------- */

@media (max-width: 640px) {
  .calendar-wrap { padding: 14px; }
  .calendar-controls h2 { font-size: 1rem; }

  .calendar-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .cal-weekday { display: none; }
  .cal-empty { display: none; }

  .cal-cell {
    min-height: unset;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px;
  }
  .cal-cell-head {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    flex: 0 0 auto;
    width: 64px;
  }
  .cal-daynum { font-size: 1.05rem; }
  .cal-weekday-label {
    display: inline;
    font-size: 0.68rem;
    color: var(--steel);
    text-transform: uppercase;
  }
  .cal-badges { flex-direction: row; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
  .cal-badge { flex-direction: column; align-items: flex-end; padding: 5px 9px; }
  .cal-badge-status { font-size: 0.76rem; }
  .cal-badge-count { font-size: 0.66rem; }
}

/* ---------- Panel / table ---------- */

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-top: 20px;
  box-shadow: 0 4px 14px rgba(15, 60, 110, 0.09);
}
.panel h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--blue-deep);
  margin-top: 0;
}
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.table th {
  color: var(--steel);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
@media (max-width: 640px) {
  .table { font-size: 0.82rem; }
  .table th, .table td { padding: 8px 6px; }
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 33, 59, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 32px rgba(15, 33, 59, 0.18);
}
.modal h2 {
  margin-top: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--blue-deep);
}
.modal h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--steel);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 18px;
}
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  border: none; background: var(--bg);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 1rem; cursor: pointer;
  color: var(--steel);
  line-height: 1;
}
.modal-close:hover { background: var(--blue-light); color: var(--blue-deep); }

/* Shift card */
.shift-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg);
}
.shift-card-mine { background: var(--blue-light); border-color: #C9DFF5; }
.shift-card-main { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; }
.shift-card-main strong { font-size: 1rem; color: var(--blue-deep); }
.shift-title { color: var(--steel); font-weight: 500; }
.shift-card-action-col { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

@media (max-width: 480px) {
  .shift-card { flex-direction: column; align-items: stretch; }
  .shift-card-action, .shift-card-action-col { align-items: stretch; }
  .shift-card-action-col { flex-direction: row; justify-content: flex-end; }
}
