/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
}

body {
  background: #fff;
  padding-bottom: 80px;
}

/* Header Container */
.header-container {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.header-logo {
  max-width: 250px;
  height: auto;
  display: block;
  margin-bottom: 0;
  flex-shrink: 0;
}

.header-title {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin: 0;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

/* Container */
.container-fluid {
  padding: 20px;
  margin: 0;
  width: 100%;
}

.mt-5 {
  margin-top: 3rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  background: transparent;
}

.btn-primary {
  background-color: #007bff;
  color: #fff;
  border-color: #007bff;
}

.btn-primary:hover {
  background-color: #0056b3;
  border-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: #fff;
  border-color: #6c757d;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-info {
  background-color: #17a2b8;
  color: #fff;
  border-color: #17a2b8;
}

.btn-info:hover {
  background-color: #117a8b;
}

.btn-success {
  background-color: #28a745;
  color: #fff;
  border-color: #28a745;
}

.btn-success:hover {
  background-color: #218838;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Search Container */
#searchContainer {
  position: relative;
  z-index: 1000;
  background-color: white;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 20px;
}

#searchForm {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#searchInput {
  padding: 8px;
  padding-right: 35px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  min-width: 250px;
}

#clearButton {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: #999;
}

#clearButton:hover {
  color: #333;
}

/* Page Overlay */
#pageOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

/* Panels */
.panel-title {
  cursor: pointer;
  background-color: #e6e6e6;
  color: black;
  padding: 12px 15px;
  font-family: Roboto, Arial, sans-serif;
  font-size: 18px;
  font-weight: 500;
  border: none;
  margin-top: 5px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.panel-title:hover {
  background-color: #d6d6d6;
}

.panel-content {
  display: none;
  padding: 0;
  border: 1px solid #ccc;
  border-top: none;
  font-family: Roboto, Arial, sans-serif;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Table Styles - Desktop */
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: #fff;
}

.table thead th {
  position: sticky;
  top: 0;
  background-color: #f8f9fa;
  padding: 12px 10px;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  font-size: 14px;
  z-index: 10;
}

.table tbody td {
  padding: 10px;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
  vertical-align: top;
}

.table tbody tr:nth-child(odd) {
  background-color: #ffffff;
}

.table tbody tr:nth-child(even) {
  background-color: #eaebf4;
}

.table tbody tr:hover {
  background-color: #abb1d9;
}

.table td a {
  color: #007bff;
  text-decoration: none;
}

.table td a:hover {
  text-decoration: underline;
}

/* Pinsetter & Belag Spalten */
.pinsetter-column,
.bahnenbelag-column {
  max-width: 25ch;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Date Styling */
.date-expired,
.no-abnahme {
  color: red;
  font-weight: 600;
}

/* Hammer Icon */
.hammer-icon {
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: transform 0.2s;
}

.hammer-icon:hover {
  transform: scale(1.1);
}

/* Highlight für Suchergebnisse */
.highlight {
  /* legacy whole-cell highlight */
  background-color: #ffde91 !important;
}
.highlight-mark {
  background-color: #ffde91;
  color: inherit;
  padding: 0 0.05em;
}

/* Card Layout für Mobile */
.cards-container {
  display: none;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
  display: block;
}

.modal-dialog {
  position: relative;
  width: auto;
  max-width: 600px;
  margin: 1.75rem auto;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid #dee2e6;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-header .close {
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: #000;
  opacity: 0.5;
  cursor: pointer;
}

.modal-header .close:hover {
  opacity: 0.75;
}

.modal-body {
  position: relative;
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body h5 {
  font-weight: bold;
  margin-top: 15px;
  margin-bottom: 10px;
}

.modal-body ul {
  list-style-type: disc;
  margin-left: 20px;
  margin-bottom: 10px;
}

.modal-body p {
  margin-bottom: 10px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 15px 20px;
  border-top: 1px solid #dee2e6;
}

/* Cookie Banner */
#cookie-banner {
  z-index: 1050;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
  padding: 15px;
}

#cookie-banner p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

#cookie-banner a {
  color: #007bff;
  text-decoration: underline;
}

#cookie-banner a:hover {
  text-decoration: none;
}

.d-none {
  display: none !important;
}

.d-flex {
  display: flex !important;
}

.flex-column {
  flex-direction: column !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.align-items-start {
  align-items: flex-start !important;
}

.mb-2 {
  margin-bottom: 0.5rem !important;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8em;
  background-color: #f0f0f0;
  color: #333;
  margin-top: 40px;
}

footer a {
  color: #007bff;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Scroll Top Button */
#scrollTopButton {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: none;
  padding: 10px 16px;
  border-radius: 4px;
}

/* Font Awesome Icons (fallback wenn CDN nicht lädt) */
.fas {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
}

.fa-info-circle::before {
  content: "ℹ";
}

.fa-download::before {
  content: "⬇";
}

/* Responsive Breakpoints */

/* Tablets & kleine Desktops */
@media (max-width: 992px) {
  .header-container {
    gap: 15px;
  }

  .header-title {
    font-size: 24px;
  }

  .container-fluid {
    padding: 15px;
  }

  #searchForm {
    flex-direction: column;
    align-items: stretch;
  }

  #searchInput {
    width: 100%;
    min-width: auto;
  }

  .btn {
    width: 100%;
  }

  .panel-content {
    overflow-x: auto;
  }

  .table {
    font-size: 13px;
  }

  .table thead th,
  .table tbody td {
    padding: 8px 6px;
  }
}

/* Mobile Devices - Card Layout */
@media (max-width: 1024px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-logo {
    max-width: 150px;
    margin-bottom: 0;
  }

  .header-title {
    font-size: 20px;
    text-align: left;
    width: 100%;
  }

  .mt-5 {
    margin-top: 1.5rem;
  }

  .panel-title {
    font-size: 16px;
    padding: 10px;
  }

  /* Tabelle ausblenden */
  .panel-content .table-wrapper {
    display: none;
  }

  /* Cards anzeigen */
  .cards-container {
    display: block;
    padding: 10px;
  }

  .anlage-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .anlage-card:nth-child(odd) {
    background-color: #ffffff;
  }

  .anlage-card:nth-child(even) {
    background-color: #eaebf4;
  }

  .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #007bff;
  }

  .card-title a {
    color: #007bff;
    text-decoration: none;
  }

  .card-title a:hover {
    text-decoration: underline;
  }

  .card-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 14px;
  }

  .card-label {
    font-weight: 600;
    color: #666;
  }

  .card-value {
    color: #333;
    word-wrap: break-word;
  }

  .card-value.date-expired,
  .card-value.no-abnahme {
    color: red;
    font-weight: 600;
  }

  #cookie-banner {
    padding: 10px;
  }

  #cookie-banner .container {
    flex-direction: column;
    align-items: stretch;
  }

  #cookie-banner .btn {
    width: 100%;
    margin-bottom: 5px;
  }

  .modal-dialog {
    margin: 0.5rem;
  }

  #scrollTopButton {
    bottom: 80px;
    right: 15px;
    padding: 8px 12px;
    font-size: 13px;
  }

  footer {
    font-size: 0.75em;
    padding: 15px 10px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .header-title {
    font-size: 18px;
  }

  .container-fluid {
    padding: 10px;
  }

  .panel-title {
    font-size: 14px;
    padding: 8px;
  }

  .anlage-card {
    padding: 12px;
  }

  .card-title {
    font-size: 15px;
  }

  .card-row {
    grid-template-columns: 100px 1fr;
    font-size: 13px;
  }

  #searchInput {
    font-size: 16px; /* verhindert Zoom auf iOS */
  }

  /* Responsive Modal für kleine Bildschirme */
  .modal-dialog {
    width: 95%;
    max-width: none;
    margin: 0.5rem auto;
  }
}

/* Print Styles */
@media print {
  #searchContainer,
  #scrollTopButton,
  #cookie-banner,
  footer,
  .btn,
  .modal {
    display: none !important;
  }

  .panel-content {
    display: block !important;
    border: none;
  }

  .table {
    font-size: 10pt;
  }

  body {
    padding-bottom: 0;
  }
}
