/* ------------------------------------------------------------------ */
/* CSS custom properties (defaults — overridden at runtime by app.js)  */
/* ------------------------------------------------------------------ */

:root {
  --header-bg:   #C8102E;
  --header-text: #ffffff;
}

/* ------------------------------------------------------------------ */
/* Reset & base                                                         */
/* ------------------------------------------------------------------ */

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f4f4f5;
  color: #18181b;
  min-height: 100vh;
}

/* ------------------------------------------------------------------ */
/* Top bar (Royal Farms-style full-width header)                       */
/* ------------------------------------------------------------------ */

.top-bar {
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 60px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--header-text);
}

/* ------------------------------------------------------------------ */
/* Right side of top bar (status + menu)                               */
/* ------------------------------------------------------------------ */

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ------------------------------------------------------------------ */
/* Connection status badge                                              */
/* ------------------------------------------------------------------ */

.status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status--connecting {
  background: rgba(255, 255, 255, 0.25);
  color: var(--header-text);
}

.status--live {
  background: rgba(255, 255, 255, 0.25);
  color: var(--header-text);
}

.status--error {
  background: rgba(0, 0, 0, 0.30);
  color: var(--header-text);
}

/* ------------------------------------------------------------------ */
/* Main content area                                                    */
/* ------------------------------------------------------------------ */

main {
  padding: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* Utility                                                              */
/* ------------------------------------------------------------------ */

.hidden {
  display: none !important;
}

.empty {
  margin-top: 3rem;
  text-align: center;
  color: #71717a;
  font-size: 0.95rem;
}

/* ------------------------------------------------------------------ */
/* Link button grid                                                     */
/* ------------------------------------------------------------------ */

.links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.link-btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  background: #ffffff;
  color: #18181b;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  cursor: pointer;
}

.link-btn:hover {
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.20);
  transform: translateY(-1px);
  text-decoration: none;
}

.link-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ------------------------------------------------------------------ */
/* Button update flash animation                                        */
/* ------------------------------------------------------------------ */

@keyframes btn-flash {
  0%,
  100% { background-color: #ffffff; color: #18181b; }
  40%  { background-color: #fef9c3; color: #18181b; }
}

.link-btn--updated {
  animation: btn-flash 0.9s ease;
}

/* ------------------------------------------------------------------ */
/* Mobile — small screens (≤ 480 px)                                   */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
  .top-bar {
    height: 52px;
    padding: 0 1rem;
  }

  .top-bar__title {
    font-size: 1.05rem;
  }

  main {
    padding: 1rem;
  }

  .links-grid {
    gap: 0.6rem;
  }

  .link-btn {
    /* Full width on very small screens */
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
}

/* ------------------------------------------------------------------ */
/* Tablet — medium screens (481 px – 768 px)                           */
/* ------------------------------------------------------------------ */

@media (min-width: 481px) and (max-width: 768px) {
  .link-btn {
    /* Two columns on tablet */
    flex: 1 1 calc(50% - 0.75rem);
    text-align: center;
  }
}

/* ------------------------------------------------------------------ */
/* Hamburger menu button                                                */
/* ------------------------------------------------------------------ */

.menu-wrap {
  position: relative;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--header-text);
  transition: background 0.15s;
}

.menu-btn:hover,
.menu-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.2);
}

.menu-btn__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ------------------------------------------------------------------ */
/* Hamburger dropdown                                                   */
/* ------------------------------------------------------------------ */

.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  z-index: 200;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 500;
  color: #18181b;
  cursor: pointer;
  transition: background 0.12s;
}

.menu-item:hover {
  background: #f4f4f5;
}

.menu-item:active {
  background: #e4e4e7;
}

.menu-item--busy {
  opacity: 0.6;
  cursor: default;
}

/* ------------------------------------------------------------------ */
/* Info modal                                                           */
/* ------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  width: min(520px, calc(100vw - 2rem));
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.8rem 1rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--header-text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.modal-close:hover { opacity: 1; }

.modal-body {
  padding: 1rem 1.25rem 1.25rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #e4e4e7;
  font-size: 0.88rem;
}

.info-row:last-child { border-bottom: none; }

.info-row__label {
  color: #71717a;
  font-weight: 500;
  white-space: nowrap;
}

.info-row__value {
  color: #18181b;
  text-align: right;
  word-break: break-all;
}

/* ------------------------------------------------------------------ */
/* Session info table                                                   */
/* ------------------------------------------------------------------ */

.modal-body--scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0;        /* table extends flush to card edges */
}

.session-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.session-table thead th {
  position: sticky;
  top: 0;
  background: #f4f4f5;
  color: #71717a;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.45rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e4e4e7;
}

.session-table tbody tr {
  border-bottom: 1px solid #e4e4e7;
}

.session-table tbody tr:last-child { border-bottom: none; }

.session-table tbody tr:hover { background: #f9f9f9; }

.session-table td {
  padding: 0.55rem 1rem;
  vertical-align: middle;
}

.st-name {
  color: #18181b;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-rel {
  color: #71717a;
  white-space: nowrap;
}

.st-time {
  color: #71717a;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.session-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: #71717a;
  font-size: 0.9rem;
}
