/* ============================================================
   Learning player shell
   ============================================================ */

.learn-shell-head{
  position: sticky;
  top: 0;
  z-index: 1000;

  width: 100%;
  max-width: none;

  margin: 0 0 14px 0;
  padding: 14px clamp(12px, 3vw, 20px);

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  background:rgba(255,255,255,.7);
  backdrop-filter:blur(12px);
  
}

.learn-shell-head__main{
  flex:1 1 auto;
  min-width:0;
}

.learn-shell-head__left{
  min-width: 0;
  flex: 1 1 auto;
}

.learn-shell-head__actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

.learn-shell-head__title {
  margin: 2px 0 0;
  font-size: clamp(1.15rem, 3vw, 1.8rem);
  line-height: 1.15;
  color: var(--c-text-strong);
  overflow-wrap: anywhere;
}

.learn-shell-head__meta {
  margin-top: 4px;
  color: var(--c-muted);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.learn-sections-btn {
  flex: 0 0 auto;
}

.learn-player-exit{
  opacity:.82;
}

.learn-player-exit:hover{
  opacity:1;
}

.learn-shell {
  align-items: start;
}

.cp-learn-sidebar {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.cp-learn-content {
  min-width: 0;
  overflow: hidden;
}

.cp-learn-topbar {
  margin-bottom: 14px;
}

.cp-learn-topbar .cp-title {
  font-size: clamp(1.25rem, 4vw, 2rem);
  overflow-wrap: anywhere;
}

/* Mejor lectura del contenido */
.cp-stack {
  display: grid;
  gap: 18px;
}

.cp-course-block-anchor {
  scroll-margin-top: 96px;
}

/* Navegación inferior */
/* Navegación inferior */
.learn-section-nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:18px;
}

.learn-section-nav .btn{
  min-width:150px;
}

/* alineaciones */
.learn-section-nav--left{
  justify-content:flex-start;
}

.learn-section-nav--center{
  justify-content:center;
}

.learn-section-nav--right{
  justify-content:flex-end;
}

.learn-section-nav--between{
  justify-content:space-between;
}

/* ============================================================
   Mobile player
   ============================================================ */

@media (max-width: 899px){
  .learn-shell-head{
    margin:0 0 12px 0;
    padding:12px;
    border-radius:0;
  }

  .learn-shell-head__title {
    font-size: 1.12rem;
  }

  .learn-shell-head__meta {
    display: none;
  }

  .learn-sections-btn {
    min-height: 36px;
    padding: 8px 12px;
    font-size: .9rem;
  }

  .cp-grid--learn {
    grid-template-columns: 1fr;
  }

  .cp-learn-sidebar {
    display: none;
  }

  .cp-learn-content {
    padding: 14px;
    border-radius: 18px;
  }

  .cp-learn-topbar {
    margin-bottom: 12px;
  }

  .cp-learn-topbar .cp-title {
    font-size: 1.35rem;
  }

  .learn-section-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .learn-section-nav .btn {
    width: 100%;
  }
}

@media (min-width: 900px) {
  
  .cp-grid--learn {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .cp-learn-sidebar {
    display: block;
  }
}

/* Edición de blocks desde el playar.php */

.player-block {
  position: relative;
}

.player-block-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;

  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;

  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;

  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .12s ease, transform .12s ease;
}

.player-block:hover .player-block-edit,
.player-block:focus-within .player-block-edit {
  opacity: 1;
  transform: translateY(0);
}

.player-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.player-edit-modal.is-open {
  display: block;
}

.player-edit-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.55);
}

.player-edit-modal__panel {
  position: absolute;
  inset: 4vh 4vw;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(15,23,42,.28);
}

.player-edit-modal__head {
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--c-border);
}

.player-edit-modal__frame {
  width: 100%;
  flex: 1;
  border: 0;
  background: #fff;
}

@media (max-width: 700px) {
  .player-block-edit {
    opacity: 1;
  }

  .player-edit-modal__panel {
    inset: 0;
    border-radius: 0;
  }
}

.player-block-actions {
  display: flex !important;
  justify-content: flex-end !important;
  margin-bottom: 6px !important;
  opacity: 0.6;
  transition: opacity .2s ease;
}

.player-block:hover .player-block-actions {
  opacity: 1;
}

.cp-block__head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-divider);
}

.cp-block-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 750;
  color: var(--c-text-strong);
}

.cp-block-meta {
  margin: 6px 0 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-muted);
}

.cp-block__body > :first-child {
  margin-top: 0;
}

.cp-block__body h1,
.cp-block__body h2,
.cp-block__body h3 {
  margin-top: 1rem;
}

.player-block-toolbar{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  width:100%;
  margin:0 0 10px 0;
  flex-wrap:wrap;
}

/* Borrar block desde el player */

.player-block-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin-top:10px;
}

.player-block-toolbar .btn{
  border-radius:12px;
}

.player-block-toolbar .btn-danger{
  border-color:rgba(239,68,68,.35);
  color:#b42318;
}

.player-block-toolbar .btn-danger:hover{
  background:rgba(239,68,68,.08);
}

/* Alinear botón(es) a la derecha */
.cp-actions-end{
  display:flex !important;
  justify-content:flex-end !important;
  gap: var(--space-3);
}

/* -------------------------------- */
/* utilizadas por layout-player.php */
/* -------------------------------- */

.layout-player{
  background: var(--bg);
}

.player-layout{
  width: 100%;
  max-width: 90%;
  margin: 0 auto;

  padding-left: clamp(20px, 4vw, 56px);
  padding-right: clamp(20px, 4vw, 56px);

  padding-top: 18px;
  padding-bottom: 24px;
}

@media (max-width: 639px){
  .player-layout{
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 14px;
  }
}

.learn-shell-head__section{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:6px;
  color:var(--muted);
  line-height:1.35;
}

.learn-shell-head__section-kicker{
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
}

.learn-shell-head__section-title{
  font-size:1.2rem;
  font-weight:700;
  color:var(--muted);
}

@media (max-width:639px){
  .learn-shell-head__section{
    margin-top:4px;
    gap:6px;
  }

  .learn-shell-head__section-title{
    font-size:.86rem;
  }

  .learn-shell-head__section-kicker{
    font-size:.68rem;
  }
}

.learn-complete-form__row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
}

.learn-complete-form__help{
  flex:1;
  text-align:left;
}

@media (max-width:639px){
  .learn-complete-form__row{
    flex-direction:column;
    align-items:stretch;
  }

  .learn-complete-form__help{
    text-align:left;
  }

  .learn-complete-form__row .btn{
    width:100%;
  }
}

/* ============================================================
   Player header responsive
   - móvil: título en una fila, botones en filas independientes
   ============================================================ */

@media (max-width: 639px){
  .learn-shell-head{
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .learn-shell-head__left{
    width: 100%;
    min-width: 0;
  }

  .learn-shell-head__main{
    width: 100%;
    min-width: 0;
  }

  .learn-shell-head__actions{
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .learn-shell-head__actions .btn,
  .learn-shell-head__actions button{
    width: 100%;
    justify-content: center;
  }

  .learn-shell-head__title{
    width: 100%;
    max-width: 100%;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
  }

  .learn-shell-head__section{
    width: 100%;
  }

  .learn-shell-head__section-title{
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}