/* assets/css/content-builder.css */

/* Step 4: Lesson -> Questions */
.q4-wrap{
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}

@media (max-width: 980px){
  .q4-wrap{
    grid-template-columns: 1fr;
  }
}

.q4-list{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  padding: 10px;
  max-height: 420px;
  overflow: auto;
}

.q4-list::-webkit-scrollbar{
  width: 10px;
}

.q4-list::-webkit-scrollbar-thumb{
  background: #22314a;
  border-radius: 10px;
}

.q4-list::-webkit-scrollbar-track{
  background: transparent;
}

.qrow{
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  margin-bottom: 8px;
  transition: transform .06s ease, border-color .12s ease, background .12s ease;
}

.qrow:hover{
  transform: translateY(-1px);
  border-color: #2b3a55;
  background: #0c1526;
}

.qrow.active{
  border-color: rgba(22,163,74,.55);
  background: rgba(22,163,74,.07);
}

.qmeta{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qmeta .title{
  font-weight: 700;
  font-size: 13px;
}

.qmeta .sub{
  font-size: 12px;
  opacity: .75;
  line-height: 1.35;
}

.qright{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 110px;
}

.qform-card{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  padding: 12px;
}

.qform-card[disabled]{
  opacity: .55;
  pointer-events: none;
}

.qform-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.q4-help-text{
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Shared builder shell for Step 5 sections */
.builder-shell{
  border-radius: var(--radius-lg);
  padding: 16px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
}

.builder-shell-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.builder-title{
  font-weight: 700;
  font-size: 18px;
}

.builder-subtitle{
  opacity: .85;
  margin-top: 4px;
  color: var(--text-muted);
}

.builder-flash{
  display: none;
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
}

.builder-panel{
  border-radius: 14px;
  padding: 14px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.06);
}

.builder-panel-title{
  font-weight: 700;
}

.builder-label{
  display: block;
  font-size: 12px;
  opacity: .85;
  margin: 10px 0 6px;
}

.builder-help{
  font-size: 12px;
  opacity: .75;
  color: var(--text-muted);
}

.builder-tabs{
  display: flex;
  gap: 10px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.builder-item{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.20);
  margin-bottom: 8px;
}

.builder-item-main{
  flex: 1;
  min-width: 0;
}

.builder-item-title{
  font-weight: 700;
}

.builder-pill{
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  opacity: .9;
}

.builder-actions{
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.builder-hidden{
  display: none !important;
}

/* Shared search panels used by Step 5 modules */
.picker-search{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 12px;
  position: sticky;
  top: 16px;
  height: fit-content;
  overflow: hidden;
}

@media (max-width: 980px){
  .picker-search{
    position: static;
  }
}

.picker-title{
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
}

.picker-hint{
  opacity: .75;
  font-size: .92rem;
  margin: 6px 0 10px 0;
  color: var(--text-muted);
}

.picker-results{
  margin-top: 12px;
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding-right: 6px;
}

.picker-results::-webkit-scrollbar{
  width: 10px;
}

.picker-results::-webkit-scrollbar-thumb{
  background: #22314a;
  border-radius: 10px;
}

.picker-results::-webkit-scrollbar-track{
  background: transparent;
}

.picker-item{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-1);
  padding: 10px;
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.picker-meta{
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-item-title{
  font-weight: 900;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-item-tags{
  opacity: .78;
  font-size: .86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.picker-actions audio{
  width: 100%;
  max-width: 240px;
  height: 30px;
}

/* Shared 2-column module forms */
.module-form{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 14px;
}

.module-block{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-3);
  padding: 12px;
  margin-bottom: 12px;
}

.module-row-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 720px){
  .module-row-2{
    grid-template-columns: 1fr;
  }
}

.module-choice-list{
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.module-ok{
  background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.45);
  color: #bbf7d0;
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 900;
  display: inline-flex;
  width: fit-content;
}

/* Shared loading overlay alias for content builder cards */
.cb-loading{
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(10,15,30,.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  border-radius: var(--radius-lg);
}

.cb-loading-text{
  color: var(--danger);
  font-weight: 900;
  font-size: 1.05rem;
  animation: bump .9s ease-in-out infinite;
}

/* Shared highlights */
.answer-highlight{
  color: #ff4d4d;
  font-weight: 800;
}

.translation-highlight{
  color: #2ee56b;
  font-weight: 700;
}

/* ---------- WhatYouHear specific cleanup ---------- */
.wyh-grid{
  display:grid;
  grid-template-columns:minmax(420px, 520px) minmax(360px, 1fr);
  gap:16px;
  margin-top:16px;
  align-items:start;
}

@media (max-width:980px){
  .wyh-grid{
    grid-template-columns:1fr;
  }
}

.wyh-search{
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--surface-2);
  padding:12px;
  position:sticky;
  top:16px;
  height:fit-content;
  overflow:hidden;
}

@media (max-width:980px){
  .wyh-search{
    position:static;
  }
}

.wyh-results{
  margin-top:12px;
  display:grid;
  gap:10px;
  max-height:calc(100vh - 280px);
  overflow:auto;
  padding-right:6px;
}

.wyh-results::-webkit-scrollbar{
  width:10px;
}

.wyh-results::-webkit-scrollbar-thumb{
  background:#22314a;
  border-radius:10px;
}

.wyh-results::-webkit-scrollbar-track{
  background:transparent;
}

.wyh-item{
  width:100%;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface-1);
  padding:10px;
  display:grid;
  grid-template-columns:120px 1fr;
  gap:14px;
  align-items:start;
  overflow:hidden;
}

.wyh-thumb{
  width:120px;
  height:120px;
  border-radius:14px;
  object-fit:cover;
  border:1px solid var(--border);
  background:var(--surface-3);
  display:block;
}

.wyh-meta{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.wyh-title{
  font-weight:900;
  font-size:.95rem;
  line-height:1.25;
  word-break:break-word;
}

.wyh-tags{
  opacity:.82;
  font-size:.86rem;
  line-height:1.35;
  word-break:break-word;
}

.wyh-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
  margin-top:4px;
}

.wyh-actions audio{
  width:100%;
  max-width:260px;
  height:32px;
}

.wyh-use-btn{
  min-width:96px;
}

.wyh-selected-audio{
  width:100%;
  margin-top:8px;
}

.wyh-choice-list{
  display:grid;
  gap:8px;
  margin-top:10px;
}

/* ---------- ImageChoice specific cleanup ---------- */
.ic-grid{
  display:grid;
  gap:16px;
  grid-template-columns:minmax(420px, 520px) minmax(320px, 1fr) minmax(320px, 1fr);
  margin-top:16px;
  align-items:start;
}

@media (max-width:980px){
  .ic-grid{
    grid-template-columns:1fr;
  }
}

.ic-search{
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--surface-2);
  padding:12px;
  position:sticky;
  top:16px;
  height:fit-content;
  overflow:hidden;
}

@media (max-width:980px){
  .ic-search{
    position:static;
  }
}

.ic-results{
  margin-top:12px;
  display:grid;
  gap:10px;
  max-height:calc(100vh - 280px);
  overflow:auto;
  padding-right:6px;
}

.ic-results::-webkit-scrollbar{
  width:10px;
}

.ic-results::-webkit-scrollbar-thumb{
  background:#22314a;
  border-radius:10px;
}

.ic-results::-webkit-scrollbar-track{
  background:transparent;
}

.ic-item{
  width:100%;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface-1);
  padding:10px;
  display:grid;
  grid-template-columns:110px 1fr;
  gap:12px;
  align-items:start;
  overflow:hidden;
}

.ic-thumb{
  width:110px;
  height:110px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid var(--border);
  background:var(--surface-3);
  display:block;
}

.ic-meta{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.ic-title{
  font-weight:900;
  font-size:.95rem;
  line-height:1.25;
  word-break:break-word;
}

.ic-tags{
  opacity:.82;
  font-size:.86rem;
  line-height:1.35;
  word-break:break-word;
}

.ic-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.ic-actions audio{
  width:100%;
  max-width:240px;
  height:30px;
}

.ic-col-title{
  font-weight:800;
  opacity:.9;
  margin:8px 0;
}

.ic-slot-wrap{
  margin:8px 0 12px;
}

.ic-slot{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px;
  border:1px dashed var(--border);
  border-radius:14px;
  min-height:84px;
  cursor:pointer;
}

.ic-slot.image{
  position:relative;
}

.ic-slot .plus{
  width:140px;
  height:140px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:2px dashed var(--border-strong);
  border-radius:14px;
  font-size:40px;
  color:#93c5fd;
  user-select:none;
  flex:0 0 140px;
}

.ic-slot .thumb-25{
  width:140px;
  height:140px;
  object-fit:cover;
  border-radius:14px;
  display:none;
  border:1px solid var(--border);
  background:var(--surface-3);
  flex:0 0 140px;
}

.ic-slot-label{
  min-width:72px;
  opacity:.9;
}

.ic-slot.audio audio{
  flex:1 1 auto;
  min-width:0;
}

.ic-slot.pulse{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(37,99,235,.3);
}

.ic-slot.is-correct{
  border-color:#22c55e !important;
  box-shadow:0 0 0 3px rgba(34,197,94,.22);
}

.ic-correct-pill{
  position:absolute;
  top:10px;
  left:10px;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:.78rem;
  border:1px solid rgba(34,197,94,.35);
  background:rgba(34,197,94,.15);
  color:#bbf7d0;
  display:none;
  user-select:none;
  z-index:2;
}

.ic-correct-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:8px;
  opacity:.92;
  font-weight:800;
}

.ic-correct-row input{
  transform:scale(1.1);
}

.ic-tagbox{
  width:100%;
  margin-top:8px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--surface-3);
  color:var(--text);
  font-size:.92rem;
}