/* ============================================
   Ajustes responsivos para el módulo educativo
   ============================================ */
.educational-module {
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.edu-section {
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.edu-section-header {
  box-sizing: border-box;
  white-space: normal;
}

.edu-filters {
  flex-wrap: wrap;
  gap: 8px;
  box-sizing: border-box;
}

.edu-filters button {
  margin: 0 !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  flex-shrink: 0;
}

/* School filter dropdown - ensure it shrinks */
.edu-school-filter .Select {
  min-width: 0 !important;
}

/* ============================================
   Tablet (<=900px)
   ============================================ */
@media (max-width: 900px) {
  .educational-module {
    padding: 14px;
  }

  .edu-sort-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    overflow: hidden;
  }

  .edu-sort-dropdown {
    width: 100% !important;
    min-width: 0 !important;
  }

  .edu-section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .edu-section-header h3 {
    flex-shrink: 0;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .edu-capsules-row {
    flex-direction: column;
    gap: 16px;
    width: 100%;
  }

  .edu-capsules-scroll {
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    width: 100%;
  }

  .capsule-card {
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
  }

  .capsule-media {
    height: 180px !important;
  }

  .edu-materials-list,
  .edu-schools-list {
    max-height: none !important;
    overflow-y: visible !important;
    padding-right: 0 !important;
    width: 100%;
    box-sizing: border-box;
  }

  .material-card {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
    box-sizing: border-box;
  }

  .material-card > a,
  .material-card > a[href] {
    width: 100% !important;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .material-download {
    width: 100%;
    margin-top: 10px;
  }

  /* School filter dropdown full width on tablet */
  .edu-school-filter {
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* ============================================
   Mobile (<=640px)
   ============================================ */
@media (max-width: 640px) {
  .educational-module {
    padding: 10px;
  }

  .edu-search-input {
    padding: 10px 12px !important;
    font-size: 13px !important;
    width: 100%;
    box-sizing: border-box;
  }

  .edu-search {
    width: 100%;
    overflow: hidden;
  }

  .edu-title {
    font-size: 20px !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .edu-subtitle {
    font-size: 13px !important;
  }

  .edu-section {
    padding: 14px !important;
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 14px;
  }

  .edu-section h3 {
    font-size: 16px !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .edu-filters {
    width: 100%;
    gap: 6px;
  }

  .edu-filters button {
    padding: 5px 8px !important;
    font-size: 10px !important;
    flex: 1 1 calc(50% - 3px);
  }

  .capsule-card {
    min-width: 100% !important;
    max-width: 100% !important;
  }

  .capsule-media {
    height: 150px !important;
  }

  .capsule-card h4 {
    font-size: 14px !important;
  }

  .capsule-card p {
    font-size: 12px !important;
  }

  .material-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 14px !important;
  }

  .material-card > div:first-child {
    flex-direction: row !important;
    align-items: center !important;
    width: 100% !important;
  }

  .material-card > div:first-child > div:first-child {
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0;
  }

  .material-card > a,
  .material-card > a[href] {
    width: 100% !important;
    text-align: center;
    justify-content: center;
    padding: 12px 16px !important;
    font-size: 13px !important;
    box-sizing: border-box;
  }

  /* School filter */
  .edu-school-filter {
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* ============================================
   Very small screens (<=400px)
   ============================================ */
@media (max-width: 400px) {
  .educational-module {
    padding: 8px;
  }

  .edu-title {
    font-size: 18px !important;
  }

  .edu-section {
    padding: 10px !important;
    margin-bottom: 10px;
  }

  .edu-section h3 {
    font-size: 15px !important;
  }

  .edu-filters button {
    font-size: 9px !important;
    padding: 4px 6px !important;
  }

  .capsule-media {
    height: 130px !important;
  }
}
/* ============================================
   Paneles de centros escolares
   ============================================ */
.school-panel {
  transition: box-shadow 0.3s ease;
}

.school-panel:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.12) !important;
}

@media (max-width: 1100px) {
  .school-panel {
    margin-bottom: 20px;
  }
  
  .activity-card {
    min-width: 280px;
  }
}

@media (max-width: 900px) {
  .school-panel > div:first-child {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px !important;
    box-sizing: border-box !important;
  }
  
  .school-panel > div:first-child > div:first-child {
    margin-right: 0 !important;
    margin-bottom: 16px;
  }
  
  .school-panel > div:nth-child(2) {
    box-sizing: border-box !important;
  }
  
  .school-panel > div:nth-child(2) > div:nth-child(2) {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .activity-card {
    min-width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 640px) {
  .school-panel {
    border-radius: 8px !important;
    margin-bottom: 16px;
  }
  
  .school-panel > div:first-child {
    padding: 14px !important;
  }
  
  .school-panel > div:first-child h3 {
    font-size: 16px !important;
  }
  
  .school-panel > div:first-child p {
    font-size: 12px !important;
  }
  
  .school-panel > div:nth-child(2) {
    padding: 14px !important;
  }
  
  .school-panel > div:nth-child(2) h4 {
    font-size: 15px !important;
  }
  
  .activity-card {
    border-radius: 8px !important;
  }
  
  .activity-card h4 {
    font-size: 14px !important;
  }
  
  .activity-card p,
  .activity-card li {
    font-size: 12px !important;
  }
  
  .activity-card > div:first-child img,
  .activity-card > div:first-child > div {
    height: 130px !important;
  }
  
  .activity-card > div:nth-child(2) {
    padding: 10px !important;
  }
}

@media (max-width: 400px) {
  .school-panel > div:first-child h3 {
    font-size: 15px !important;
  }

  .activity-card h4 {
    font-size: 13px !important;
  }

  .activity-card > div:first-child img,
  .activity-card > div:first-child > div {
    height: 110px !important;
  }
}

/* ============================================
   School Modal — Mobile responsive
   ============================================ */

/* Modal content container */
[id*="school-modal"] > div:nth-child(2) {
  box-sizing: border-box;
}

/* Modal inner panel */
[id*="school-modal"] > div:nth-child(2) > div {
  box-sizing: border-box;
  width: 100%;
}

@media (max-width: 900px) {
  /* Reduce modal outer padding */
  [id*="school-modal"] > div:nth-child(2) {
    padding: 20px 12px !important;
  }

  /* Allow modal to use more height */
  [id*="school-modal"] > div:nth-child(2) > div {
    max-height: 90vh !important;
    max-width: 100% !important;
    border-radius: 10px !important;
  }
}

@media (max-width: 640px) {
  /* Full-screen modal on mobile */
  [id*="school-modal"] > div:nth-child(2) {
    padding: 8px !important;
    align-items: flex-start !important;
  }

  [id*="school-modal"] > div:nth-child(2) > div {
    max-height: 92vh !important;
    max-width: 100% !important;
    border-radius: 8px !important;
    margin-top: 4px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }

  /* Close button - smaller on mobile */
  [id*="school-modal-close"] {
    top: 10px !important;
    right: 10px !important;
    width: 30px !important;
    height: 30px !important;
    font-size: 22px !important;
  }

  /* School panel header inside modal */
  .school-panel > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    padding: 14px !important;
    gap: 10px;
    box-sizing: border-box !important;
  }

  .school-panel > div:first-child > div:first-child {
    width: 60px !important;
    height: 60px !important;
    margin-right: 0 !important;
  }

  .school-panel > div:first-child > div:first-child img {
    width: 60px !important;
    height: 60px !important;
  }

  /* Activities section inside modal */
  .school-panel > div:nth-child(2) {
    padding: 14px !important;
    box-sizing: border-box !important;
  }

  .school-panel > div:nth-child(2) > div:nth-child(2) {
    gap: 12px !important;
    /* Override grid on mobile - single column */
    grid-template-columns: 1fr !important;
  }

  /* Activity cards inside modal - more compact */
  .activity-card {
    margin-bottom: 10px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .activity-card > div:nth-child(2) {
    padding: 12px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .activity-card h4 {
    font-size: 14px !important;
    margin-bottom: 6px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .activity-card p {
    font-size: 12px !important;
    margin-bottom: 6px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }

  .activity-card ul {
    padding-left: 18px !important;
    margin: 6px 0 !important;
    box-sizing: border-box !important;
  }

  .activity-card li {
    font-size: 11px !important;
    margin-bottom: 3px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
}

@media (max-width: 400px) {
  [id*="school-modal"] > div:nth-child(2) {
    padding: 4px !important;
  }

  [id*="school-modal"] > div:nth-child(2) > div {
    max-height: 94vh !important;
    border-radius: 6px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }

  /* Make everything even more compact on very small screens */
  .school-panel > div:first-child {
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  .school-panel > div:nth-child(2) {
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  .activity-card > div:nth-child(2) {
    padding: 10px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .activity-card h4 {
    font-size: 13px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .activity-card p,
  .activity-card li {
    font-size: 11px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
}