/* fonts */
@font-face {
  font-family: 'Forum';
  src: url('/static/font/Forum/Forum-Regular.ttf') format('truetype');
}

h1 {
  color: var(--primary-color);
  font-family: var(--font-display);
}

/* Layout buttons (sidebar close, menu) keep .btn class from components.css */

/* global styles */
body {
  font-family: var(--font-body);
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
}

:where(a) {
  color: var(--text-link);
}

:where(a:visited) {
  color: var(--text-link);
}

:where(a:hover) {
  color: var(--text-link-hover);
}

.navbar {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-inverse);
  min-height: var(--nav-height);
  text-align: center;
  padding: 10px 16px;
  display: flex;
  direction: row;
  align-items: center;
  justify-content: left;
  position: relative;
  box-shadow: var(--shadow-md);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  margin-right: 20px;
  position: absolute;
  right: 0;
}

.navbar-primary-links,
.navbar-utility-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-utility-links {
  gap: 4px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.navbar-links a {
  text-decoration: none;
  color: var(--text-inverse);
  font-size: 1.05em;
  font-weight: 600;
}

.navbar-links a:visited {
  color: var(--text-inverse);
}

.navbar-links a:hover {
  color: var(--text-highlight-color);
}

.nav-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  position: relative;
}

.nav-primary-link .nav-item-icon {
  display: none;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.navbar-links a.is-active,
.navbar-links .nav-icon-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.navbar-links a.is-active::after,
.navbar-links .nav-icon-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  transform: translateX(-50%);
  pointer-events: none;
}

.navbar-links a.is-active:hover,
.navbar-links .nav-icon-link.is-active:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.navbar .btn.sidebar-menu-btn,
.navbar .sidebar-menu-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-inverse);
  box-shadow: none;
}

.navbar .btn.sidebar-menu-btn:hover,
.navbar .sidebar-menu-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  text-decoration: none;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-icon-link:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-highlight-color);
}

.nav-icon-link svg {
  width: 22px;
  height: 22px;
  display: block;
}

.nav-icon-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.theme-toggle-btn {
  flex-shrink: 0;
}

.theme-toggle-icons {
  position: relative;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-toggle-icons .theme-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  display: block;
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

.theme-toggle-icons .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-toggle-icons .theme-icon-moon {
  opacity: 0;
  transform: rotate(-40deg) scale(0.65);
}

.theme-toggle-btn.is-dark .theme-icon-sun {
  opacity: 0;
  transform: rotate(40deg) scale(0.65);
}

.theme-toggle-btn.is-dark .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-icons .theme-icon {
    transition: none;
  }
}

.navbar-theme-toggle-mobile {
  display: none;
}

.sidebar-theme-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-theme-label {
  font-weight: 600;
  color: #fff;
}

.theme-toggle-btn--sidebar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.theme-toggle-btn--sidebar:hover {
  background: rgba(255, 255, 255, 0.2);
}

.theme-toggle-text {
  white-space: nowrap;
}

.nav-icon-link--badge .notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  margin-left: 0;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  font-size: 0.65rem;
  padding: 0 4px;
  pointer-events: none;
}

.notif-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 6px;
  padding: 0 5px;
}

.navbar-border-div {
  height: 80%;
  width: max-content;
  padding: 2px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.sidebar-brand {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
}

.brand-logo--sidebar {
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.close-sidebar {
  position: static;
  flex: 0 0 44px;
  border: none;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
}

.close-sidebar:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-menu-btn {
  position: absolute;
  left: 20px;
  padding: 0px;
  border-radius: 5px;
  cursor: pointer;
  height: 40px;
  width: 40px;
  font-size: larger;
  display: none;
  z-index: 2;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.brand-logo--nav {
  height: 44px;
  width: auto;
  max-width: min(210px, 48vw);
}

.navbar-border-div::after {
  content: "";
  display: block;
  filter: blur(500px);
  pointer-events: none;
}

.sidebar{
  position: fixed;
  z-index: 20;
  width: 80%;
  background-color: var(--secondary-color);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 20px;
  height: 100%;
  box-shadow: 0px 0px 10px var(--shadow-color);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  display: none;
  left: 0px;
  box-sizing: border-box;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding-left: 4px;
  padding-right: 4px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(100dvh - 120px);
  -webkit-overflow-scrolling: touch;
}

.sidebar-links a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.2em;
  font-weight: bold;
  padding: 10px 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.sidebar-links a:hover {
  color: #FFE566;
}

.sidebar-links a.is-active {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.closed-sidebar {
  transform: translate(-100%);
  pointer-events: none;
  visibility: hidden;
}

.sidebar-is-open {
  transform: translate(0);
  pointer-events: auto;
  visibility: visible;
}

.messages {
  position: fixed;
  top: 10vh;
  right: 10px;
  background-color: transparent;
  padding: 10px;
  height: max-content;
  z-index: 10000;
  pointer-events: none;
}

.message{
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  box-shadow: 0px 0px 5px var(--shadow-color);
  transition: display 0.3s ease, opacity 0.3s ease;
  pointer-events: auto;
}

.msg-info {
  background-color: #d1ecf1;
  color: #0c5460;
}

.msg-success {
  background-color: #d4edda;
  color: #155724;
}

.msg-warning {
  background-color: #fff3cd;
  color: #856404;
}

.msg-error {
  background-color: #f8d7da;
  color: #721c24;
}

.container {
  width: 100%;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 10px;
  box-sizing: border-box;
}

.footer {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
  color: var(--text-inverse);
  text-align: center;
  width: 100%;
  padding-top: 12px;
  padding-bottom: 12px;
}

.footer-details {
  margin-top: 10px;
  padding-left: 4px;
  padding-right: 4px;
}

.footer-details a {
  text-decoration: none;
  color: var(--text-inverse);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.92;
}

.footer-details a:hover {
  opacity: 1;
}

.footer-policy-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 10px;
}

.footer-policy-links a {
  color: var(--text-inverse);
  font-weight: 600;
}

.cookie-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-color, #fff);
  color: var(--text-color);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -8px 24px var(--shadow-color, rgba(0, 0, 0, 0.12));
}

.cookie-consent-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
}

.cookie-consent-copy {
  flex: 1 1 280px;
}

.cookie-consent-copy h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.cookie-consent-copy p {
  margin: 0 0 8px;
  line-height: 1.5;
}

.cookie-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.cookie-consent-actions--inline {
  justify-content: flex-start;
  margin: 12px 0 20px;
}

body:has(#cookie-consent-banner:not([hidden])) {
  padding-bottom: 200px;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

@media (max-width: 768px) {
  .cookie-consent-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-consent-actions {
    width: 100%;
  }

  .cookie-consent-actions .btn {
    flex: 1 1 0;
    min-height: 44px;
  }
}

@media (max-width: 1024px) and (min-width: 601px) {
  .navbar {
    gap: 10px;
    padding: 8px 12px;
    overflow: hidden;
  }

  .navbar-border-div {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 150px;
  }

  .brand-logo--nav {
    height: 36px;
    max-width: min(140px, 20vw);
  }

  .navbar-links {
    position: static;
    margin-left: auto;
    margin-right: 0;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .navbar-links::-webkit-scrollbar {
    display: none;
  }

  .navbar-primary-links,
  .navbar-utility-links {
    gap: 4px;
    flex-shrink: 0;
  }

  .navbar-utility-links {
    padding-left: 10px;
    margin-left: 4px;
  }

  .nav-primary-link {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
  }

  .navbar-links a.is-active::after,
  .navbar-links .nav-icon-link.is-active::after {
    bottom: 6px;
  }

  .nav-primary-link .nav-item-icon {
    display: block;
  }

  .nav-primary-link .nav-item-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .navbar-links a:not(.nav-icon-link) {
    font-size: 0;
  }

  .nav-icon-link {
    width: 40px;
    height: 40px;
  }

  .nav-icon-link svg,
  .nav-primary-link .nav-item-icon {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 600px) {
  .messages {
    font-size: medium;
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    width: auto;
  }

  .toast-container {
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    max-width: none;
    width: auto;
    height: auto;
    pointer-events: none;
  }

  .navbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    height: auto;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  }

  .navbar-border-div {
    grid-column: 2;
    justify-self: center;
    width: max-content;
    max-width: 100%;
    height: 40px;
    flex: none;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .navbar-border-div .brand-link {
    justify-content: center;
  }

  .brand-logo--nav {
    height: 36px;
    max-height: 36px;
    max-width: min(168px, 100%);
    margin: 0 auto;
  }

  .navbar-links {
    display: none;
  }

  .navbar-theme-toggle-mobile {
    display: inline-flex;
    grid-column: 3;
    justify-self: end;
    margin: 0;
    flex: none;
    width: 44px;
    height: 44px;
    z-index: 3;
  }

  .sidebar-theme-row {
    display: flex;
  }

  .sidebar {
    display: none;
    width: min(320px, 85vw);
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 16px;
  }

  .sidebar.sidebar-is-open {
    display: flex;
    z-index: 10001;
  }

  .sidebar-header {
    margin-bottom: 12px;
  }

  .brand-logo--sidebar {
    height: 36px;
  }

  .sidebar-links {
    max-height: calc(100dvh - 88px - env(safe-area-inset-top, 0px));
  }
  
  .footer {
    font-size: 12px;
    padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  
  .btn {
    font-size: 14px;
    padding: 10px 16px;
    min-height: 44px;
  }
  
  .navbar .sidebar-menu-btn {
    position: relative;
    left: auto;
    top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1;
    justify-self: start;
    flex: none;
    width: 44px;
    height: 44px;
    min-height: 44px;
    min-width: 44px;
    font-size: 20px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    z-index: 3;
  }

  .footer-details {
    font-size: 11px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .cookie-consent-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .cookie-consent-actions {
    width: 100%;
    justify-content: stretch;
  }

  .cookie-consent-actions .btn {
    flex: 1 1 0;
  }

}

/* UX micro-interactions */
.btn, .event, .sidebar {
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px var(--shadow-color);
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { border-left: 4px solid #16a34a; }
.toast-error { border-left: 4px solid #dc2626; }
.toast-info { border-left: 4px solid var(--primary-color); }

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-color);
  background: var(--card-background);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
}

.skeleton-card {
  padding: 12px;
  border-radius: 12px;
  background: var(--card-background);
  border: 1px solid var(--border-color);
}

.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, transparent 37%, var(--border-color) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-image { height: 120px; margin-bottom: 12px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.short { width: 60%; }

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.confirm-modal[hidden] { display: none; }
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.confirm-modal-content {
  position: relative;
  background: var(--card-background);
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 24px var(--shadow-color);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Shared overlay so JS-created modals (report, etc.) work on every page */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10050;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal .modal-content {
  position: relative;
  padding: 24px;
  color: var(--text-color);
}

.modal .close {
  float: right;
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-secondary);
}

.modal .close:hover {
  color: var(--text-color);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Modals opened via JS (display:block) — viewport-safe on mobile */
.modal[style*="display: block"] {
  display: flex !important;
  align-items: flex-start;
  justify-content: center;
  padding:
    calc(12px + env(safe-area-inset-top, 0px))
    calc(12px + env(safe-area-inset-right, 0px))
    calc(12px + env(safe-area-inset-bottom, 0px))
    calc(12px + env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal[style*="display: block"] .modal-content {
  margin: 0;
  width: 100%;
  max-width: 600px;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  box-sizing: border-box;
  flex-shrink: 0;
}

.modal[style*="display: block"] .modal-wide {
  max-width: 960px;
  width: 100%;
}

@media (max-width: 768px) {
  .modal[style*="display: block"] .modal-content,
  .modal[style*="display: block"] .modal-wide {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .modal[style*="display: block"] .modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .modal[style*="display: block"] .modal-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .confirm-modal {
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      calc(12px + env(safe-area-inset-right, 0px))
      calc(12px + env(safe-area-inset-bottom, 0px))
      calc(12px + env(safe-area-inset-left, 0px));
    align-items: flex-start;
    overflow-y: auto;
  }

  .confirm-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    margin: 0;
    padding: 20px 16px;
    box-sizing: border-box;
  }

  .confirm-modal-actions {
    flex-direction: column;
  }

  .confirm-modal-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

.event:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-color);
}

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