.content-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
}

.content-subtitle {
  font-size: 1.25rem;
  color: #6c757d;
  font-weight: 400;
  line-height: 1.4;
}

.content-meta {
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 1rem;
}

.meta-items {
  font-size: 0.95rem;
  color: #6c757d;
}

.meta-item {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.content-actions .btn {
  border-radius: 20px;
}

.fav-btn.active {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

.video-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.content-html {
  font-size: 1.1rem;
  line-height: 1.7;
}

.content-html h1, .content-html h2, .content-html h3 {
  color: #2c3e50;
  margin: 1.5rem 0 1rem;
}

.content-html p {
  margin-bottom: 1.2rem;
}

.content-html ul, .content-html ol {
  margin-bottom: 1.2rem;
  padding-left: 2rem;
}

.resource-item {
  height: 120px;
}

.resource-item .btn {
  transition: all 0.3s ease;
  border-width: 2px;
  border-style: dashed;
}

.resource-item .btn:hover {
  border-style: solid;
  transform: translateY(-2px);
}

.resource-content {
  text-align: center;
  padding: 0.5rem;
}

.resource-title {
  font-size: 0.9rem;
}

.related-item {
  border-bottom: 1px solid #f8f9fa;
  transition: background-color 0.3s ease;
}

.related-item:last-child {
  border-bottom: none;
}

.related-item:hover {
  background-color: #f8f9fa;
}

.related-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.related-title {
  font-size: 0.9rem;
  color: #2c3e50;
  line-height: 1.3;
}

.related-subtitle {
  font-size: 0.8rem;
  color: #6c757d;
  line-height: 1.2;
}

.breadcrumb {
  background: none;
  padding: 0;
}

.breadcrumb-item a {
  color: #6c757d;
}

.breadcrumb-item a:hover {
  color: #007bff;
}

.card {
  border-radius: 12px;
}

.card-header {
  border-radius: 12px 12px 0 0 !important;
}

.social-share .btn {
  border-radius: 20px;
}

@media (max-width: 768px) {
  .content-title {
    font-size: 2rem;
  }
  
  .content-subtitle {
    font-size: 1.1rem;
  }
  
  .meta-items {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }
  
  .content-actions {
    margin-top: 1rem;
  }
  
  .resource-item {
    height: auto;
    min-height: 100px;
  }
}

.contenido-detalle .resource-item {
    background: none;
}

.contenido-detalle .fav-btn {
    margin: 0;
    margin-right: 24px!important;
    font-size: 13px;
}

/* =========================================================
   MODAL LÍMITE DE DESCARGAS — Estilo "Sala Musical Premium"
   ========================================================= */
#quotaModal .modal-content {
  border: none;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
  background: linear-gradient(145deg, #fffdf6 0%, #fefaf0 40%, #ffffff 100%);
  animation: modalPop 0.45s cubic-bezier(.18, .89, .32, 1.28);
}

#quotaModal .modal-header {
  border: none;
  background: linear-gradient(135deg, #ffe066, #ffc107);
  color: #222;
  padding: 1.25rem 1.5rem;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

#quotaModal .modal-header .modal-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

#quotaModal .modal-body {
  background: radial-gradient(circle at top, #fff9e6, #ffffff 80%);
  color: #343a40;
}

#quotaModal .modal-body i.fa-download {
  animation: bounceDown 1.2s infinite ease-in-out;
  color: #ffc107;
  filter: drop-shadow(0 3px 5px rgba(255, 193, 7, 0.35));
}

#quotaModal h4.fw-bold {
  font-size: 1.5rem;
  color: #212529;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

#quotaModal .alert-info {
  border: none;
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  border-radius: 12px;
  color: #0c4a6e;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.1);
}

#quotaModal .modal-footer {
  border: none;
  background: #fffdf6;
  padding-top: 0;
}

#quotaModal .btn-warning {
  background: linear-gradient(135deg, #ffc107, #ffb300);
  color: #222;
  border: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#quotaModal .btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 193, 7, 0.6);
}

#quotaModal .btn-secondary {
  border-radius: 999px;
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  background: #e9ecef;
  border: none;
  transition: all 0.2s ease;
}

#quotaModal .btn-secondary:hover {
  background: #dee2e6;
}

/* Tiempo restante destacado */
#quotaModal #quota-time {
  font-weight: 700;
  font-size: 1.15rem;
  color: #0d6efd;
  animation: pulseTime 1.4s ease-in-out infinite;
}

/* ---------- Animaciones ---------- */
@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@keyframes pulseTime {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Breadcrumb pequeño para categorías */
.breadcrumb-sm {
  font-size: 0.875rem;
  padding: 0.5rem 0;
  background: transparent;
}

.breadcrumb-sm .breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #6c757d;
}

/* Meta bar responsive */
.content-meta-bar {
  gap: 0.5rem !important;
}

@media (max-width: 768px) {
  .content-meta-bar {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .content-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  .meta-tags {
    width: 100%;
  }
}

/* Badges mejorados */
.badge {
  font-weight: 500;
  transition: all 0.2s ease;
}

.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Tags de categorías con hover */
.content-tags .badge:hover {
  background: var(--bs-primary) !important;
  color: white !important;
  border-color: var(--bs-primary) !important;
}

/* Sidebar categorías hover */
.card-body a.bg-primary-subtle:hover {
  background: #5533c1 !important;
}

.card-body a.bg-primary-subtle:hover * {
  color: white !important;
}

/* Rating block mejorado */
.rating-block {
  padding: 1rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
}

.rating-stars {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  justify-content: center;
}

.rating-stars .star {
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  color: #ddd;
  line-height: 1;
}

.rating-stars .star.active {
  color: #ffc107;
  text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.rating-stars .star:hover,
.rating-stars .star:focus {
  transform: scale(1.2);
}

.rating-meta {
  text-align: center;
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
}

/* Creador info mejorado */
.creator-card-enhanced {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.3s;
}

.creator-card-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.creator-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  object-fit: cover;
}











/* ============================================
   MOBILE OPTIMIZATIONS - EDITOR CONTENIDO
   Diseño responsive sin romper desktop
   ============================================ */

/* ========== CONTAINER Y HEADER ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .editor-container {
    padding: 1rem 0.75rem;
    margin-top: 80px; /* ajuste para header sticky */
  }

  body.editor-contenido .editor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
  }

  body.editor-contenido .editor-title {
    font-size: 1.35rem;
  }

  body.editor-contenido .editor-header > div:last-child {
    width: 100%;
  }

  body.editor-contenido .editor-header .d-flex.gap-2 {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  body.editor-contenido .editor-header .btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .editor-container {
    padding: 0.75rem 0.5rem;
    margin-top: 70px;
  }

  body.editor-contenido .editor-title {
    font-size: 1.2rem;
  }

  body.editor-contenido .editor-title i {
    font-size: 1.1rem;
  }

  body.editor-contenido .editor-header .btn {
    font-size: 0.8rem;
    padding: 0.45rem 0.65rem;
    place-content: center;
    /* padding:  5px; */
  }
}

/* ========== FORM SECTIONS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .form-section {
    padding: 1.25rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 10px;
  }

  body.editor-contenido .form-section-title {
    font-size: 1rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.4rem;
  }

  body.editor-contenido .form-section-title i {
    font-size: 1rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .form-section {
    padding: 1rem 0.75rem;
    margin-bottom: 1rem;
    border-radius: 8px;
  }

  body.editor-contenido .form-section-title {
    font-size: 0.95rem;
    gap: 0.4rem;
  }
}

/* ========== INFO BOXES & ALERTS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .info-box {
    padding: 0.85rem;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
  }

  body.editor-contenido .alert {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .info-box {
    padding: 0.75rem;
    font-size: 0.85rem;
  }

  body.editor-contenido .alert {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
}

/* ========== FORM CONTROLS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .form-control,
  body.editor-contenido .form-select {
    font-size: 0.95rem;
    padding: 0.65rem 0.75rem;
  }

  body.editor-contenido .form-control-lg {
    font-size: 1rem;
    padding: 0.75rem 0.85rem;
  }

  body.editor-contenido .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  body.editor-contenido .form-text,
  body.editor-contenido small {
    font-size: 0.8rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .form-control,
  body.editor-contenido .form-select {
    font-size: 0.9rem;
    padding: 0.6rem 0.7rem;
  }

  body.editor-contenido .form-control-lg {
    font-size: 0.95rem;
    padding: 0.7rem 0.75rem;
  }

  body.editor-contenido .form-label {
    font-size: 0.85rem;
  }

  body.editor-contenido .form-text,
  body.editor-contenido small {
    font-size: 0.75rem;
  }
}

/* ========== QUILL EDITOR ========== */
@media (max-width: 991.98px) {
  body.editor-contenido #editor-container {
    height: 300px;
  }

  body.editor-contenido .ql-toolbar {
    padding: 0.5rem;
  }

  body.editor-contenido .ql-toolbar button {
    width: 32px;
    height: 32px;
  }

  body.editor-contenido .ql-editor {
    font-size: 0.95rem;
    padding: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido #editor-container {
    height: 250px;
  }

  body.editor-contenido .ql-toolbar {
    padding: 0.4rem;
  }

  body.editor-contenido .ql-toolbar button {
    width: 28px;
    height: 28px;
    padding: 8px;
  }

  body.editor-contenido .ql-editor {
    font-size: 0.9rem;
    padding: 0.6rem;
  }
}

/* ========== CATEGORÍAS - LAYOUT MOBILE ========== */
@media (max-width: 991.98px) {
  /* Buscador de categorías */
  body.editor-contenido .category-search {
    position: relative;
    margin-bottom: 1rem;
  }

  body.editor-contenido .category-search input {
    width: 100%;
    padding: 0.65rem 0.75rem 0.65rem 2.5rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  body.editor-contenido .category-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.9rem;
  }

  /* Layout principal de categorías */
  body.editor-contenido .category-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  /* Lista principal: botones apilados */
  body.editor-contenido .category-main-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  body.editor-contenido .category-main-item {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
  }

  body.editor-contenido .category-main-item span {
    flex: 1;
    text-align: left;
  }

  body.editor-contenido .category-main-item small {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 400;
  }

  body.editor-contenido .category-main-item.is-active {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
  }

  body.editor-contenido .category-main-item.is-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
  }

  body.editor-contenido .category-main-item.is-primary small {
    color: rgba(255, 255, 255, 0.85);
  }

  /* Paneles de subcategorías */
  body.editor-contenido .category-sub-list {
    width: 100%;
  }

  body.editor-contenido .category-sub-panel {
    display: none;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
  }

  body.editor-contenido .category-sub-panel.is-visible {
    display: block;
  }

  /* Header del panel (checkbox padre + radio principal) */
  body.editor-contenido .sub-panel-header {
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 2px solid #e9ecef;
  }

  body.editor-contenido .parent-check-label {
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
  }

  body.editor-contenido .parent-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
  }

  body.editor-contenido .principal-toggle {
    padding: 0.25rem 0.65rem;
    background: #e9ecef;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
  }

  body.editor-contenido .principal-toggle input[type="radio"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
  }

  body.editor-contenido .principal-toggle:has(input:checked) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
  }

  /* Grid de subcategorías */
  body.editor-contenido .sub-panel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  body.editor-contenido .subcategory-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
  }

  body.editor-contenido .subcategory-chip input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
  }

  body.editor-contenido .subcategory-chip span {
    flex: 1;
  }

  body.editor-contenido .subcategory-chip:has(input:checked) {
    background: #e7f1ff;
    border-color: #0d6efd;
    font-weight: 600;
  }

  body.editor-contenido .subcategory-chip:hover {
    background: #f8f9fa;
    border-color: #0d6efd;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .category-search input {
    padding: 0.6rem 0.7rem 0.6rem 2.3rem;
    font-size: 0.85rem;
  }

  body.editor-contenido .category-main-item {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
  }

  body.editor-contenido .category-main-item small {
    font-size: 0.7rem;
  }

  body.editor-contenido .sub-panel-header {
    padding: 0.65rem;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }

  body.editor-contenido .parent-check-label {
    font-size: 0.9rem;
  }

  body.editor-contenido .principal-toggle {
    align-self: flex-end;
  }

  body.editor-contenido .subcategory-chip {
    padding: 0.6rem 0.7rem;
    font-size: 0.8rem;
  }
}

/* ========== ETIQUETAS (TAGS) ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .tags-container {
    padding: 0.65rem;
    min-height: 48px;
    gap: 0.4rem;
  }

  body.editor-contenido .tag-item {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
  }

  body.editor-contenido .tag-item .remove-tag {
    font-size: 1rem;
  }

  body.editor-contenido .tags-input {
    padding: 0.3rem;
    font-size: 0.9rem;
    min-width: 120px;
  }

  body.editor-contenido .tags-counter {
    font-size: 0.8rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .tags-container {
    padding: 0.6rem;
    gap: 0.35rem;
  }

  body.editor-contenido .tag-item {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
  }

  body.editor-contenido .tag-item .remove-tag {
    font-size: 0.95rem;
  }

  body.editor-contenido .tags-input {
    font-size: 0.85rem;
    min-width: 100px;
  }

  body.editor-contenido .tags-counter {
    font-size: 0.75rem;
  }
}

/* ========== NIVELES EDUCATIVOS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .niveles-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  body.editor-contenido .nivel-item {
    padding: 0.65rem 0.75rem;
    gap: 0.6rem;
  }

  body.editor-contenido .nivel-item input {
    width: 16px;
    height: 16px;
  }

  body.editor-contenido .nivel-item label {
    font-size: 0.9rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .niveles-grid {
    gap: 0.5rem;
  }

  body.editor-contenido .nivel-item {
    padding: 0.6rem 0.7rem;
  }

  body.editor-contenido .nivel-item label {
    font-size: 0.85rem;
  }
}

/* ========== ARCHIVOS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .files-list {
    gap: 0.65rem;
  }

  body.editor-contenido .file-item {
    padding: 0.85rem;
    border-radius: 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  body.editor-contenido .file-info {
    width: 100%;
    gap: 0.65rem;
  }

  body.editor-contenido .file-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  body.editor-contenido .file-name {
    font-size: 0.9rem;
    word-break: break-word;
  }

  body.editor-contenido .file-meta {
    font-size: 0.8rem;
  }

  body.editor-contenido .file-actions {
    width: 100%;
    justify-content: flex-end;
  }

  body.editor-contenido .file-actions .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .file-item {
    padding: 0.75rem;
  }

  body.editor-contenido .file-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  body.editor-contenido .file-name {
    font-size: 0.85rem;
  }

  body.editor-contenido .file-meta {
    font-size: 0.75rem;
  }

  body.editor-contenido .file-actions .btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }
}

/* ========== CHARACTER COUNTERS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .char-counter {
    font-size: 0.8rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .char-counter {
    font-size: 0.75rem;
  }

  body.editor-contenido .d-flex.justify-content-between {
    /* flex-direction: column; */
    gap: 0.25rem;
    /* align-items: flex-start !important; */
  }

  body.editor-contenido .char-counter {
    align-self: flex-end;
  }
}

/* ========== BOTONES DE ACCIÓN ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .form-section:last-child .d-flex {
    flex-direction: column;
    gap: 1rem !important;
  }

  body.editor-contenido .btn-save-primary {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
  }

  body.editor-contenido .form-section:last-child .btn {
    width: 100%;
    justify-content: center;
  }

  body.editor-contenido .form-section:last-child .d-flex.gap-2 {
    width: 100%;
    flex-direction: column;
    gap: 0.75rem !important;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .btn-save-primary {
    padding: 0.8rem 1.25rem;
    font-size: 0.9rem;
  }

  body.editor-contenido .form-section:last-child .btn {
    font-size: 0.85rem;
    padding: 0.65rem 1rem;
  }
}

/* ========== ROW & COLUMNS RESPONSIVE ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .row.g-3 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }

  body.editor-contenido .col-md-6 {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .row.g-3 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
  }
}

/* ========== MULTIMEDIA INPUTS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido input[type="url"],
  body.editor-contenido input[type="file"] {
    font-size: 0.9rem;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido input[type="url"],
  body.editor-contenido input[type="file"] {
    font-size: 0.85rem;
  }
}

/* ========== CONFIGURACIÓN AVANZADA (ADMIN) ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .form-section select.form-select {
    font-size: 0.9rem;
  }
}

/* ========== ACCESIBILIDAD TÁCTIL ========== */
@media (max-width: 991.98px) {
  /* Áreas de toque mínimas de 44x44px */
  body.editor-contenido button,
  body.editor-contenido .btn,
  body.editor-contenido input[type="checkbox"],
  body.editor-contenido input[type="radio"],
  body.editor-contenido .category-main-item,
  body.editor-contenido .subcategory-chip,
  body.editor-contenido .nivel-item {
    min-height: 44px;
  }

  body.editor-contenido .btn-close {
    min-width: 44px;
    min-height: 44px;
  }

  /* Estados táctiles mejorados */
  body.editor-contenido button:active,
  body.editor-contenido .btn:active {
    transform: scale(0.98);
  }
}

/* ========== SCROLL SUAVE EN MOBILE ========== */
@media (max-width: 991.98px) {
  body.editor-contenido {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  body.editor-contenido .category-main-list,
  body.editor-contenido .sub-panel-grid {
    -webkit-overflow-scrolling: touch;
  }
}

/* ========== OPTIMIZACIÓN DE PERFORMANCE ========== */
@media (max-width: 991.98px) {
  /* Reducir animaciones en móviles */
  body.editor-contenido .category-main-item,
  body.editor-contenido .subcategory-chip,
  body.editor-contenido .nivel-item,
  body.editor-contenido .file-item {
    transition-duration: 0.2s;
  }

  /* Optimizar renders */
  body.editor-contenido .category-sub-panel,
  body.editor-contenido .file-item,
  body.editor-contenido #editor-container {
    will-change: auto;
  }
}

/* ========== LANDSCAPE MOBILE ========== */
@media (max-width: 991.98px) and (orientation: landscape) {
  body.editor-contenido #editor-container {
    height: 200px;
  }

  body.editor-contenido .editor-container {
    margin-top: 70px;
  }

  /* Grid de subcategorías en 2 columnas en landscape */
  body.editor-contenido .sub-panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Niveles en 2 columnas */
  body.editor-contenido .niveles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== PANTALLAS EXTRA PEQUEÑAS (< 400px) ========== */
@media (max-width: 399.98px) {
  body.editor-contenido .editor-container {
    padding: 0.6rem 0.4rem;
  }

  body.editor-contenido .form-section {
    padding: 0.85rem 0.65rem;
    border-radius: 6px;
  }

  body.editor-contenido .form-section-title {
    font-size: 0.9rem;
  }

  body.editor-contenido .editor-title {
    font-size: 1.1rem;
  }

  body.editor-contenido .category-main-item,
  body.editor-contenido .subcategory-chip,
  body.editor-contenido .nivel-item {
    padding: 0.55rem 0.65rem;
    font-size: 0.8rem;
  }

  body.editor-contenido .btn-save-primary {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}

/* ========== DARK MODE SUPPORT (OPCIONAL) ========== */
@media (prefers-color-scheme: dark) and (max-width: 991.98px) {
  body.editor-contenido .form-section {
    /* background: #1a1a2e; */
    border-color: #2d2d44;
  }

  body.editor-contenido .category-main-item,
  body.editor-contenido .subcategory-chip,
  body.editor-contenido .nivel-item {
    background: #2d2d44;
    border-color: #3d3d55;
    color: #e9ecef;
  }

  body.editor-contenido .category-main-item.is-active,
  body.editor-contenido .subcategory-chip:has(input:checked) {
    background: #1e3a8a;
    border-color: #2563eb;
    color: white;
  }
}

/* ========== FIXED NOTIFICATIONS ========== */
@media (max-width: 991.98px) {
  body.editor-contenido .alert.position-fixed {
    top: 10px !important;
    right: 10px !important;
    left: 10px !important;
    min-width: auto !important;
    max-width: none !important;
    width: calc(100% - 20px) !important;
  }
}

@media (max-width: 575.98px) {
  body.editor-contenido .alert.position-fixed {
    font-size: 0.85rem;
    padding: 0.75rem;
  }
}

/* ========== LOADING OVERLAY ========== */
@media (max-width: 991.98px) {
  body.editor-contenido [style*="position: fixed"][style*="z-index: 9999"] div {
    font-size: 1.1rem !important;
  }

  body.editor-contenido [style*="position: fixed"][style*="z-index: 9999"] div:last-child {
    font-size: 0.85rem !important;
  }
}

/* ========== UTILITY OVERRIDES ESPECÍFICOS ========== */
@media (max-width: 991.98px) {
  /* Asegurar que d-flex en mobile se comporte bien */
  body.editor-contenido .form-section .d-flex.align-items-center {
    flex-wrap: wrap;
  }

  body.editor-contenido .form-section .d-flex.justify-content-between {
    gap: 0.5rem;
  }

  /* Gaps responsivos */
  body.editor-contenido .d-flex.gap-2 {
    gap: 0.5rem !important;
  }

  body.editor-contenido .d-flex.gap-3 {
    gap: 0.75rem !important;
  }
}

/* ========== PRINT STYLES ========== */
@media print {
  body.editor-contenido .editor-header .d-flex.gap-2,
  body.editor-contenido .btn-save-primary,
  body.editor-contenido .file-actions,
  body.editor-contenido .alert {
    display: none !important;
  }

  body.editor-contenido .form-section {
    break-inside: avoid;
  }
}

/* ========== MEJORAS ESPECÍFICAS PARA iOS ========== */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 991.98px) {
    body.editor-contenido input[type="text"],
    body.editor-contenido input[type="url"],
    body.editor-contenido textarea,
    body.editor-contenido select {
      font-size: 16px !important; /* Evita zoom en iOS */
    }

    body.editor-contenido .ql-editor {
      -webkit-overflow-scrolling: touch;
    }
  }
}

/* ========== ANIMACIÓN DE ENTRADA (OPCIONAL) ========== */
@media (max-width: 991.98px) {

  .ql-toolbar.ql-snow .ql-formats {
    margin: 0!important;
}
  
  @keyframes slideInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  body.editor-contenido .form-section {
    animation: slideInUp 0.3s ease-out backwards;
  }

  body.editor-contenido .form-section:nth-child(1) { animation-delay: 0.05s; }
  body.editor-contenido .form-section:nth-child(2) { animation-delay: 0.1s; }
  body.editor-contenido .form-section:nth-child(3) { animation-delay: 0.15s; }
  body.editor-contenido .form-section:nth-child(4) { animation-delay: 0.2s; }
}

/* ========== ACCESIBILIDAD - REDUCE MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  body.editor-contenido * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

