/*
 * Responsive Design Improvements for Starke Bienen im Einsatz
 * This file contains responsive design enhancements while maintaining the original design
 */

/* ===== FLUID TYPOGRAPHY SYSTEM ===== */
:root {
  /* Base sizes - will be scaled with viewport */
  --font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --line-height-base: 1.6;
  
  /* Fluid typography scale */
  --font-size-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.85rem);
  --font-size-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.95rem);
  --font-size-md: clamp(0.9rem, 0.85rem + 0.25vw, 1.1rem);
  --font-size-lg: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --font-size-xl: clamp(1.3rem, 1.2rem + 0.5vw, 1.5rem);
  --font-size-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 1.8rem);
  --font-size-3xl: clamp(1.8rem, 1.6rem + 1vw, 2.25rem);
  --font-size-4xl: clamp(2.25rem, 2rem + 1.25vw, 2.75rem);
  --font-size-5xl: clamp(2.75rem, 2.5rem + 1.5vw, 3.5rem);
  --font-size-6xl: clamp(3.5rem, 3rem + 2.5vw, 4.5rem);
  
  /* Spacing scale - for consistent margins and paddings */
  --space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
  --space-sm: clamp(0.75rem, 0.65rem + 0.5vw, 1rem);
  --space-md: clamp(1rem, 0.85rem + 0.75vw, 1.5rem);
  --space-lg: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
  --space-xl: clamp(2rem, 1.75rem + 1.25vw, 2.5rem);
  --space-2xl: clamp(2.5rem, 2rem + 2.5vw, 3.5rem);
  
  /* Header height - adjusts based on viewport */
  --header-height: clamp(60px, 55px + 2.5vw, 80px);
}

/* ===== BASE TYPOGRAPHY IMPROVEMENTS ===== */
body {
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

/* Apply fluid typography to headings */
h1, .h1 {
  font-size: var(--font-size-6xl);
  line-height: 1.1;
}

h2, .h2 {
  font-size: var(--font-size-4xl);
  line-height: 1.2;
}

h3, .h3 {
  font-size: var(--font-size-3xl);
  line-height: 1.3;
}

h4, .h4 {
  font-size: var(--font-size-2xl);
  line-height: 1.4;
}

h5, .h5 {
  font-size: var(--font-size-xl);
  line-height: 1.4;
}

h6, .h6 {
  font-size: var(--font-size-lg);
  line-height: 1.5;
}

/* ===== NAVBAR IMPROVEMENTS ===== */
.navbar {
  min-height: var(--header-height);
  padding: var(--space-xs) 0;
}

.navbar-brand {
  font-size: var(--font-size-md);
}

.navbar-nav .nav-link {
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-sm);
}

/* Improve navbar toggler */
.navbar-toggler {
  padding: 0.4rem 0.6rem;
  border: 2px solid rgba(255, 215, 0, 0.5);
  margin-left: var(--space-xs);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 215, 0, 0.25);
}

/* Mobile navigation improvements */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: linear-gradient(135deg, 
        rgba(26, 26, 26, 0.98) 0%,
        rgba(44, 36, 22, 0.95) 50%,
        rgba(26, 26, 26, 0.98) 100%
    );
    border-radius: 0.5rem;
    padding: var(--space-sm);
    margin-top: var(--space-sm);
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }
  
  .navbar-nav {
    padding: var(--space-xs) 0;
  }
  
  .navbar-nav .nav-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: 0.25rem;
  }
  
  .navbar-nav .nav-link:hover,
  .navbar-nav .nav-link:focus {
    background-color: rgba(255, 215, 0, 0.1);
  }
  
  .navbar-nav .active > .nav-link,
  .navbar-nav .nav-link.active {
    background-color: rgba(255, 215, 0, 0.2);
    font-weight: 600;
  }
}

/* Rating widget responsive improvements */
.navbar-rating-simple {
  padding: var(--space-xs) var(--space-sm);
  gap: var(--space-xs);
}

.navbar-rating-simple .rating-stars {
  font-size: var(--font-size-xs);
}

.navbar-rating-simple .rating-number {
  font-size: var(--font-size-sm);
}

/* ===== HERO SECTION IMPROVEMENTS ===== */
.hero-section {
  height: auto;
  min-height: 100vh;
}

.hero-overlay {
  padding-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.hero-title {
  font-size: var(--font-size-6xl);
  margin-bottom: var(--space-lg);
  word-wrap: break-word;
  hyphens: auto;
}

.hero-subtitle {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-xl);
  word-wrap: break-word;
  hyphens: auto;
}

/* ===== HERO TYPOGRAPHY MOBILE OPTIMIZATION ===== */
/* Tablets Portrait und große Handys Landscape (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .hero-overlay {
    padding-top: calc(var(--header-height) + 2rem);
    display: flex;
    align-items: flex-start;
    padding-top: 120px;
  }
  
  .hero-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    margin-top: 2rem;
    text-align: center;
  }
  
  .hero-subtitle {
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    text-align: center;
  }
}

/* Tablets Landscape und kleine Desktops (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .hero-overlay {
    padding-top: calc(var(--header-height) + 1rem);
  }
  
  .hero-title {
    font-size: clamp(3rem, 4.5vw, 4rem);
    margin-top: 1rem;
  }
  
  .hero-subtitle {
    font-size: clamp(1.4rem, 2vw, 1.7rem);
  }
}

/* Make hero buttons wrap properly */
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.hero-buttons .btn {
  margin-bottom: var(--space-sm);
  white-space: normal;
  text-align: center;
  word-wrap: break-word;
}

/* Hero logo responsive sizing */
.hero-logo {
  max-width: 100%;
  height: auto;
  width: auto;
  max-height: 400px;
}

@media (max-width: 991.98px) {
  .hero-logo-container {
    display: flex;
    justify-content: center;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
  }
  
  .hero-logo {
    max-height: 300px;
  }
}

/* Kleine Tablets und große Handys Portrait (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .hero-overlay {
    padding-top: 110px;
    display: flex;
    align-items: flex-start;
  }
  
  .hero-title {
    font-size: clamp(2.2rem, 5vw, 2.8rem);
    margin-top: 1.5rem;
    text-align: center;
  }
  
  .hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    text-align: center;
  }
  
  .hero-logo {
    max-height: 200px;
  }
  
  .hero-buttons {
    justify-content: center;
  }
}

/* Mobile Handys Portrait (bis 575px) */
@media (max-width: 575.98px) {
  .hero-overlay {
    padding-top: 100px;
    display: flex;
    align-items: flex-start;
  }
  
  .hero-title {
    font-size: clamp(1.8rem, 6vw, 2.2rem);
    margin-top: 1rem;
    text-align: center;
    line-height: 1.2;
  }
  
  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.2rem);
    text-align: center;
    margin-bottom: 1rem;
  }
  
  .hero-logo {
    max-height: 180px;
  }
  
  .hero-buttons {
    justify-content: center;
  }
}

/* ===== SECTION IMPROVEMENTS ===== */
.section {
  padding: var(--space-2xl) 0;
}

.section-title {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-xl);
  word-wrap: break-word;
  hyphens: auto;
}

.section-subtitle {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-lg);
  word-wrap: break-word;
}

/* Service cards improvements */
.service-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.service-card .card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.service-card .card-text {
  flex-grow: 1;
}

/* Testimonial improvements */
.testimonial-card {
  height: 100%;
}

/* Gallery improvements */
.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-sm);
}

.gallery-item {
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 0.5rem;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* FAQ improvements */
.accordion-button {
  padding: var(--space-md);
  font-size: var(--font-size-md);
}

.accordion-body {
  padding: var(--space-md);
  font-size: var(--font-size-md);
}

/* ===== CARD IMPROVEMENTS ===== */
.card {
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--font-size-xl);
}

.card-text {
  font-size: var(--font-size-md);
}

/* ===== BUTTON IMPROVEMENTS ===== */
.btn {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-md);
}

.btn-sm {
  padding: calc(var(--space-xs) / 2) var(--space-sm);
  font-size: var(--font-size-xs);
}

/* ===== FORM IMPROVEMENTS ===== */
.form-control {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-md);
  max-width: 100%;
}

.form-label {
  font-size: var(--font-size-md);
  margin-bottom: var(--space-xs);
}

/* Contact form specific improvements */
.contact-form {
  max-width: 100%;
}

.contact-form .form-group {
  margin-bottom: var(--space-md);
}

.contact-form .btn-submit {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-md);
  width: 100%;
}

@media (min-width: 768px) {
  .contact-form .btn-submit {
    width: auto;
  }
}

/* Form validation styles */
.form-control:focus {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 0 0.25rem rgba(255, 215, 0, 0.25);
}

.form-control.is-valid {
  border-color: #198754;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
  border-color: #dc3545;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* ===== CONTENT SPACING IMPROVEMENTS ===== */
p {
  margin-bottom: var(--space-md);
}

/* Ensure proper spacing below fixed header */
main {
  padding-top: var(--header-height);
}

/* Fix for sections with ID that are targets for navigation */
section[id] {
  scroll-margin-top: var(--header-height);
}

/* Prevent content overlap with fixed header */
.anchor-offset {
  display: block;
  position: relative;
  top: calc(-1 * var(--header-height) - 20px);
  visibility: hidden;
}

/* Improve spacing for all sections */
section {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

/* Ensure content doesn't touch screen edges on mobile */
@media (max-width: 767.98px) {
  .container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }
  
  section {
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
  }
}

/* ===== SPEZIELLE HERO FIXES FÜR PROBLEMATISCHE AUFLÖSUNGEN ===== */
/* iPad Mini Portrait & ähnliche (744px - 820px Höhe) */
@media (min-width: 768px) and (max-width: 820px) and (min-height: 900px) {
  .hero-overlay {
    padding-top: 130px;
    align-items: flex-start;
  }
  
  .hero-title {
    margin-top: 2.5rem;
    font-size: clamp(2.8rem, 4.2vw, 3.2rem);
  }
}

/* iPad Air Portrait & ähnliche (820px - 1024px Breite) */
@media (min-width: 820px) and (max-width: 1024px) and (orientation: portrait) {
  .hero-overlay {
    padding-top: 140px;
    align-items: flex-start;
  }
  
  .hero-title {
    margin-top: 3rem;
    font-size: clamp(3.2rem, 4vw, 3.8rem);
  }
}

/* Landscape mobile devices (große Handys im Querformat) */
@media (max-width: 926px) and (orientation: landscape) and (max-height: 428px) {
  .hero-overlay {
    padding-top: 80px;
    align-items: center;
    min-height: calc(100vh - 60px);
  }
  
  .hero-title {
    margin-top: 0;
    font-size: clamp(1.8rem, 4vw, 2.2rem);
  }
  
  .hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    margin-bottom: 0.5rem;
  }
}

/* ===== COMPREHENSIVE BREAKPOINTS ===== */
/* Extra small devices (portrait phones) */
@media (max-width: 575.98px) {
  .hero-buttons {
    justify-content: center;
    flex-direction: column;
  }
  
  .hero-buttons .btn {
    width: 100%;
    margin-bottom: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
  }
  
  .navbar-brand {
    font-size: var(--font-size-sm);
    max-width: 200px;
    white-space: normal;
    line-height: 1.2;
  }
  
  .logo-main {
    height: 28px;
  }
  
  .hero-title {
    font-size: var(--font-size-5xl);
    text-align: center;
  }
  
  .hero-subtitle {
    font-size: var(--font-size-xl);
    text-align: center;
  }
  
  /* Adjust section spacing */
  .section {
    padding: var(--space-xl) 0;
  }
  
  .section-title {
    font-size: var(--font-size-3xl);
    text-align: center;
  }
  
  /* Improve form elements on small screens */
  .form-control {
    font-size: var(--font-size-sm);
    padding: var(--space-sm);
  }
  
  /* Adjust card spacing */
  .card {
    margin-bottom: var(--space-md);
  }
  
  /* Ensure images don't overflow */
  img {
    max-width: 100%;
    height: auto;
  }
}

/* Small devices (landscape phones) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .hero-buttons {
    justify-content: center;
  }
}

/* Medium devices (tablets) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .hero-buttons {
    justify-content: flex-start;
  }
}

/* Large devices (desktops) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Specific adjustments for large screens if needed */
}

/* Extra large devices */
@media (min-width: 1200px) {
  /* Specific adjustments for extra large screens if needed */
}

/* ===== PRINT MEDIA QUERY ===== */
@media print {
  .navbar {
    position: static;
  }
  
  main {
    padding-top: 0;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ===== ZOOM LEVEL ADJUSTMENTS ===== */
@media (min-resolution: 1.25dppx) {
  /* Adjustments for high-DPI screens and zoomed content */
  :root {
    --space-xs: clamp(0.6rem, 0.5rem + 0.5vw, 0.85rem);
    --space-sm: clamp(0.85rem, 0.75rem + 0.5vw, 1.1rem);
  }
}

/* Ensure content doesn't get cut off when zoomed */
@media (max-width: 767.98px) and (min-resolution: 1.25dppx) {
  /* Adjustments for mobile devices when zoomed */
  body {
    overflow-x: hidden;
    width: 100%;
  }
  
  .container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }
  
  .row {
    margin-left: calc(-1 * var(--space-xs));
    margin-right: calc(-1 * var(--space-xs));
  }
  
  [class*="col-"] {
    padding-left: var(--space-xs);
    padding-right: var(--space-xs);
  }
  
  /* Ensure text doesn't overflow */
  h1, h2, h3, h4, h5, h6, p, .btn, .nav-link {
    overflow-wrap: break-word;
    word-wrap: break-word;
    -ms-word-break: break-all;
    word-break: break-word;
    -ms-hyphens: auto;
    -moz-hyphens: auto;
    -webkit-hyphens: auto;
    hyphens: auto;
  }
}

/* Adjustments for 200% zoom */
@media (min-resolution: 2dppx) {
  .navbar-brand {
    font-size: var(--font-size-xs);
    max-width: 180px;
  }
  
  .logo-main {
    height: 24px;
  }
  
  .navbar-toggler {
    padding: 0.3rem 0.5rem;
  }
  
  .hero-buttons .btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }
}

/* ===== CONTRAST IMPROVEMENTS ===== */
/* Improve text contrast over images */
.text-on-image {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ===== FOCUS STYLES ===== */
:focus {
  outline: 3px solid rgba(255, 215, 0, 0.5);
  outline-offset: 2px;
}

/* ===== SCROLLBAR IMPROVEMENTS ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.5);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 215, 0, 0.7);
}