/* Base responsive image styling */
img {
  border-radius: 0.7em;
  max-width: 100%;
  height: auto;
}

.logo {
  width: 70%;
  margin: 0 auto;
  max-width: 200px;
  position: relative;
  z-index: 10;
}

.spinner-border {
  width: 3rem;
  height: 3rem;
  border: 0.25em solid rgba(255, 255, 255, 0.5);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#feedback-btn,
#prev-btn,
#next-btn,
#navigate-btn {
  display: none;
}

/* Responsive table styling */
.table th {
  font-size: 1.2em;
}

/* Mobile-first responsive table */
@media (max-width: 768px) {
  .table th {
    font-size: 1em;
    padding: 0.5rem;
  }

  .table td {
    padding: 0.5rem;
    font-size: 0.9em;
  }
}

.alert-helper {
  font-size: 0.9em;
  text-align: left;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 0;
}

.container {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  margin-bottom: 40px; /* Reduced space - footer is now at bottom */
}

#map-frame {
  flex-grow: 1;
  border: none;
  width: 100%;
  height: 100%;
}

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

td.nr {
  white-space: nowrap;
}

#bar-content #image-container img {
  max-height: 200px;
}

.alert-infobox {
  background: #2e232d;
  color: #ffd88e;
}

/* Footer positioning - stays at bottom of content */
footer {
  margin-top: auto;
  position: relative;
  z-index: 20;
  background-color: #160f15;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer .container {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

footer p {
  margin: 0;
  padding: 1rem 0;
}

/* Ensure footer doesn't overlap content on mobile */
@media (max-width: 768px) {
  footer {
    position: relative;
    background-color: #160f15;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 30;
  }

  footer p {
    padding: 0.75rem 0;
  }

  .container {
    margin-bottom: 20px;
    padding-bottom: 0 !important;
  }
}

/* Mobile-first container styling */
#bar-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  box-sizing: border-box;
}

#contact,
.bar-list {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Improve bar list container */
.bar-list.overflow-x-auto {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Mobile responsive containers */
@media (max-width: 768px) {
  #bar-container {
    margin: 0 0.5rem;
    max-width: calc(100% - 1rem);
  }

  #contact,
  .bar-list {
    margin: 0 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .bar-list.overflow-x-auto {
    padding: 0.75rem;
    margin: 0 0 1rem 0;
  }

  .container {
    padding: 0.5rem !important;
    margin-top: 1rem;
  }

  /* Improve table container spacing */
  #table-container {
    margin: 0;
    padding: 0;
    margin-bottom: 40px;
  }

  #bar-list-container {
    margin-top: 1rem;
    margin-bottom: 40px;
  }
}

/* Improved card responsiveness */
.card {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .card {
    padding: 1rem !important;
    margin: 0.5rem 0;
  }
}

/* Mobile-first button container */
.btn-container,
.btn-container-inline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 800px; /* adjust to taste: 720–960px works well */
  margin: 2rem auto; /* centres the whole row */
  padding: 0 1rem;
  align-items: stretch; /* cells same height */
  justify-items: stretch;
}

.btn-container-inline {
  margin: 1rem auto;
  padding: 0;
  width: 100%;
  text-align: center;
}

/* Make every control fill its cell and centre content vertically */
.btn-container .btn,
.btn-container a.btn,
.btn-container-inline .btn,
.btn-container-inline a.btn {
  display: flex; /* DaisyUI uses inline-flex; flex avoids baseline oddities */
  align-items: center; /* vertical centre */
  justify-content: center;
  width: 100%;
  min-height: 3.25rem; /* consistent height */
  line-height: 1; /* prevents text riding high */
}

#prev-btn,
#navigate-btn,
#feedback-btn,
#next-btn {
  /* no justify-self overrides; let w-full handle width */
}

/* Place buttons in proper grid positions */
#prev-btn {
  grid-column: 1;
  justify-self: start;
}

#navigate-btn {
  grid-column: 2;
  justify-self: center;
}

#feedback-btn {
  grid-column: 2;
  justify-self: center;
}

#next-btn {
  grid-column: 3;
  justify-self: end;
}

/* Mobile responsive buttons - side by side layout */
@media (max-width: 640px) {
  .btn-container,
  .btn-container-inline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0;
    margin: 1rem auto;
    position: relative;
    z-index: 10;
  }

  #prev-btn,
  #navigate-btn,
  #feedback-btn,
  #next-btn {
    flex: 0 0 auto;
  }

  .btn-container .btn,
  .btn-container-inline .btn {
    width: auto;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    min-height: 2.5rem;
    font-size: 0.85rem;
  }

  /* Hide text on mobile, show only icons */
  .btn-container .btn i,
  .btn-container-inline .btn i {
    font-size: 1rem;
  }

  /* Optionally hide button text on very small screens */
  @media (max-width: 380px) {
    #prev-btn span,
    #next-btn span,
    #navigate-btn span {
      display: none;
    }
  }

  /* Ensure container has enough bottom space */
  .container {
    margin-bottom: 40px;
    padding-bottom: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .btn-container {
    gap: 0.75rem;
  }

  .btn-container .btn {
    min-width: 120px;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }
}

#prev-btn,
#navigate-btn,
#feedback-btn,
#ext-btn,
#progress-bar {
  display: none;
}

#progress-bar {
  height: 100%;
  border-radius: inherit;
  transition: width 0.5s ease;
}

.progress-track {
  border-radius: 9999px;
  overflow: hidden;
  height: 0.75rem;
  position: relative;
}

.progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  line-height: 1;
}

.progress-label.contrasted {
  color: var(--p-contrast, inherit);
}

/* Responsive content containers */
.bar-info {
  width: 100%;
  max-width: none;
  padding: 1rem;
  text-align: left;
  margin: 1rem 0;
  box-sizing: border-box;
}

/* Mobile responsive containers */
@media (max-width: 768px) {
  .bar-info {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }
}

/* Mobile responsive images and media */
@media (max-width: 640px) {
  #bar-content img {
    max-height: 80px !important;
    width: auto;
  }

  #bar-content #image-container img {
    max-height: 150px !important;
  }

  .logo {
    max-width: 150px;
  }
}

/* Extra small screens - prevent header elements from hiding */
@media (max-width: 480px) {
  nav:first-child .flex {
    padding: 0.5rem;
    gap: 0.25rem;
  }

  nav:first-child .flex a img {
    height: 2rem !important; /* Smaller logo on very small screens */
    width: auto;
  }

  nav:first-child .flex div span {
    font-size: 0.75rem !important;
    line-height: 1.2;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  nav:first-child .flex {
    padding: 0.25rem;
  }

  nav:first-child .flex a img {
    height: 1.75rem !important;
  }

  nav:first-child .flex div span {
    font-size: 0.7rem !important;
  }

  /* Stack vertically if absolutely necessary */
  nav:first-child .flex {
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
  }

  nav:first-child .flex div {
    text-align: center;
  }
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
  nav {
    position: relative;
    z-index: 50;
  }

  /* Top nav with logo */
  nav:first-child .flex {
    flex-wrap: nowrap;
    gap: 0.5rem;
    position: relative;
    z-index: 51;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
  }

  /* Ensure logo doesn't shrink */
  nav:first-child .flex a {
    flex-shrink: 0;
    min-width: 60px;
  }

  /* Ensure crawl text doesn't disappear */
  nav:first-child .flex div {
    flex-shrink: 1;
    min-width: 0;
    text-align: right;
  }

  nav:first-child .flex div span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  /* Bottom nav with menu */
  nav:nth-child(2) ul {
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 0;
    padding: 0.5rem 0;
  }

  nav:nth-child(2) ul li a {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  /* Fix logo overlap with nav */
  .container {
    margin-top: 1rem;
  }

  #bar-container img[src*='logo'] {
    margin-top: 1rem;
  }
}

/* Mobile form improvements */
@media (max-width: 640px) {
  .form-control {
    margin-bottom: 1rem;
  }

  .input,
  .textarea {
    width: 100% !important;
    box-sizing: border-box;
  }

  .label {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }
}

/* Mobile table improvements */
@media (max-width: 640px) {
  .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .table {
    min-width: 100%;
    font-size: 0.85rem;
    margin: 0;
  }

  .table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    background-color: rgba(255, 255, 255, 0.05);
  }

  .table td {
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

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

  /* Improve table readability */
  .table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
  }
}

/* Mobile alert improvements */
@media (max-width: 640px) {
  .alert {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .alert-infobox {
    margin: 0.5rem 0;
  }
}

/* Consistent spacing and typography across devices */
@media (max-width: 640px) {
  h1,
  h2,
  h3 {
    font-size: 1.25rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }

  p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
  }

  .text-2xl {
    font-size: 1.25rem !important;
  }

  .text-lg {
    font-size: 1.1rem !important;
  }
}

/* Improved spacing for different screen sizes */
@media (min-width: 641px) and (max-width: 1024px) {
  .container {
    padding: 1rem !important;
    max-width: 1000px;
    margin: 0 auto;
  }

  .btn-container .btn {
    padding: 0.75rem 1.25rem;
  }

  /* Medium screen container limits */
  #bar-container,
  #contact,
  .bar-list {
    max-width: 900px;
  }
}

/* Large screen optimizations with max-width container */
@media (min-width: 1025px) {
  .btn-container {
    gap: 2rem;
  }

  .container {
    padding: 1.5rem !important;
    max-width: 1200px;
    margin: 0 auto;
  }

  /* Desktop max-width containers */
  #bar-container,
  #contact,
  .bar-list {
    max-width: 1000px;
  }

  /* Ensure proper centering on very large screens */
  .card {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Ensure content doesn't overflow on very small screens */
@media (max-width: 320px) {
  .container {
    padding: 0.25rem !important;
  }

  .card {
    padding: 0.75rem !important;
    margin: 0.25rem 0;
  }

  .btn-container .btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}

#bar-content #image-container img,
#bar-content #map-container img {
  max-height: none !important;
  width: 80%;
  height: auto;
  display: block;
  border-radius: 0.75rem; /* matches rounded-xl */
  margin-left: auto;
  margin-right: auto;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile: stack them */
@media (max-width: 640px) {
  .btn-container {
    grid-template-columns: 1fr;
  }
}
.footer {
  background: #160f158a;
}

input {
  color: #db924b !important;
}

input::placeholder {
  color: #db924b80 !important;
}

/* Navigation is now shown during preview mode with limited options
body.preview-mode nav.bg-primary {
  display: none !important;
} */

/* Nav-themed crawl label */
.crawl-badge {
  display: inline-block;
  background: linear-gradient(135deg, #db924b 0%, #b8773a 100%);
  color: #1a1a1a;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(219, 146, 75, 0.3);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
}

.crawl-badge:hover {
  background: linear-gradient(135deg, #e5a360 0%, #c2824f 100%);
  transform: translateY(-1px);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Responsive sizing */
@media (min-width: 640px) {
  .crawl-badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
}

/* Admin panel coffee theme consistency */
.admin-theme {
  --coffee-dark: #2e232d;
  --coffee-medium: #241a22;
  --coffee-light: #1a1319;
  --gold-primary: #db924b;
  --gold-muted: #e7c77a;
  --gold-subtle: rgba(219, 146, 75, 0.15);
}

/* Table styling for coffee theme */
table {
  background-color: transparent;
}

/* Table header - coffee theme */
.table thead tr {
  background-color: var(--coffee-medium, #241a22);
}
.table thead th {
  color: var(--gold-muted, #e7c77a);
  background-color: var(--coffee-medium, #241a22);
  border-bottom: 1px solid var(--gold-subtle, rgba(219, 146, 75, 0.15));
  font-weight: 600;
}

/* Table body rows - coffee theme */
.table tbody tr {
  background-color: var(--coffee-light, #1a1319);
  color: #e5e5e5;
}
.table tbody tr:nth-child(even) {
  background-color: #20161d;
}

/* Hover effect - coffee accent */
.table tbody tr:hover {
  background-color: rgba(219, 146, 75, 0.25);
  color: #f5f5f5;
}

/* Borders - coffee theme */
.table td,
.table th {
  border-color: var(--gold-subtle, rgba(219, 146, 75, 0.15));
}

/* Zebra striping for daisyUI table-zebra in coffee theme */
.table-zebra tbody tr:nth-child(odd) {
  background-color: var(--coffee-light, #1a1319);
}
.table-zebra tbody tr:nth-child(even) {
  background-color: #20161d;
}

/* Admin panel button consistency */
.admin-panel .btn-primary {
  background-color: var(--gold-primary, #db924b);
  border-color: var(--gold-primary, #db924b);
}

.admin-panel .btn-primary:hover {
  background-color: #c2824a;
  border-color: #c2824a;
}

/* Thumbnail styling for admin tables */
.table-thumbnail {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0.375rem;
  border: 1px solid var(--gold-subtle, rgba(219, 146, 75, 0.15));
}

.table-thumbnail-placeholder {
  width: 48px;
  height: 48px;
  background-color: var(--coffee-medium, #241a22);
  border: 1px solid var(--gold-subtle, rgba(219, 146, 75, 0.15));
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-muted, #e7c77a);
  font-size: 1.2rem;
}

/* Image column width */
.table th:first-child,
.table td:first-child {
  width: 60px;
  text-align: center;
}

/* Admin navigation responsiveness */
.admin-panel .tab-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

@media (max-width: 640px) {
  .admin-panel .tab-link {
    flex: 1 1 calc(50% - 0.75rem);
    justify-content: center;
    border-radius: 0.75rem;
    background-color: rgba(32, 22, 29, 0.35);
    border-bottom-width: 0;
    padding: 0.75rem 0.5rem;
  }

  .admin-panel .tab-link.active {
    background-color: rgba(219, 146, 75, 0.2);
  }

  .admin-panel .tab-link i {
    margin-right: 0;
    font-size: 0.85rem;
  }

  .admin-panel header .btn-sm {
    width: 100%;
  }

  .admin-map-container {
    min-height: 280px;
  }
}

/* Mobile responsiveness for admin tables */
@media (max-width: 768px) {
  /* Hide less important columns on mobile */
  #crawls-table th:nth-child(5), /* Finish Date */
  #crawls-table td:nth-child(5),
  #crawls-table th:nth-child(6), /* Finish Time */
  #crawls-table td:nth-child(6),
  #crawls-table th:nth-child(7), /* Preview Date */
  #crawls-table td:nth-child(7),
  #crawls-table th:nth-child(8), /* Stations */
  #crawls-table td:nth-child(8) {
    display: none;
  }

  /* Stack table content vertically on very small screens */
  #stations-table th:nth-child(4), /* Coordinates */
  #stations-table td:nth-child(4) {
    display: none;
  }

  /* Reduce font size for tables on mobile */
  .table {
    font-size: 0.8rem;
  }

  .table th {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
  }

  .table td {
    padding: 0.5rem 0.25rem;
  }

  /* Make action buttons smaller on mobile */
  .table .btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }

  /* Adjust thumbnail size on mobile */
  .table-thumbnail,
  .table-thumbnail-placeholder {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  /* Reduce image column width on mobile */
  .table th:first-child,
  .table td:first-child {
    width: 40px;
  }
}

/* Very small screens - further optimizations */
@media (max-width: 480px) {
  /* Hide description column on very small screens */
  #stations-table th:nth-child(3), /* Description */
  #stations-table td:nth-child(3) {
    display: none;
  }

  /* Stack buttons vertically in action columns */
  .table .flex {
    flex-direction: column;
    gap: 0.25rem;
  }

  /* Make tables horizontally scrollable */
  .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Ensure minimum width for table readability */
  .table {
    min-width: 300px;
  }
}
