/* =================================================================
   Scoophub - Brand & Layout
   Brand: #005ca9 (HSL 207, 100%, 33%) on Bulma 1.x
   ================================================================= */

:root {
  --bulma-primary-h: 207deg;
  --bulma-primary-s: 100%;
  --bulma-primary-l: 33%;
  --bulma-link-h: 207deg;
  --bulma-link-s: 100%;
  --bulma-link-l: 33%;

  --sh-brand: #005ca9;
  --sh-brand-hover: #00498a;
  --sh-brand-50: #e6f0fa;
  --sh-brand-100: #cce1f4;
  --sh-bg: #f7f8fa;
  --sh-surface: #ffffff;
  --sh-border: #e7eaee;
  --sh-border-strong: #d1d6dd;
  --sh-text: #0a0a0a;
  --sh-text-muted: #6b7280;
  --sh-text-soft: #9ca3af;
  --sh-radius: 10px;
  --sh-radius-sm: 6px;
  --sh-shadow-xs: 0 1px 1px rgba(10,10,10,0.04);
  --sh-shadow-sm: 0 1px 2px rgba(10,10,10,0.05), 0 1px 1px rgba(10,10,10,0.03);
  --sh-shadow-md: 0 6px 24px rgba(10,10,10,0.06);
}

* { box-sizing: border-box; }

html, body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--sh-bg);
  color: var(--sh-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11";
}

a { color: var(--sh-brand); }
a:hover { color: var(--sh-brand-hover); }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 22;
  user-select: none;
  vertical-align: middle;
}

/* ====== Shell ====== */
.sh-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* ====== Sidebar ====== */
.sh-sidebar {
  background: var(--sh-surface);
  border-right: 1px solid var(--sh-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 5;
}
.sh-brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--sh-border);
}
.sh-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--sh-text);
  font-weight: 700;
}
.sh-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sh-brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.sh-logo-text {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.sh-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}
.sh-nav-group { margin-bottom: 16px; }
.sh-nav-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--sh-text-soft);
  padding: 0 10px;
  margin-bottom: 6px;
}
.sh-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--sh-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background 80ms ease, color 80ms ease;
}
.sh-nav-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--sh-text-muted);
  transition: color 80ms ease;
}
.sh-nav-item:hover {
  background: var(--sh-bg);
  color: var(--sh-text);
}
.sh-nav-item.is-active {
  background: var(--sh-brand-50);
  color: var(--sh-brand);
}
.sh-nav-item.is-active .material-symbols-outlined {
  color: var(--sh-brand);
}

.sh-sidebar-foot {
  border-top: 1px solid var(--sh-border);
  padding: 10px;
}
.sh-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--sh-text);
}
.sh-user-card:hover { background: var(--sh-bg); color: var(--sh-text); }
.sh-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sh-brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.sh-avatar.sh-avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.sh-user-info { line-height: 1.25; min-width: 0; }
.sh-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-user-role { font-size: 11px; color: var(--sh-text-muted); text-transform: capitalize; }

/* ====== Main + Topbar ====== */
.sh-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sh-topbar {
  height: 60px;
  background: var(--sh-surface);
  border-bottom: 1px solid var(--sh-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 4;
}
.sh-topbar-title { font-size: 16px; font-weight: 600; }
.sh-topbar-actions { display: flex; align-items: center; gap: 8px; }

.sh-content { padding: 24px 28px; flex: 1; }

/* ====== Page header ====== */
.sh-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.sh-page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.sh-page-subtitle { color: var(--sh-text-muted); font-size: 14px; margin-top: 2px; }
.sh-page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ====== Cards ====== */
.sh-card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-xs);
}
.sh-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sh-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}
.sh-card-body { padding: 18px; }
.sh-card-body-flush { padding: 0; }

/* ====== Stats Tiles ====== */
.sh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.sh-stat {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: 16px 18px;
}
.sh-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sh-text-muted);
}
.sh-stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

/* ====== Table ====== */
.sh-table {
  width: 100%;
  border-collapse: collapse;
}
.sh-table th, .sh-table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--sh-border);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
.sh-table th {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sh-text-muted);
  background: var(--sh-bg);
}
.sh-table tr:last-child td { border-bottom: none; }
.sh-table tbody tr:hover td { background: rgba(0, 92, 169, 0.025); }
.sh-table .sh-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ====== Grids ====== */
.sh-grid { display: grid; gap: 16px; }
.sh-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sh-grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sh-grid-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

/* ====== Tile (clickable card) ====== */
.sh-tile {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: 18px;
  text-decoration: none;
  color: var(--sh-text);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.sh-tile:hover {
  border-color: var(--sh-brand);
  box-shadow: 0 4px 16px rgba(0, 92, 169, 0.07);
  color: var(--sh-text);
  transform: translateY(-1px);
}
.sh-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--sh-brand-50);
  color: var(--sh-brand);
  display: grid;
  place-items: center;
}
.sh-tile-icon .material-symbols-outlined { font-size: 22px; }
.sh-tile-title { font-weight: 600; font-size: 15px; }
.sh-tile-desc { color: var(--sh-text-muted); font-size: 13px; line-height: 1.4; }

/* ====== Filters bar ====== */
.sh-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
}
.sh-filters .field { margin: 0; flex: 0 0 auto; }
.sh-filters .field.is-grow { flex: 1 1 200px; }

/* ====== Buttons ====== */
.button { font-weight: 500; }
.button.is-primary { background-color: var(--sh-brand); border-color: var(--sh-brand); }
.button.is-primary:hover, .button.is-primary:focus {
  background-color: var(--sh-brand-hover);
  border-color: var(--sh-brand-hover);
}
.button .material-symbols-outlined { font-size: 18px; margin-right: 4px; }
.button.is-icon { padding: 0 8px; }
.button.is-icon .material-symbols-outlined { margin-right: 0; }
.button.is-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--sh-text-muted);
}
.button.is-ghost:hover { background: var(--sh-bg); color: var(--sh-text); }

/* ====== Forms ====== */
.field { margin-bottom: 1.0rem; }
.label { font-size: 13px; font-weight: 600; color: var(--sh-text); margin-bottom: 4px; }
.input, .textarea, .select select {
  border-color: var(--sh-border-strong);
  border-radius: var(--sh-radius-sm);
  background: var(--sh-surface);
  font-size: 14px;
  box-shadow: none;
}
.input:focus, .input:active, .textarea:focus, .textarea:active, .select select:focus, .select select:active {
  border-color: var(--sh-brand);
  box-shadow: 0 0 0 3px rgba(0, 92, 169, 0.15);
}
.help { font-size: 12px; color: var(--sh-text-muted); }
.help.is-danger { color: #b42525; }

/* ====== Calendar ====== */
.sh-calendar {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  overflow: hidden;
}
.sh-cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--sh-bg);
  border-bottom: 1px solid var(--sh-border);
}
.sh-cal-head > div {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sh-text-muted);
  text-align: center;
}
.sh-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.sh-cal-day {
  border-right: 1px solid var(--sh-border);
  border-bottom: 1px solid var(--sh-border);
  min-height: 110px;
  padding: 6px 8px;
  position: relative;
}
.sh-cal-day:nth-child(7n) { border-right: none; }
.sh-cal-day.is-other-month { background: #fafbfc; color: var(--sh-text-soft); }
.sh-cal-day.is-today { background: var(--sh-brand-50); }
.sh-cal-day.is-weekend { background: #fafbfc; }
.sh-cal-daynum {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.sh-cal-day.is-today .sh-cal-daynum {
  display: inline-block;
  background: var(--sh-brand);
  color: white;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
}
.sh-cal-event {
  display: block;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  color: var(--sh-text);
  background: var(--sh-brand-50);
  border-left: 2px solid var(--sh-brand);
}
.sh-cal-event:hover { color: var(--sh-text); filter: brightness(.95); }
.sh-cal-holiday {
  font-size: 10px;
  color: #b42525;
  font-weight: 500;
  margin-bottom: 2px;
}

/* ====== Seat plan ====== */
.sh-seatplan {
  position: relative;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: var(--sh-bg);
  overflow: hidden;
  user-select: none;
}
.sh-seatplan img {
  display: block;
  width: 100%;
  height: auto;
}
.sh-seat {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sh-surface);
  border: 2px solid var(--sh-brand);
  color: var(--sh-brand);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 100ms ease, background 100ms ease;
  text-decoration: none;
}
.sh-seat:hover { transform: translate(-50%, -50%) scale(1.12); color: var(--sh-brand); }
.sh-seat.is-taken {
  background: var(--sh-brand);
  color: white;
  cursor: not-allowed;
}
.sh-seat.is-mine {
  background: #1f7a3a;
  color: white;
  border-color: #1f7a3a;
}

/* ====== Notification badge ====== */
.sh-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #b42525;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid white;
}

/* ====== Tags ====== */
.sh-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--sh-bg);
  color: var(--sh-text);
  border: 1px solid var(--sh-border);
}
.sh-tag.is-success { background: #e8f6ec; color: #1f7a3a; border-color: #c9ebd2; }
.sh-tag.is-warning { background: #fef7e6; color: #8b6105; border-color: #f6e4ad; }
.sh-tag.is-danger { background: #fde8e8; color: #b42525; border-color: #f5c5c5; }
.sh-tag.is-info { background: var(--sh-brand-50); color: var(--sh-brand); border-color: var(--sh-brand-100); }

/* ====== Empty state ====== */
.sh-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--sh-text-muted);
}
.sh-empty .material-symbols-outlined {
  font-size: 56px;
  color: var(--sh-border-strong);
  margin-bottom: 6px;
}
.sh-empty h3 {
  color: var(--sh-text);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

/* ====== Notification (flash) ====== */
.notification {
  border-radius: var(--sh-radius);
  padding: 12px 18px;
  font-size: 14px;
}

/* ====== Public layout (login) ====== */
.sh-public {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fafbfc 0%, #eaf1f9 100%);
}
.sh-public-card {
  background: white;
  border: 1px solid var(--sh-border);
  border-radius: 14px;
  padding: 44px 40px;
  width: min(420px, 90vw);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 92, 169, 0.08);
}
.sh-public-card .sh-logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 19px;
  margin: 0 auto 16px;
}
.sh-public-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.sh-public-card p {
  color: var(--sh-text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ====== Modal ====== */
.modal-card {
  border-radius: 12px;
  overflow: hidden;
}
.modal-card-head, .modal-card-foot {
  background: var(--sh-surface);
  border-color: var(--sh-border);
}

/* ====== Markdown content (Wiki render) ====== */
.sh-md {
  font-size: 15px;
  line-height: 1.65;
  color: var(--sh-text);
}
.sh-md h1, .sh-md h2, .sh-md h3, .sh-md h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 1.5em 0 0.5em;
}
.sh-md h1 { font-size: 26px; }
.sh-md h2 { font-size: 21px; }
.sh-md h3 { font-size: 17px; }
.sh-md p { margin-bottom: 0.9em; }
.sh-md ul, .sh-md ol { margin: 0.6em 0 1em 1.4em; }
.sh-md li { margin-bottom: 0.2em; }
.sh-md code {
  background: var(--sh-bg);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.sh-md pre {
  background: #0a0a0a;
  color: #f5f5f5;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  overflow-x: auto;
  margin: 1em 0;
}
.sh-md pre code { background: transparent; color: inherit; padding: 0; }
.sh-md blockquote {
  border-left: 3px solid var(--sh-brand);
  padding-left: 14px;
  color: var(--sh-text-muted);
  margin: 1em 0;
}
.sh-md table {
  border-collapse: collapse;
  margin: 1em 0;
  width: 100%;
}
.sh-md table th, .sh-md table td {
  border: 1px solid var(--sh-border);
  padding: 8px 12px;
  font-size: 14px;
}
.sh-md table th { background: var(--sh-bg); font-weight: 600; }
.sh-md hr { border: none; border-top: 1px solid var(--sh-border); margin: 1.5em 0; }
.sh-md a { color: var(--sh-brand); }

/* ====== iframe view ====== */
.sh-iframe-host {
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  overflow: hidden;
  background: var(--sh-surface);
  height: calc(100vh - 180px);
}
.sh-iframe-host iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ====== Definition list (Detail pages) ====== */
.sh-dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 4px 16px;
  font-size: 14px;
}
.sh-dl dt {
  color: var(--sh-text-muted);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid var(--sh-border);
}
.sh-dl dd {
  padding: 8px 0;
  border-bottom: 1px solid var(--sh-border);
}
.sh-dl dt:last-of-type, .sh-dl dd:last-of-type { border-bottom: none; }

/* ====== Section headings ====== */
.sh-section-title {
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--sh-text-muted);
  margin: 24px 0 10px;
}

/* ====== Responsive ====== */
@media (max-width: 900px) {
  .sh-shell { grid-template-columns: 1fr; }
  .sh-sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 248px;
  }
  .sh-content { padding: 16px; }
  .sh-page-head { flex-direction: column; gap: 12px; align-items: stretch; }
}
