/* ===================================
   MOBILE-OPTIMIERUNG
   =================================== */

/* Responsive Breakpoints */
:root {
  --mobile-max: 768px;
  --tablet-max: 1024px;
}

/* ===================================
   HEADER & NAVIGATION
   =================================== */

@media (max-width: 768px) {

  /* Header must be above overlay */
  .header {
    z-index: 2001 !important;
    position: relative;
  }

  /* Burger Menu Button */
  .menuToggle {
    display: block !important;
    font-size: 28px;
    z-index: 2002;
    /* Higher than header and overlay */
    position: absolute;
    right: 20px;
    top: 50%;
    /* Center vertically */
    transform: translateY(-50%) !important;
    /* Center vertically */
    cursor: pointer;
    padding: 10px;
    color: #2a2f43;
    background: none;
    border: none;
    outline: none !important;
    /* Remove focus outline */
    -webkit-tap-highlight-color: transparent;
  }

  /* Mobile Navigation */
  .nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 2001;
    /* Matches header, but order in DOM matters if fixed escaping fails */
    overflow-y: auto;
    padding-top: 60px;
    /* Space for close button if needed, or visual breathing room */
  }

  .nav.active {
    right: 0;
  }

  .navList {
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  .navList>li {
    border-bottom: 1px solid #f0f0f0;
  }

  /* Hauptlink verstecken, nur Items anzeigen */
  .navList>li.dropdown>a:first-child {
    display: none !important;
  }

  .navList>li:not(.dropdown)>a {
    padding: 12px 20px;
    /* Reduced vertical padding */
    display: block;
    font-size: 16px;
    color: #2a2f43;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    /* Use border here? Original had it on li */
  }

  /* Flache Dropdown-Liste - alle direkt sichtbar */
  .dropdown .dropdownMenu {
    position: static !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  .dropdown .dropdownMenu li {
    border-bottom: 1px solid #f5f5f5;
  }

  .dropdown .dropdownMenu li a {
    padding: 12px 20px !important;
    /* Reduced vertical padding */
    font-size: 16px !important;
    color: #2a2f43 !important;
    font-weight: 500 !important;
    display: block !important;
  }

  .dropdown .dropdownMenu li a:hover {
    background: #f8f9fa !important;
    color: #E30A1D !important;
  }

  /* Mobile Overlay */
  .mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    /* High z-index but below nav */
    backdrop-filter: blur(2px);
    /* Nice effect, maybe helps with "darker" perception */
  }

  .mobile-overlay.active {
    display: block;
  }
}

/* ===================================
   STARTSEITE - HERO SEARCH
   =================================== */

@media (max-width: 768px) {
  .heroSection {
    background-attachment: scroll !important;
    padding: 20px 0 !important;
  }

  .heroContainer {
    grid-template-columns: 1fr !important;
    padding: 30px 15px !important;
    gap: 30px;
  }

  .heroLeft,
  .heroRight {
    width: 100%;
    padding: 0 5px;
  }

  .heroTitle {
    font-size: 24px !important;
    line-height: 1.3 !important;
    margin-bottom: 20px !important;
  }

  .heroImage {
    max-width: 200px;
    margin: 20px auto;
  }

  /* Hero Search Container - nicht am Rand */
  .hero-search-container {
    padding: 20px 15px !important;
    border-radius: 8px !important;
    max-width: calc(100% - 20px) !important;
    margin: 0 10px !important;
    box-sizing: border-box;
  }

  /* Tab Container Scrollbar */
  .tab-container {
    margin-bottom: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 8px 10px;
    font-size: 12px;
    min-width: fit-content;
  }

  /* Form Grid - 2 Reihen (1 Spalte pro Zeile) */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 15px;
  }

  .field-container,
  .field-container-checkbox {
    margin-bottom: 0;
  }

  /* Button Container */
  .button-container {
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
  }

  .button-group {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .button {
    width: 100%;
    height: 44px;
    padding: 12px 16px;
    font-size: 15px;
    justify-content: center;
  }
}

/* Manufacturer Slider styles removed - now in home-slider.css */

/* ===================================
   PRODUKTSEITEN - CATEGORY HERO
   =================================== */

@media (max-width: 768px) {
  .category-hero {
    min-height: auto !important;
  }

  .hero-content {
    padding: 20px 15px !important;
    gap: 20px;
  }

  .hero-text {
    padding: 0 !important;
  }

  .hero-title {
    font-size: 24px !important;
    margin-bottom: 10px !important;
  }

  /* Search Container */
  .search-container {
    padding: 20px 15px !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .search-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Search Fields - 2 Reihen */
  .search-fields {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Search Actions */
  .search-actions {
    flex-direction: column !important;
    gap: 10px;
    margin-top: 15px;
  }

  .left-buttons,
  .right-buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .catalog-button,
  .reset-button,
  .search-button {
    width: 100% !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    justify-content: center !important;
  }
}

/* ===================================
   PRODUKTTABELLE
   =================================== */

@media (max-width: 768px) {

  /* Card-Layout statt Tabelle */
  .product-table-container {
    margin-top: 15px;
  }

  .product-table {
    display: block !important;
    font-size: 14px;
  }

  .product-table thead {
    display: none !important;
  }

  .product-table tbody {
    display: block;
  }

  .product-table tbody tr.product-row {
    display: block;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  }

  .product-table tbody tr.product-row:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  .product-table td {
    display: block !important;
    padding: 8px 0 !important;
    border: none !important;
    text-align: left !important;
  }

  .product-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #2a2f43;
    display: inline-block;
    width: 120px;
    margin-right: 10px;
  }

  /* Verstecke PDF-Spalte in Mobile */
  .col-pdf {
    display: none !important;
  }

  .col-bezeichnung {
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 10px !important;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px !important;
  }

  .col-bezeichnung::before {
    display: none;
  }

  .col-aktion {
    text-align: center !important;
    padding-top: 15px !important;
    margin-top: 10px;
    border-top: 1px solid #f0f0f0;
  }

  .col-aktion::before {
    display: none;
  }

  /* Expanded Row Mobile */
  .expanded-row {
    display: block !important;
    border: none !important;
  }

  .expanded-content {
    display: block !important;
  }

  .expanded-wrapper {
    grid-template-columns: 1fr !important;
    padding: 15px !important;
    gap: 20px;
  }

  .specs-grid {
    grid-template-columns: 1fr !important;
  }

  .spec-item:nth-child(even) {
    border-right: 1px solid #ddd;
  }

  .expanded-actions {
    flex-direction: column;
  }

  .btn-expanded-primary,
  .btn-expanded-secondary {
    width: 100%;
  }
}

/* ===================================
   PRODUCT DETAIL PAGE
   =================================== */

@media (max-width: 768px) {
  .product-detail-container {
    padding: 20px 15px;
  }

  .product-header {
    padding: 20px 15px;
  }

  .product-title {
    font-size: 20px;
  }

  .product-layout {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .main-image {
    height: 300px;
  }

  .data-table {
    grid-template-columns: 1fr !important;
  }

  .data-row:nth-child(even) {
    border-right: 1px solid #ddd;
  }
}

/* ===================================
   KONTAKT & FORMS
   =================================== */

@media (max-width: 768px) {
  .formRow {
    flex-direction: column;
  }

  .formGroup.halfWidth {
    width: 100% !important;
  }

  .locationsGrid {
    grid-template-columns: 1fr !important;
  }

  .openingHours {
    flex-direction: column;
  }
}

/* ===================================
   PAGINATION
   =================================== */

@media (max-width: 768px) {
  .pagination {
    flex-wrap: wrap;
    gap: 5px !important;
  }

  .pagination a,
  .pagination span {
    padding: 6px 10px !important;
    font-size: 13px !important;
  }
}

/* ===================================
   GENERAL MOBILE FIXES
   =================================== */

@media (max-width: 768px) {
  .contentContainer {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .sectionTitle {
    font-size: 22px !important;
  }

  .textImageSection {
    flex-direction: column !important;
  }

  .textContent,
  .imageContent {
    width: 100% !important;
  }

  .cardContainer {
    grid-template-columns: 1fr !important;
  }

  .employeeCardContainer {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .hero-search-container {
    max-width: 600px;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-fields {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-table {
    font-size: 13px;
  }

  .cardContainer {
    grid-template-columns: repeat(2, 1fr);
  }
}
