/* ===== RESPONSIVE STYLES ===== */

/* Mobile First Approach - Base styles are for mobile */

/* Small mobile devices (320px - 480px) */
@media (max-width: 480px) {
  body {
    padding: 0.5rem;
    padding-bottom: 0;
  }
  
  main {
    padding: 0 0.5rem;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
  }
  
  .action-btn {
    width: 100%;
    max-width: 280px;
    padding: 0.9rem 1.2rem;
    font-size: 0.85rem;
    margin: 0 auto;
  }
  
  h1 {
    font-size: clamp(1.8rem, 10vw, 2.5rem);
    margin-bottom: 1rem;
  }
  
  p {
    font-size: clamp(0.9rem, 4.5vw, 1.1rem);
    margin-bottom: 2rem;
  }
  
  .logo {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    margin-bottom: 2rem;
  }

  /* Language buttons */
  .lang-bar { 
    gap: 0.2rem; 
    padding: 3px;
    top: 6px;
    left: 6px;
  }
  .lang-btn { 
    width: 28px; 
    height: 28px; 
    font-size: 16px; 
  }

  /* Footer */
  .footer {
    padding: 1rem 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0 0.8rem;
    justify-items: stretch;
  }
  
  .footer-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    padding: 0.8rem 0.5rem;
  }
  
  .contact-item {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .map-container {
    height: 120px;
  }
  
  .footer-bottom {
    font-size: 0.75rem;
    margin-top: 1rem;
  }
  
  .company-detail-item {
    text-align: center;
  }

  /* Company info specific fixes */
  .footer-company .company-row {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
    text-align: center;
  }
  
  .footer-company .detail-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    white-space: normal;
    word-break: normal;
  }
  
  .footer-company .detail-value {
    font-size: 0.85rem;
    text-align: center !important;
    word-break: break-all;
    line-height: 1.3;
  }

  /* Payment methods */
  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0.1rem;
  }
  
  .payment-icon {
    width: 100%;
    height: 28px;
    aspect-ratio: 1.5;
  }

  /* Modal */
  .modal-content {
    margin: 1% auto;
    width: 98%;
    max-width: none;
    border-radius: 8px;
  }
  
  .modal-header {
    padding: 0.8rem 1rem;
  }
  
  .feedback-form {
    padding: 1rem;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 0.8rem;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
    min-width: auto;
  }
}

/* Medium mobile devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  body {
    padding: 1rem;
    padding-bottom: 0;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  
  .action-btn {
    width: 100%;
    max-width: 320px;
    padding: 1rem 1.5rem;
    margin: 0 auto;
  }
  
  h1 {
    font-size: clamp(2.2rem, 7vw, 3rem);
  }
  
  p {
    font-size: clamp(1rem, 4vw, 1.2rem);
  }

  /* Language buttons */
  .lang-bar {
    top: 8px;
    left: 8px;
  }
  .lang-btn {
    width: 30px;
    height: 30px;
    font-size: 17px;
  }

  /* Footer */
  .footer {
    padding: 1.5rem 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
  
  .footer-content {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 0 1.5rem;
    justify-items: stretch;
  }
  
  .footer-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
  }
  
  .contact-item {
    justify-content: center;
  }
  
  .map-container {
    height: 140px;
  }
  
  .company-detail-item {
    text-align: center;
  }

  /* Company info specific fixes for medium mobile */
  .footer-company .company-row {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
    text-align: center;
  }
  
  .footer-company .detail-label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    white-space: normal;
    word-break: normal;
  }
  
  .footer-company .detail-value {
    font-size: 0.9rem;
    text-align: center !important;
    word-break: break-all;
    line-height: 1.3;
  }

  /* Payment methods */
  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    padding: 0.15rem;
  }
  
  .payment-icon {
    width: 100%;
    height: 30px;
    aspect-ratio: 1.6;
  }

  /* Modal */
  .modal-content {
    margin: 5% auto;
    width: 95%;
  }
  
  .modal-header {
    padding: 1rem 1.5rem;
  }
  
  .feedback-form {
    padding: 1.5rem;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 0.8rem;
  }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  body {
    padding: var(--tablet-padding);
    padding-bottom: 0;
  }
  
  main {
    max-width: 700px;
  }
  
  .action-buttons {
    flex-direction: row;
    gap: 1.2rem;
  }
  
  .action-btn {
    flex: 1;
    max-width: 250px;
    min-width: 200px;
  }
  
  h1 {
    font-size: clamp(2.5rem, 6vw, 3.2rem);
  }
  
  p {
    font-size: clamp(1.1rem, 3.5vw, 1.25rem);
  }

  /* Language buttons */
  .lang-bar {
    top: 12px;
    left: 12px;
  }
  .lang-btn {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  /* Footer */
  .footer {
    padding: 2rem 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
  
  .footer-content {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 0 2rem;
    justify-items: stretch;
    min-width: 0; /* Prevent grid overflow */
  }
  
  .footer-section {
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    min-width: 0; /* Allow sections to shrink */
  }
  
  .contact-item {
    justify-content: flex-start;
  }
  
  /* Ensure payment methods don't overflow */
  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 100%;
    padding: 0.2rem;
  }
  
  .payment-icon {
    width: 100%;
    height: 32px;
    aspect-ratio: 1.6;
  }

  /* Modal */
  .form-actions {
    flex-direction: row;
  }
  
  .btn-primary,
  .btn-secondary {
    flex: 0 1 auto;
    min-width: 120px;
  }
}

/* Desktop and large screens (1025px+) */
@media (min-width: 1025px) {
  body {
    padding: var(--desktop-padding);
    padding-bottom: 0;
  }
  
  main {
    max-width: 800px;
  }
  
  .action-buttons {
    gap: 1.5rem;
  }
  
  .action-btn {
    max-width: 280px;
    min-width: 220px;
  }
  
  h1 {
    font-size: 3.5rem;
  }
  
  p {
    font-size: 1.3rem;
  }

  /* Footer */
  .footer {
    padding: 2.5rem 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
  
  .footer-content {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    padding: 0 3rem;
    justify-items: stretch;
    min-width: 0; /* Prevent grid overflow */
  }
  
  .footer-section {
    min-width: 0; /* Allow sections to shrink */
  }
  
  /* Ensure payment methods fit properly */
  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    max-width: 100%;
    padding: 0.3rem;
  }
  
  .payment-icon {
    width: 100%;
    height: 36px;
    aspect-ratio: 1.6;
  }
}

/* Extra large screens (1440px+) */
@media (min-width: 1440px) {
  main {
    max-width: 900px;
  }
  
  .action-btn {
    max-width: 300px;
    min-width: 250px;
  }
}

/* Additional responsive improvements */
@media (max-width: 320px) {
  body {
    padding: 0.3rem;
    padding-bottom: 0.5rem;
  }
  
  main {
    padding: 0 0.3rem;
  }
  
  h1 {
    font-size: 1.6rem;
  }
  
  p {
    font-size: 0.85rem;
  }
  
  .action-btn {
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
  }
  
  .logo {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .footer {
    padding: 1rem;
  }
  
  .footer-content {
    gap: 1rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .action-btn,
  .lang-btn {
    border-width: 0.5px;
  }
}

/* Footer responsive grid adjustments */
@media (max-width: 1279px) {
  .footer-content { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-map { grid-column: span 1; }
}

@media (max-width: 1023px) {
  .footer-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-map { grid-column: span 2; }
  .detail-value { text-align: left; } /* на планшетах можно выровнять влево */
}

@media (max-width: 767px) {
  .footer-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-map { grid-column: span 2; }
  .company-row { grid-template-columns: 1fr; } /* метка сверху, значение ниже */
  .detail-label { white-space: normal; }
}


@media (max-width: 420px) {
  .footer-content { grid-template-columns: 1fr; }
  .footer-map { grid-column: span 1; }
}

/* Desktop footer fixes */
@media (min-width: 1025px) {
  .footer-content { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-map { grid-column: auto !important; } /* отменяем span 2 где бы он ни был */
}

/* Company info responsive */
@media (min-width: 768px) {
  .company-detail-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .detail-label {
    min-width: 140px;
    text-align: left;
    flex-shrink: 0;
  }
  
  .detail-value {
    text-align: right;
    flex: 1;
  }
}

/* Footer company layout fixes */
.footer-company .company-list {
  display: grid;
  gap: 0.75rem;
}

.footer-company .company-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  align-items: start;
  column-gap: 1rem;
}

.footer-company .detail-label {
  white-space: normal !important;
  word-break: normal;
  overflow-wrap: break-word;
  font-weight: 500;
}

.footer-company .detail-value {
  margin: 0;
  text-align: left;           /* справа красиво, но на узких колонках ухудшает читаемость */
  word-break: normal;
  overflow-wrap: break-word;  /* ломаем только по словам */
  hyphens: auto;
}

/* Map responsive */
@media (min-width: 1280px) {
  .footer-map { grid-column: span 1; }
}
