/* ── Vin och Vänner Bokningssystem — Stylesheet ── */

:root {
  --brun-mork: #2c1810;
  --brun-medium: #5c3317;
  --guld: #d4af37;
  --guld-ljus: #c9a96e;
  --beige: #f9f5f0;
  --beige-medium: #f0e8da;
  --rod-vin: #8b1a1a;
  --text: #333;
  --text-ljus: #666;
  --kant: #e0d0bc;
  --gron: #10b981;
  --gul: #f59e0b;
  --bla: #3b82f6;
  --rod: #ef4444;
  --radius: 8px;
  --skugga: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f0ebe3;
  color: var(--text);
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  background: var(--brun-mork);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(212,175,55,0.15);
}
.navbar-brand {
  color: var(--guld);
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.navbar-logo {
  height: 44px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.navbar-links a {
  color: var(--guld-ljus);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 15px;
  transition: all 0.15s;
  white-space: nowrap;
}
.navbar-links a:hover, .navbar-links a.active {
  background: rgba(212,175,55,0.18);
  color: var(--guld);
}
.navbar-links a.logout {
  margin-left: auto;
  color: #888;
  font-size: 14px;
}
.navbar-links a.btn-small {
  background: var(--rod-vin);
  color: #fff;
  font-size: 13px;
  border-radius: 6px;
}

/* ── Layout ── */
.main-content { padding: 24px; max-width: 1400px; margin: 0 auto; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--brun-mork); }

/* ── Kort ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--skugga);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brun-mork);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--beige-medium);
}

/* ── Dashboard ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--skugga);
  border-left: 4px solid var(--guld);
}
.stat-card.gron { border-color: var(--gron); }
.stat-card.bla { border-color: var(--bla); }
.stat-card.rod { border-color: var(--rod); }
.stat-label { font-size: 12px; color: var(--text-ljus); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--brun-mork); margin: 4px 0; }
.stat-sub { font-size: 12px; color: var(--text-ljus); }

/* ── Beläggningsstaplar ── */
.vecka-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.dag-bar { text-align: center; }
.dag-bar-inner {
  height: 60px;
  background: var(--beige-medium);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.dag-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--guld);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
}
.dag-bar-fill.hog { background: var(--gron); }
.dag-bar-fill.full { background: var(--rod); }
.dag-label { font-size: 11px; color: var(--text-ljus); margin-top: 4px; }
.dag-procent { font-size: 12px; font-weight: 600; color: var(--brun-mork); }

/* ── Tabell ── */
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--beige-medium);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--brun-medium);
  border-bottom: 2px solid var(--kant);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--beige-medium);
  font-size: 14px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--beige); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-inkommen { background: #fef3c7; color: #92400e; }
.badge-bekraftad { background: #d1fae5; color: #065f46; }
.badge-incheckad { background: #dbeafe; color: #1e40af; }
.badge-avslutat { background: #f3f4f6; color: #6b7280; }
.badge-avbokad { background: #fee2e2; color: #991b1b; }

/* ── Knappar ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--rod-vin); color: #fff; }
.btn-primary:hover { background: #6b1414; }
.btn-secondary { background: var(--beige-medium); color: var(--brun-mork); }
.btn-secondary:hover { background: var(--kant); }
.btn-success { background: var(--gron); color: #fff; }
.btn-warning { background: var(--gul); color: #fff; }
.btn-danger { background: var(--rod); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Formulär ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--brun-mork);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--kant);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: var(--guld);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.form-check input { margin-top: 3px; accent-color: var(--rod-vin); }

/* ── Flash-meddelanden ── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Bokningsformulär (gäst) ── */
body.boka-page {
  background: var(--beige);
}
.boka-wrapper {
  max-width: 560px;
  margin: 40px auto;
  padding: 0 16px;
}
.boka-header {
  background: var(--brun-mork);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 36px 32px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.boka-header::after {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--guld), transparent);
  margin-top: 20px;
  opacity: 0.6;
}
.boka-logo {
  width: 220px;
  max-width: 70%;
  display: block;
  margin: 0 auto;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.boka-tagline {
  color: var(--guld-ljus, #d4b483);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 14px;
  margin-bottom: 0;
}
.boka-body {
  background: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 32px;
  box-shadow: var(--skugga);
}
.tider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.tid-btn {
  padding: 10px;
  border: 2px solid var(--kant);
  border-radius: var(--radius);
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.tid-btn:hover { border-color: var(--guld); background: var(--beige); }
.tid-btn.vald { border-color: var(--rod-vin); background: var(--rod-vin); color: #fff; }
.tid-btn.full { background: #f3f4f6; color: #aaa; border-color: #e5e7eb; cursor: not-allowed; }
.boka-submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--rod-vin);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}
.boka-submit-btn:hover { background: #6b1414; }

/* ── Check-in ── */
.checkin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.checkin-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--skugga);
  padding: 18px 20px;
  border-left: 5px solid var(--gul);
}
.checkin-card.incheckad { border-color: var(--gron); }
.checkin-card.avslutat { border-color: #ccc; opacity: 0.6; }
.checkin-tid { font-size: 24px; font-weight: 700; color: var(--brun-mork); }
.checkin-namn { font-size: 18px; color: var(--brun-medium); margin: 4px 0; }
.checkin-info { font-size: 13px; color: var(--text-ljus); }
.checkin-onskningar {
  background: #fff9e6;
  border: 1px solid var(--guld-ljus);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  margin: 10px 0;
}
.checkin-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── Personalstämpling ── */
body.stampla-page {
  background: linear-gradient(160deg, var(--brun-mork) 0%, #1a0d08 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.stampla-wrapper {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.stampla-logo {
  display: block;
  margin: 0 auto 6px;
  height: 60px;
  width: auto;
}
.stampla-titel { font-size: 13px; font-weight: 600; color: var(--text-ljus); margin-bottom: 28px; letter-spacing: 1px; text-transform: uppercase; }
.pin-display {
  font-size: 32px;
  letter-spacing: 8px;
  color: var(--brun-mork);
  background: var(--beige);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  min-height: 58px;
}
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.pin-btn {
  padding: 18px;
  font-size: 22px;
  font-weight: 600;
  border: 2px solid var(--kant);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: all 0.1s;
}
.pin-btn:hover { background: var(--beige); border-color: var(--guld); }
.pin-btn:active { background: var(--brun-mork); color: #fff; }
.stampla-meddelande {
  padding: 16px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}
.stampla-meddelande.in { background: #d1fae5; color: #065f46; }
.stampla-meddelande.ut { background: #dbeafe; color: #1e40af; }
.stampla-meddelande.error { background: #fee2e2; color: #991b1b; }
.personal-lista { margin-top: 20px; text-align: left; }
.personal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--beige-medium);
  font-size: 15px;
}
.dot-gron { width: 10px; height: 10px; border-radius: 50%; background: var(--gron); }

/* ── Kalender wrapper ── */
#kalender { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--skugga); }

/* ── Gantt / Dagsvy ── */
.gantt-wrapper { overflow-x: auto; }
.gantt { min-width: 800px; }
.gantt-header { display: grid; background: var(--beige-medium); border-radius: var(--radius) var(--radius) 0 0; }
.gantt-row { display: grid; border-bottom: 1px solid var(--beige-medium); min-height: 48px; align-items: center; }
.gantt-bord-namn {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brun-mork);
  background: var(--beige);
  border-right: 2px solid var(--kant);
}
.gantt-tider { position: relative; height: 48px; }
.gantt-bokning {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 4px;
  background: var(--gron);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.gantt-bokning.inkommen { background: var(--gul); color: #333; }
.gantt-bokning.avbokad { background: var(--rod); }

/* ── Responsive — Tablet (768px) ── */
@media (max-width: 768px) {
  /* Navbar: dölja textlänkar, visa hamburger */
  .navbar { padding: 0 16px; height: 58px; gap: 12px; }
  .navbar-links { display: none; flex-direction: column; position: fixed; top: 58px; left: 0; right: 0; bottom: 0; background: var(--brun-mork); padding: 24px 20px; gap: 4px; z-index: 200; overflow-y: auto; }
  .navbar-links.open { display: flex; }
  .navbar-links a { font-size: 17px; padding: 12px 16px; border-radius: 8px; }
  .navbar-hamburger { display: flex; flex-direction: column; gap: 5px; cursor: pointer; padding: 6px; background: none; border: none; margin-left: auto; }
  .navbar-hamburger span { display: block; width: 22px; height: 2px; background: var(--guld-ljus); border-radius: 2px; }
  .navbar-logo { height: 36px; }

  /* Layout */
  .main-content { padding: 12px 14px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .vecka-grid { grid-template-columns: repeat(4, 1fr); }

  /* Tabeller: horisontell scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }
  th, td { padding: 9px 10px; font-size: 13px; }

  /* Knappar: större touch-yta */
  .btn { padding: 10px 16px; font-size: 14px; min-height: 40px; }
  .btn-sm { padding: 7px 12px; font-size: 13px; min-height: 34px; }

  /* Check-in: en kolumn */
  .checkin-grid { grid-template-columns: 1fr; }
  .checkin-tid { font-size: 28px; }
  .checkin-namn { font-size: 20px; }
  .checkin-actions { gap: 10px; }
  .checkin-actions .btn { flex: 1; justify-content: center; min-height: 44px; }

  /* Stämpling: bättre på padda */
  .stampla-wrapper { padding: 32px 24px; border-radius: 12px; }
  .pin-btn { padding: 22px; font-size: 24px; min-height: 64px; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 20px; }
  .page-header > div { display: flex; gap: 8px; flex-wrap: wrap; }
}

/* ── Responsive — Mobil (480px) ── */
@media (max-width: 480px) {
  .main-content { padding: 10px 12px; }
  .navbar { height: 54px; }
  .navbar-links { top: 54px; }
  .navbar-logo { height: 32px; }
  .card { padding: 14px 16px; }
  .stat-value { font-size: 26px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Formulär */
  .form-control { font-size: 16px; } /* Förhindrar zoom på iOS */
  select.form-control { font-size: 16px; }

  /* Tabeller */
  th, td { padding: 8px 8px; font-size: 12px; }

  /* Knappar: full bredd i stacks */
  .btn-stack { display: flex; flex-direction: column; gap: 8px; }
  .btn-stack .btn { width: 100%; justify-content: center; min-height: 46px; font-size: 15px; }

  /* Check-in: extra stora touch-ytor */
  .checkin-card { padding: 16px; }
  .checkin-tid { font-size: 32px; }
  .checkin-namn { font-size: 22px; margin: 6px 0; }
  .checkin-actions { flex-direction: column; }
  .checkin-actions .btn, .checkin-actions button { width: 100%; min-height: 48px; font-size: 15px; justify-content: center; }
  .checkin-actions form { width: 100%; }
  .checkin-actions form button { width: 100%; min-height: 48px; font-size: 15px; }

  /* Stämpling */
  .stampla-wrapper { padding: 24px 16px; max-width: 100%; border-radius: 0; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; box-shadow: none; }
  .pin-btn { padding: 20px; font-size: 26px; min-height: 70px; }
  .pin-display { font-size: 36px; min-height: 66px; }

  /* Personal schema */
  .schema-kort { padding: 14px 16px; }

  /* Veckodiagram */
  .vecka-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .dag-bar-inner { height: 48px; }

  /* Boka-sida */
  .boka-wrapper { margin: 0; padding: 0; }
  .boka-header { padding: 28px 20px 22px; border-radius: 0; }
  .boka-body { padding: 24px 16px; border-radius: 0; }
  .boka-logo { width: 180px; }
}
