/* PBK - Prva Bošnjačka Gimnazija - Shared Design System & Base Styles */

:root {
  color-scheme: light;

  /* Brand Palette */
  --pbk-red: #b22522;
  --pbk-red-dark: #8c1916;
  --pbk-red-deeper: #6d100d;
  --pbk-cream: #f9ef96;
  --pbk-accent: #b22522;
  --pbk-accent-hover: #8c1916;
  --pbk-accent-soft: rgba(178, 37, 34, 0.1);

  /* Semantic Surfaces */
  --bg-page: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-subtle: #eef2f6;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;

  /* Semantic Typography (WCAG AA+ contrast) */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #526071;
  --text-inverse: #ffffff;

  /* Borders & Elevation */
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.18);
  --shadow-focus: 0 0 0 3px rgba(178, 37, 34, 0.22);

  /* Semantic Status Tokens */
  --status-success-bg: #dcfce7;
  --status-success-text: #166534;
  --status-success-border: #86efac;

  --status-danger-bg: #fee2e2;
  --status-danger-text: #991b1b;
  --status-danger-border: #fca5a5;

  --status-warning-bg: #fef3c7;
  --status-warning-text: #92400e;
  --status-warning-border: #fcd34d;

  --status-info-bg: #dbeafe;
  --status-info-text: #1e40af;
  --status-info-border: #93c5fd;

  --status-muted-bg: #e2e8f0;
  --status-muted-text: #334155;
  --status-muted-border: #cbd5e1;

  /* Backwards-compatible variable aliases */
  --page-bg: var(--bg-page);
  --card-bg: var(--bg-surface);
  --text-dark: var(--text-primary);
  --border-color: var(--border-default);

  /* Layout Tokens (overridden cleanly in header.css by breakpoint) */
  --header-h: 64px;
  --logo-h: 92px;
  --logo-top: 4px;
  --logo-overhang: 40px;

  /* Fonts */
  --font-body: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Oswald', 'Arial Narrow', Arial, sans-serif;
}

:root.dark-theme,
body.dark-theme {
  color-scheme: dark;

  --pbk-accent: #f87171;
  --pbk-accent-hover: #fca5a5;
  --pbk-accent-soft: rgba(248, 113, 113, 0.16);

  --bg-page: #0f1218;
  --bg-surface: #181d26;
  --bg-surface-2: #1f2633;
  --bg-subtle: #252d3b;
  --bg-input: #141923;
  --bg-hover: #252c3a;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-default: #2e3542;
  --border-strong: #3f4a5c;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --shadow-focus: 0 0 0 3px rgba(249, 239, 150, 0.24);

  --status-success-bg: rgba(34, 197, 94, 0.16);
  --status-success-text: #4ade80;
  --status-success-border: rgba(74, 222, 128, 0.35);

  --status-danger-bg: rgba(239, 68, 68, 0.16);
  --status-danger-text: #fca5a5;
  --status-danger-border: rgba(248, 113, 113, 0.35);

  --status-warning-bg: rgba(245, 158, 11, 0.16);
  --status-warning-text: #fcd34d;
  --status-warning-border: rgba(251, 191, 36, 0.35);

  --status-info-bg: rgba(59, 130, 246, 0.16);
  --status-info-text: #93c5fd;
  --status-info-border: rgba(147, 197, 253, 0.35);

  --status-muted-bg: #262e3d;
  --status-muted-text: #cbd5e1;
  --status-muted-border: #3a4457;
}

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

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Display Headings */
h1, h2, .pbk-heading {
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

/* Accessibility Helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 14px;
  z-index: 9999;
  background: var(--pbk-cream);
  color: var(--pbk-red-deeper);
  padding: 10px 16px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--pbk-red);
  box-shadow: var(--shadow-lg);
  transition: top 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 12px;
  outline: 3px solid var(--pbk-red);
  outline-offset: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Page Main Wrapper (zero dead top space below overhanging logo) */
.pbk-page-main {
  width: 100%;
  margin: 0 auto 44px;
  padding: 0 16px;
}

.pbk-meal-main {
  max-width: 640px;
}

.pbk-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.pbk-breadcrumb a {
  color: var(--pbk-accent);
  text-decoration: none;
  font-weight: 600;
}

.pbk-breadcrumb a:hover {
  text-decoration: underline;
}

/* Meal Card (dorucak / rucak / vecera) */
.card {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 24px;
  padding: 30px 24px;
  text-align: center;
  background: var(--pbk-red);
  color: var(--pbk-cream);
  border-radius: 14px;
  border: 3px solid var(--pbk-cream);
  box-shadow: 0 8px 24px rgba(178, 37, 34, 0.25);
}

.card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--pbk-cream);
  justify-content: center;
}

.card .meal-date {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--pbk-cream);
  opacity: 0.92;
  margin-top: 6px;
}

.card .time {
  font-family: var(--font-display);
  font-size: 56px;
  margin: 10px 0;
  font-weight: 600;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);
}

.card .food-label {
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.88;
  margin-top: 14px;
}

.card .food {
  font-family: var(--font-body);
  font-size: 21px;
  margin: 6px 0 0;
  line-height: 1.38;
  font-weight: 600;
  color: #ffffff;
}

/* Dessert Status Tags */
.dessert-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

.dessert-tag.yes {
  background: var(--pbk-cream);
  color: var(--pbk-red-deeper);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.dessert-tag.no {
  background: rgba(0, 0, 0, 0.25);
  color: var(--pbk-cream);
  border: 1px solid rgba(249, 239, 150, 0.4);
}

/* Shared Panel Component */
.panel {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 20px;
  padding: 22px 24px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-default);
  font-family: var(--font-body);
}

.panel h1,
.panel h2,
.panel strong.panel-heading,
.panel > strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--pbk-accent);
  text-transform: uppercase;
  margin: 0 0 8px;
  letter-spacing: 0.4px;
}

.panel h1 {
  font-size: 25px;
}

.panel label {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.panel input,
.panel select,
.panel textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  margin-top: 5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.panel input:focus,
.panel select:focus,
.panel textarea:focus {
  border-color: var(--pbk-accent);
  outline: 2px solid transparent;
  box-shadow: var(--shadow-focus);
}

.panel button,
.btn-primary-pbk {
  margin-top: 18px;
  padding: 11px 20px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: var(--pbk-red);
  color: var(--pbk-cream);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.18s, transform 0.12s;
}

.panel button:hover,
.btn-primary-pbk:hover {
  background: var(--pbk-red-dark);
}

.panel button:disabled,
.btn-primary-pbk:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* RSVP Buttons */
.rsvp-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-rsvp {
  flex: 1 1 160px;
  margin-top: 0 !important;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.btn-rsvp.yes {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border-color: var(--status-success-border);
}

.btn-rsvp.yes:hover,
.btn-rsvp.yes.active {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
}

.btn-rsvp.no {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}

.btn-rsvp.no:hover,
.btn-rsvp.no.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
}

/* Semantic Status Badges & Callouts */
.badge-status,
.pbk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-status.attending,
.pbk-badge.is-success {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border-color: var(--status-success-border);
}

.badge-status.not-attending,
.pbk-badge.is-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}

.badge-status.pending,
.pbk-badge.is-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border-color: var(--status-warning-border);
}

.pbk-badge.is-info {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border-color: var(--status-info-border);
}

.pbk-badge.is-muted {
  background: var(--status-muted-bg);
  color: var(--status-muted-text);
  border-color: var(--status-muted-border);
}

.pbk-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  font-size: 13.5px;
  line-height: 1.45;
  margin-top: 8px;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
}

.pbk-callout.is-info {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border-color: var(--status-info-border);
}

.pbk-callout.is-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border-color: var(--status-warning-border);
}

.pbk-callout.is-success {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border-color: var(--status-success-border);
}

.pbk-callout.is-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}

.pbk-callout.is-muted {
  background: var(--status-muted-bg);
  color: var(--status-muted-text);
  border-color: var(--status-muted-border);
}

.role-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.msg {
  min-height: 1.2em;
  margin-top: 12px;
  font-weight: 600;
  font-size: 14px;
}

/* Responsive Tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--text-primary);
}

td, th {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

th {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 13.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--bg-hover);
}

/* Skeleton Loaders */
@keyframes pbkShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pbk-skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--bg-hover) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: pbkShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

.card .pbk-skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16) 25%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.16) 75%);
  background-size: 200% 100%;
}

.skel-line {
  height: 13px;
  width: 100%;
  margin: 6px 0;
}

.skel-line.w-40 { width: 40%; }
.skel-line.w-60 { width: 60%; }
.skel-line.w-80 { width: 80%; }

.skel-pill {
  display: inline-block;
  height: 24px;
  width: 130px;
  border-radius: 999px;
}

.skel-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

/* Native <dialog> Modals (never display:flex unless [open]) */
dialog.pbk-dialog-modal {
  border: 1px solid var(--border-default);
  padding: 0;
  border-radius: 14px;
  width: min(500px, 94vw);
  max-height: min(88vh, 720px);
  margin: auto;
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-body);
}

dialog.pbk-dialog-modal[open] {
  display: flex;
  flex-direction: column;
}

dialog.pbk-dialog-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
}

.pbk-modal-header {
  background: var(--pbk-red);
  color: var(--pbk-cream);
  border-bottom: 3px solid var(--pbk-cream);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pbk-modal-header h2,
.pbk-modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--pbk-cream);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pbk-modal-close {
  background: rgba(249, 239, 150, 0.16);
  border: 1.5px solid var(--pbk-cream);
  color: var(--pbk-cream);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s, color 0.15s;
}

.pbk-modal-close:hover {
  background: var(--pbk-cream);
  color: var(--pbk-red);
}

.pbk-modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.pbk-modal-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border-default);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pbk-btn-ghost {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.pbk-btn-ghost:hover {
  background: var(--bg-hover);
}

.pbk-btn-solid {
  background: var(--pbk-red);
  color: var(--pbk-cream);
  border: 1px solid var(--pbk-red);
  border-radius: 8px;
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
}

.pbk-btn-solid:hover {
  background: var(--pbk-red-dark);
}

.pbk-btn-solid.is-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.pbk-btn-solid.is-danger:hover {
  background: #b91c1c;
}
