/* global.css */

/* Disable zooming for iOS by setting viewport scaling to fixed */
html,
body {
  touch-action: manipulation; /* Prevents double-tap to zoom */
  -ms-touch-action: manipulation;
  -webkit-user-select: none; /* Prevents text selection */
  user-select: none;
}

body {
  font-family: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f9f9f9;
  margin: 0;
  padding: 0;
}
.container {
  max-width: 700px;
  margin: 10px auto;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.description {
  font-size: 1.2rem;
  line-height: 1.6;
  color: #444444;
  padding: 0;
  margin-top: 20px;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow: hidden;
  text-align: justify;
}
.description.no-data {
  text-align: center;
  color: red;
  font-weight: bold;
}
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.language-select {
  display: flex;
  align-items: center;
}
.fi {
  margin-right: 5px;
}
.fi-star {
  background: none !important;
  background-image: none !important;
  width: 24px;
  height: 16px;
  display: inline-block !important;
  text-align: center;
  line-height: 16px;
  font-size: 16px;
  position: relative;
}
.fi-star:before {
  content: '✡️';
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  line-height: 16px;
}


.controls {
  display: flex;
  align-items: center;
}
.controls .font-resizer {
  display: flex;
  gap: 5px;
}
/* Improved touch targets */
.controls .font-resizer button,
.audio-button-container,
.speak-button-container,
select,
.arrow {
  min-height: 44px;
  min-width: 44px;
  padding: 10px;
  touch-action: manipulation;
}
.controls .font-resizer button {
  font-size: 1.5rem;
  padding: 8px 16px;
  margin: 0 4px;
  border: 2px solid #ccc;
  background-color: #f8f9fa;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s;
}
/* Focus styles for better keyboard navigation */
.controls .font-resizer button:focus,
.audio-button-container:focus,
.speak-button-container:focus,
select:focus,
.arrow:focus {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}
/* High contrast focus for accessibility */
@media (forced-colors: active) {
  .controls .font-resizer button:focus,
  .audio-button-container:focus,
  .speak-button-container:focus,
  select:focus,
  .arrow:focus {
    outline: 3px solid CanvasText;
  }
}
@media (hover: hover) {
  .controls .font-resizer button:hover {
    background-color: #e9ecef;
  }
}
.speak-button-container {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.audio-button-container {
  font-size: 3.84rem;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  outline: none;
  margin: 0 auto;
}
/* Центрирование speakButton2 */
#speakButton2 {
  margin: 0 auto;
}
.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.9);
}
.modal-content {
  background: transparent;
  border: none;
  color: #ffff00;
  text-align: center;
}
.spinner-border {
  color: #000cff;
}
.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.2rem;
}
hr {
  margin: 40px 0;
}
@media (max-width: 576px) {
  .header-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .language-select {
    flex: 1;
    width: 25%;
  }
  #languageSelect {
    width: 100%;
  }
  .controls {
    flex: 1;
    justify-content: flex-end;
  }
  .speak-button-container {
    order: 2;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
  }
  .controls {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    margin-top: 10px;
  }
}
#languageSelect {
  min-width: 75px;
  max-width: 100%;
  width: auto;
}
/* Styles for navigation arrows */
.navigation-arrows {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 0 20px;
  gap: 10px;
}
/* Navigation buttons styles */
.nav-button {
  font-size: 1.5rem;
  cursor: pointer;
  color: #007bff;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background-color: rgba(0, 123, 255, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
  outline: none;
  border: none;
}
.nav-button:hover:not(.disabled),
.nav-button:focus:not(.disabled) {
  background-color: rgba(0, 123, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.nav-button:active:not(.disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
/* QR Scanner modal styles */
#qrScannerModal .modal-content {
  background: white;
  color: black;
}
#qrScannerModal .modal-header {
  border-bottom: 1px solid #dee2e6;
}
#qrScannerModal .modal-footer {
  border-top: 1px solid #dee2e6;
}
#reader {
  width: 100%;
}
/* Page input modal styles */
#pageInputModal .modal-content {
  background: white;
  color: black;
}
#pageInputModal .modal-body {
  color: black;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}
.numpad button {
  padding: 15px;
  font-size: 1.2rem;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  border-radius: 5px;
  cursor: pointer;
}
.numpad button:hover {
  background: #e9ecef;
}
#pageDisplay {
  width: 100%;
  text-align: center;
  padding: 10px;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}
.navigation-arrows .arrow {
  font-size: 2.5rem;
  cursor: pointer;
  color: #007bff;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background-color: rgba(0, 123, 255, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.navigation-arrows .arrow:hover:not(.disabled),
.navigation-arrows .arrow:focus:not(.disabled) {
  background-color: rgba(0, 123, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.navigation-arrows .arrow:active:not(.disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.navigation-arrows .arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: rgba(0, 0, 0, 0.05);
  color: #6c757d;
}
@media (max-width: 576px) {
  .navigation-arrows {
    margin: 30px 0;
    padding: 0 10px;
  }
  .navigation-arrows .arrow {
    font-size: 2rem;
    width: 50px;
    height: 50px;
  }
}

/* ===== NOWE MEDIA QUERIES DLA PEŁNEJ RESPONSYWNOŚCI ===== */

/* Tablety (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 90%;
    margin: 20px auto;
    padding: 30px;
  }
  
  .description {
    font-size: 1.3rem;
    line-height: 1.7;
    padding: 25px;
  }
  
  .header-row {
    padding: 15px 20px;
    margin-bottom: 25px;
  }
  
  .language-select {
    min-width: 200px;
  }
  
  #languageSelect {
    font-size: 16px;
    padding: 10px;
  }
  
  .controls .font-resizer button {
    font-size: 1.8rem;
    padding: 12px 20px;
    margin: 0 6px;
  }
  
  .audio-button-container {
    font-size: 4.5rem;
    width: 110px;
    height: 110px;
  }
  
  .navigation-arrows {
    margin: 30px 0;
    gap: 20px;
  }
  
  .nav-button,
  .navigation-arrows .arrow {
    font-size: 2.2rem;
    width: 70px;
    height: 70px;
  }
  
  .numpad {
    max-width: 400px;
    gap: 15px;
  }
  
  .numpad button {
    padding: 20px;
    font-size: 1.4rem;
  }
}

/* iPady w landscape (1024px - 1366px) */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
  .container {
    max-width: 85%;
    margin: 30px auto;
    padding: 40px;
  }
  
  .description {
    font-size: 1.4rem;
    line-height: 1.8;
    padding: 30px;
  }
  
  .header-row {
    padding: 20px 25px;
    margin-bottom: 30px;
  }
  
  .language-select {
    min-width: 250px;
  }
  
  #languageSelect {
    font-size: 18px;
    padding: 12px;
  }
  
  .controls .font-resizer button {
    font-size: 2rem;
    padding: 15px 25px;
    margin: 0 8px;
  }
  
  .audio-button-container {
    font-size: 5rem;
    width: 120px;
    height: 120px;
  }
  
  .navigation-arrows {
    margin: 40px 0;
    gap: 25px;
  }
  
  .nav-button,
  .navigation-arrows .arrow {
    font-size: 2.5rem;
    width: 80px;
    height: 80px;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .container {
    max-width: 80%;
    margin: 40px auto;
    padding: 50px;
  }
  
  .description {
    font-size: 1.5rem;
    line-height: 1.9;
    padding: 35px;
  }
  
  .header-row {
    padding: 25px 30px;
    margin-bottom: 35px;
  }
  
  .language-select {
    min-width: 300px;
  }
  
  #languageSelect {
    font-size: 20px;
    padding: 15px;
  }
  
  .controls .font-resizer button {
    font-size: 2.2rem;
    padding: 18px 30px;
    margin: 0 10px;
  }
  
  .audio-button-container {
    font-size: 5.5rem;
    width: 130px;
    height: 130px;
  }
  
  .navigation-arrows {
    margin: 50px 0;
    gap: 30px;
  }
  
  .nav-button,
  .navigation-arrows .arrow {
    font-size: 2.8rem;
    width: 90px;
    height: 90px;
  }
  
  .numpad {
    max-width: 500px;
    gap: 20px;
  }
  
  .numpad button {
    padding: 25px;
    font-size: 1.6rem;
  }
}

/* Duże ekrany (1920px+) */
@media (min-width: 1920px) {
  .container {
    max-width: 70%;
    margin: 60px auto;
    padding: 60px;
  }
  
  .description {
    font-size: 1.6rem;
    line-height: 2;
    padding: 40px;
  }
  
  .header-row {
    padding: 30px 35px;
    margin-bottom: 40px;
  }
  
  .language-select {
    min-width: 350px;
  }
  
  #languageSelect {
    font-size: 22px;
    padding: 18px;
  }
  
  .controls .font-resizer button {
    font-size: 2.5rem;
    padding: 20px 35px;
    margin: 0 12px;
  }
  
  .audio-button-container {
    font-size: 6rem;
    width: 140px;
    height: 140px;
  }
  
  .navigation-arrows {
    margin: 60px 0;
    gap: 35px;
  }
  
  .nav-button,
  .navigation-arrows .arrow {
    font-size: 3rem;
    width: 100px;
    height: 100px;
  }
}

/* Orientacja landscape dla telefonów */
@media (max-width: 768px) and (orientation: landscape) {
  .container {
    padding: 10px;
    margin: 5px auto;
  }
  
  .header-row {
    flex-direction: row;
    padding: 10px;
    margin-bottom: 10px;
  }
  
  .description {
    padding: 15px;
    font-size: 14px;
    line-height: 1.5;
  }
  
  .navigation-arrows {
    margin: 15px 0;
    gap: 10px;
  }
  
  .nav-button,
  .navigation-arrows .arrow {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
  
  .audio-button-container {
    font-size: 3rem;
    width: 70px;
    height: 70px;
  }
}

/* Wysokie ekrany (height > 800px) */
@media (min-height: 800px) {
  .container {
    margin: 20px auto;
  }
  
  .description {
    margin-bottom: 30px;
  }
  
  .navigation-arrows {
    margin: 40px 0;
  }
}

/* Niskie ekrany (height < 600px) */
@media (max-height: 600px) {
  .container {
    margin: 5px auto;
    padding: 10px;
  }
  
  .header-row {
    padding: 8px;
    margin-bottom: 8px;
  }
  
  .description {
    padding: 10px;
    font-size: 14px;
    line-height: 1.4;
  }
  
  .navigation-arrows {
    margin: 10px 0;
    gap: 8px;
  }
  
  .nav-button,
  .navigation-arrows .arrow {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}

/* Retina/HD displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .nav-button,
  .navigation-arrows .arrow {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  .container {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  }
}
