/* Global */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #121212;
  color: #e0e0e0;
  font-family: Inter, sans-serif;
}

/* Layout */
.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

/* Header */
.header {
  flex: 0 0 auto;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-img {
  width: 150px;
  height: auto;
}

.header-link {
  color: white;
  text-decoration: none;
}

.header-link:hover {
  text-decoration: underline;
}

/* Login */
.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90%;
  max-width: 400px;
  padding: 1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2rem;
  background-color: #1e1e1e;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  width: 100%;
  margin-top: 1.5rem; /* gap between logo and form */
}

.login-form label {
  font-weight: bold;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  padding: 8px;
  border-radius: 5px;
  border: none;
  outline: none;
  background-color: #2c2c2c;
  color: #e0e0e0;
}

.login-form input[type="submit"] {
  padding: 10px;
  border-radius: 5px;
  border: none;
  background-color: #6200ee;
  color: white;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

.login-form input[type="submit"]:hover {
  background-color: #3700b3;
}

/* Video Grid */
.video-grid {
  flex: 1 1 auto;
  width: 90%;
  height: auto;
  margin: auto;
  padding: 0.5rem;
  overflow: hidden;

  display: grid;
  gap: 1rem;
  grid-auto-rows: 1fr;

  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));

  justify-content: center;
  align-content: center;
}

.video-container {
  position: relative;
  width: 100%;
  background-color: #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  touch-action: none; /* for zoom/pan */
}

/* Responsive: one video per row on narrow screens */
@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

.video-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Chart + Table */
.chart-container {
  height: 44%;
  width: 90%;
  margin: 0 auto;
}

.table-container {
  flex: 0 0 40%;
  max-height: 35%;
  width: 98%;
  overflow-y: auto;
  border-top: 1px solid #444;
  position: relative;
  margin: 0 auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  background-color: #1e1e1e;
}

th {
  background-color: #f2f2f2;
  border: 1px solid #ddd;
  color: gray;
  cursor: pointer;
}

td {
  border: 1px solid #ddd;
  color: #e0e0e0;
}

th,
td {
  border: 1px solid #b8b8b8;
  padding: 8px;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  background-color: #f2f2f2;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Inputs + Buttons */
input,
button {
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 5px 10px;
  margin: 5px;
}

.logout-button {
  margin-left: auto;
}

.logout-button button {
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  background-color: #6200ee;
  color: #fff;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 480px) {
  .login-wrapper {
    width: 95%;
    padding: 0.5rem;
  }

  .login-form {
    padding: 1rem;
  }

  .header-img {
    width: 120px;
  }
}

body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- Media Browser Grid --- */

/* The card grid fills the remaining viewport height and scrolls
   internally, keeping the header/breadcrumb pinned while videos are
   scrolled. `min-height: 0` is required in the flex column so the grid
   can shrink below its content height and become scrollable. */
.media-grid {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;

  display: grid;
  justify-content: center;
  gap: 1rem;

  /* Desktop: up to 3 cards per row; cards cap at 509px wide */
  grid-template-columns: repeat(auto-fit, minmax(280px, 509px));
  align-content: start;
}
/* Cards (mockup: video preview on top, info panel below) */
.media-card {
  --font-size-lg: 18px;
  --font-size-sm: 14px;
  --font-size-xs: 12px;
  --line-height-lg: 28px;
  --line-height-sm: 22px;
  --line-height-xs: 18px;

  width: 100%;
  max-width: 509px;
  height: 440px;
  border-radius: var(--rad-5, 10px);
  background: var(--colors-alpha-dark-50, rgba(255, 255, 255, 0.08));
  overflow: hidden;
  text-decoration: none;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
  box-sizing: border-box;
}

.media-card:hover {
  transform: scale(1.02);
}

.media-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

/* Title */
.media-title {
  width: 100%;
  font-family: var(--font-family, Inter), sans-serif;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-dark-primary, #ffffff);
  word-break: break-word;
  line-height: var(--line-height-lg);
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Description */
.media-description {
  width: 100%;
  font-family: var(--font-family, Inter), sans-serif;
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--text-dark-secondary, rgba(255, 255, 255, 0.70));
  line-height: var(--line-height-sm); /* Fixed from 16px to use variable */
  letter-spacing: 0;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Timestamp + sensor metadata row */
.media-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
}

.media-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.media-meta-label {
  font-family: var(--font-family, Inter), sans-serif;
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--text-dark-tertiary, rgba(255, 255, 255, 0.36));
  line-height: var(--line-height-xs);
  letter-spacing: 0;
}

.media-meta-value {
  font-family: var(--font-family, Inter), sans-serif;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-dark-primary, #ffffff);
  line-height: var(--line-height-sm);
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Procedural Compliance page --- */
.compliance-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 1rem;
  background-color: #1a1a1a;
  border-bottom: 1px solid #333;
}

.compliance-label {
  color: #b8b8b8;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Calendar date picker (green dots = dates with data) ── */
.datepicker {
  position: relative;
  display: inline-block;
}

.datepicker-toggle {
  background-color: #2c2c2c;
  color: #e0e0e0;
  border: 1px solid #555;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  min-width: 180px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.2s;
}

.datepicker-toggle:hover,
.datepicker-toggle[aria-expanded="true"] {
  border-color: #90caf9;
}

.datepicker-caret {
  color: #90caf9;
  font-size: 0.7rem;
  line-height: 1;
}

.datepicker-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 280px;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  padding: 12px;
  box-sizing: border-box;
}

.datepicker-popup[hidden] {
  display: none;
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.datepicker-month-label {
  flex: 1;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f2f2f2;
}

.datepicker-nav-btn {
  background: none;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
  transition: background-color 0.2s, border-color 0.2s;
}

.datepicker-nav-btn:hover {
  background-color: #2a2a2a;
  border-color: #666;
}

.datepicker-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.36);
  margin-bottom: 4px;
}

.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.datepicker-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 34px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.85rem;
  cursor: pointer;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.15s, border-color 0.15s;
}

.datepicker-day:hover {
  background-color: #2c2c2c;
  border-color: #555;
}

.datepicker-day-empty {
  cursor: default;
}

.datepicker-day-empty:hover {
  background: none;
  border-color: transparent;
}

.datepicker-day.is-current {
  border-color: #90caf9;
  background-color: rgba(144, 202, 249, 0.15);
}

.datepicker-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #4caf50;
  flex: 0 0 auto;
}

/* Dates with data: hint the green dot is meaningful */
.datepicker-day.has-data .datepicker-day-num {
  font-weight: 600;
}

.compliance-clear {
  color: #90caf9;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #444;
}

.compliance-clear:hover {
  text-decoration: underline;
  border-color: #666;
}

/* Timestamp search controls on the Replay / Compliance galleries */
.compliance-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid #333;
}

.compliance-time-input {
  background-color: #2c2c2c;
  color: #e0e0e0;
  border: 1px solid #555;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  color-scheme: dark;
}

.compliance-time-input:focus {
  outline: none;
  border-color: #90caf9;
}

.compliance-search-btn {
  background-color: #333;
  color: #e0e0e0;
  border: 1px solid #555;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.compliance-search-btn:hover {
  background-color: #444;
  border-color: #666;
}

.compliance-heading {
  margin: 1rem 1rem 0;
  font-size: 1.1rem;
  color: #f2f2f2;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.compliance-prompt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.compliance-prompt p {
  font-size: 1.05rem;
  color: #b8b8b8;
  margin: 0;
}

/* Thumbnail - fixed 286px height per browse card spec */
.media-thumb {
  position: relative;
  width: 100%;
  height: 286px;
  opacity: 0.8;
  background: lightgray -29.056px 0px / 108.273% 100% no-repeat;
  overflow: hidden;
  flex: 0 0 auto;
}

.media-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #333;
  background-color: #000;
}

/* Mobile tweaks */
/* 1 thumbnail per row on phones */
@media (max-width: 480px) {
  .media-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop column count is governed by the base .media-grid rule:
   repeat(auto-fit, minmax(280px, 509px)) fits up to 3 cards per row
   on wide screens (3×509px + gaps ≈ 1560px) and 2 on smaller ones. */

.browse-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.browse-empty p {
  font-size: 1.25rem;
  color: #b8b8b8;
  margin: 0;
}

.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex: 0 0 2%;
}

.pagination-page-number {
  text-align: center;
  flex: 1;
}

.map-container {
  flex: 1;
}

#map {
  height: 100%;
  width: 100%;
}

/* MapLibre popup — match dark map / app theme */
.maplibregl-popup-content {
  background-color: #1e1e1e;
  color: #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  padding: 8px 12px;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: #1e1e1e;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: #1e1e1e;
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: #1e1e1e;
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: #1e1e1e;
}

/* =========================================
    SHIFT REPORT PAGE
========================================== */
.report-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top controls bar */
.report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 18px;
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}

.report-toolbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.report-toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-toolbar-label {
    color: #b8b8b8;
    font-size: 0.95rem;
}

.report-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}

.report-wrapper {
    width: 100%;
    max-width: 520px;
}

.report-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 35px;
    color: #f2f2f2;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Report card */
.report-card {
    background-color: #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #333;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
}

.report-row {
    display: grid;
    grid-template-columns: 1fr 110px;
}

.report-cell {
    padding: 16px 18px;
    border-bottom: 1px solid #333;
    font-size: 1rem;
}

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

.report-row .report-cell:first-child {
    border-right: 1px solid #333;
}

.report-value {
    text-align: center;
    font-weight: 500;
    color: #d5d5d5;
}

/* Section headers */
.report-section {
    background-color: #2a2a2a;
    font-weight: 700;
    text-transform: uppercase;
}

.report-section .report-cell {
    color: white;
}

/* Button layout spacing adjustments */
.report-toolbar button {
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.report-toolbar button:hover {
    background-color: #444;
}

/* =========================================
    ADMIN PAGES
========================================== */
.hidden {
    display: none;
}

.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    background-color: #333;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    background-color: #444;
}

.btn-primary {
    background-color: #6200ee;
    color: #fff;
}

.btn-primary:hover {
    background-color: #3700b3;
}

.checkbox-grid {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #333;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: #1a1a1a;
}

.admin-table-scroll {
    overflow-x: auto;
    width: 100%;
}

.admin-table-scroll table th {
    background-color: #1e1e1e;
    color: #ccc;
}

.admin-table-scroll table td {
    vertical-align: middle;
}

.admin-table-scroll table input[type="text"],
.admin-table-scroll table input[type="number"],
.admin-table-scroll table select {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 4px 8px;
    border-radius: 3px;
    width: 100%;
    box-sizing: border-box;
}

.admin-table-scroll table input[type="checkbox"] {
    transform: scale(1.2);
}

/* Hidden off-screen layout block for pristine Word table generation */
#print-target {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

.report-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    color: #d5d5d5;
}

.report-loading.hidden {
    display: none;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #333;
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =========================================
    REPLAY PLAYER PAGE
========================================== */
.player-page {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0;
  background-color: #0a0a0a;
  overflow: hidden;
}

/* Left: video area (mirrors the ~80% canvas in the Figma POC) */
.player-area {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Top overlay row: back button + camera badge */
.player-topbar {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.player-back-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background-color: rgba(20, 20, 20, 0.9);
  border: 1px solid rgba(61, 61, 61, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex: 0 0 auto;
}

.player-back-btn:hover {
  border-color: #555;
}

.player-badge {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 60%;
  height: 19px;
  padding: 0 10px;
  border-radius: 10px;
  background-color: #141414;
}

.player-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #fa4d4d;
  flex: 0 0 auto;
}

.player-badge-name {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* On-video headline */
.player-headline {
  position: absolute;
  top: 86px;
  left: 30px;
  right: 30px;
  pointer-events: none;
}

.player-headline-title {
  font-family: Inter, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  color: #ffffff;
  max-width: 560px;
  word-break: break-word;
}

.player-headline-desc {
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
  color: rgba(255, 255, 255, 0.7);
  max-width: 560px;
  margin-top: 6px;
}

/* Overlay hide/show on mouse leave/enter of the video area */
.player-topbar,
.player-headline {
  transition: opacity 0.25s ease;
}

.player-overlays-hidden .player-topbar,
.player-overlays-hidden .player-headline {
  opacity: 0;
  pointer-events: none;
}

/* Right: playlist panel */
.player-playlist {
  flex: 0 0 380px;
  width: 380px;
  min-height: 0;
  background-color: #141414;
  border-left: 1px solid #3d3d3d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.player-playlist-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid #3d3d3d;
  flex: 0 0 auto;
}

.player-playlist-title {
  font-family: Inter, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  color: #ffffff;
}

.player-playlist-position {
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  color: #ffffff;
  text-align: right;
  white-space: nowrap;
}

.player-playlist-prevnext {
  display: flex;
  gap: 6px;
}

.player-playlist-nav-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  background-color: #141414;
  color: #ffffff;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  white-space: nowrap;
  box-sizing: border-box;
}

.player-playlist-nav-btn:hover:not(:disabled) {
  background-color: #232323;
  border-color: #555;
}

.player-playlist-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.player-playlist-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background-color: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: #ffffff;
  transition: border-color 0.2s, background-color 0.2s;
}

.player-playlist-item:hover {
  border-color: #555;
  background-color: rgba(255, 255, 255, 0.08);
}

.player-playlist-item.is-current {
  border-color: rgba(144, 202, 249, 0.7);
  background-color: rgba(144, 202, 249, 0.1);
}

.player-playlist-thumb {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-playlist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-playlist-placeholder {
  color: #555;
  font-size: 18px;
}

.player-playlist-playing {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #fa4d4d;
  pointer-events: none;
}

.player-playlist-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-playlist-name {
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  color: #ffffff;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-playlist-meta {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.36);
  white-space: nowrap;
}

.player-playlist-footer {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-top: 1px solid #3d3d3d;
  display: flex;
  justify-content: flex-end;
}

.player-playlist-download {
  padding: 8px 12px;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  background-color: #141414;
  color: #ffffff;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s;
}

.player-playlist-download:hover {
  border-color: #555;
  background-color: #232323;
}

/* Mobile: playlist below the player */
@media (max-width: 768px) {
  .player-page {
    flex-direction: column;
    overflow-y: auto;
  }

  .player-area {
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    width: 100%;
    max-height: 52vh;
  }

  .player-playlist {
    flex: 0 0 auto;
    width: 100%;
    min-height: 340px;
    border-left: none;
    border-top: 1px solid #3d3d3d;
  }

  .player-playlist-list {
    overflow-y: auto;
  }

  .player-headline {
    top: 76px;
    left: 16px;
    right: 16px;
  }
}

/* Status badges + destructive action button (Manage Ports) */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-success {
    background-color: #1b3a24;
    color: #7ddc8c;
    border-color: #2f6a3e;
}

.badge-muted {
    background-color: #2a2a2a;
    color: #9a9a9a;
    border-color: #444;
}

/* Modal dialogs (admin add/edit forms) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    z-index: 1000;
    overflow-y: auto;
}

.modal-overlay.hidden {
    display: none;
}

.modal-dialog {
    background-color: #1e1e1e;
    border: 1px solid #444;
    border-radius: 10px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-dialog-wide {
    max-width: 720px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid #333;
    flex: 0 0 auto;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: #9a9a9a;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    margin: 0;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-body label {
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 600;
    color: #ccc;
}

.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body select {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 4px 0;
    width: 100%;
    box-sizing: border-box;
}

.modal-body input[type="checkbox"] {
    margin-right: 6px;
}

.modal-body .checkbox-grid {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #333;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: #1a1a1a;
    margin-top: 0.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}
