/* Responsive Styles - Mobile and Tablet Adaptations */

/* Tablet Styles */
@media (max-width: 1024px) {
  .iching-explorer {
    padding: 15px;
  }
  
  .hexagram-grid-item {
    width: 70px;
    height: 70px;
  }
  
  .trigram-display {
    width: 85px;
    height: 85px;
  }
  
  .universal-modal-container {
    width: 90vw;
  }
}

/* Mobile Styles */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .iching-explorer {
    max-width: 100%;
  }
  
  .explorer-header {
    margin-bottom: 20px;
  }
  
  .explorer-header h1 {
    font-size: 1.8rem;
  }
  
  /* Hexagram Grid Mobile */
  .hexagram-grid {
    padding: 10px;
  }
  
  .hexagram-grid-row {
    gap: 5px;
  }
  
  .hexagram-grid-item {
    width: 40px;
    height: 40px;
    font-size: 0.8em;
  }
  
  .hexagram-grid-number {
    font-size: 1em;
  }
  
  .hexagram-grid-name,
  .hexagram-grid-binary {
    display: none;
  }
  
  /* Trigram Grid Mobile */
  .trigram-grid {
    padding: 10px;
    gap: 10px;
  }
  
  .trigram-display {
    width: 70px;
    height: 70px;
  }
  
  .trigram-symbol {
    font-size: 1.5em;
  }
  
  .trigram-binary {
    font-size: 0.7em;
  }
  
  /* Modal Mobile */
  .universal-modal-container {
    width: 95vw;
    max-height: 95vh;
  }
  
  .modal-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .modal-title {
    font-size: 1.3rem;
  }
  
  /* Detail Modals Mobile */
  .hexagram-detail-modal,
  .trigram-detail-modal {
    padding: 20px;
    width: 95%;
  }
  
  .hexagram-detail-header h2 {
    font-size: 1.5rem;
  }
  
  .upper-trigram-button,
  .lower-trigram-button {
    font-size: 72px;
  }
  
  .trigram-symbol-large {
    font-size: 3em;
  }
  
  /* Lines Section Mobile */
  .line-item {
    flex-direction: column;
    gap: 5px;
  }
  
  .line-number {
    margin-right: 0;
    margin-bottom: 5px;
  }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
  body {
    padding: 5px;
  }
  
  .explorer-header h1 {
    font-size: 1.5rem;
  }
  
  .hexagram-grid-item {
    width: 35px;
    height: 35px;
    font-size: 0.7em;
  }
  
  .hexagram-grid-number {
    font-size: 0.9em;
  }
  
  .trigram-display {
    width: 60px;
    height: 60px;
  }
  
  .trigram-symbol {
    font-size: 1.3em;
  }
  
  .upper-trigram-button,
  .lower-trigram-button {
    font-size: 64px;
  }
  
  .modal-title {
    font-size: 1.2rem;
  }
  
  .modal-back-button,
  .modal-close-button {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
}

/* Orientation Changes */
@media (orientation: landscape) and (max-height: 500px) {
  .universal-modal-container {
    max-height: 90vh;
  }
  
  .hexagram-detail-modal,
  .trigram-detail-modal {
    max-height: 85vh;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
  }
  
  .hexagram-grid-item,
  .trigram-display {
    border-width: 2px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hexagram-grid-item:hover,
  .trigram-display:hover,
  .upper-trigram-button:hover,
  .lower-trigram-button:hover {
    transform: none;
  }
}

/* Source Selector Responsive Styles */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }
  
  .source-selector-section {
    align-items: stretch;
    margin-top: 0;
  }
  
  #source-selector {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .source-selector-section label {
    font-size: 0.9rem;
  }
  
  #source-selector {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
}