/**
 * Course Wizard — Mobile Premium
 * Breakpoint: ≤767px
 * Reescrito — v2
 */

/* ══════════════════════════════════════════
   MODAL FULL-SCREEN
   ══════════════════════════════════════════ */
@media (max-width: 767px) {
  #createCourseModal .modal-dialog {
    width: 100% !important; max-width: 100% !important;
    height: 100% !important; max-height: 100% !important;
    margin: 0 !important;
  }
  #createCourseModal .modal-content {
    width: 100vw !important; max-width: 100vw !important;
    height: 100dvh !important; max-height: 100dvh !important;
    border-radius: 0 !important; overflow: hidden !important;
    display: flex !important; flex-direction: column !important;
    margin: 0 !important;
  }
  #createCourseModal .modal-header {
    padding: 10px 16px !important; flex-shrink: 0 !important;
  }
  #createCourseModalTitle { font-size: 11px !important; }
  #courseFormContent.course-form-visible {
    flex: 1 !important; display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important; overflow: hidden !important;
  }
  #courseWizardWrapper { display: none !important; }
}

/* ══════════════════════════════════════════
   TEMPLATE SELECTOR — mobile
   ══════════════════════════════════════════ */
@media (max-width: 767px) {
  #courseTemplateSelector {
    padding: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  #courseTemplateSelector .tcard-grid,
  #courseTemplateSelector [class*="template-grid"],
  #courseTemplateSelector [class*="card-grid"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    padding: 14px !important;
  }
  #courseTemplateSelector .tcard,
  #courseTemplateSelector [class*="template-card"] {
    border-radius: 12px !important;
    padding: 18px 12px !important;
    min-height: 110px !important;
    touch-action: manipulation !important;
  }
}

/* ══════════════════════════════════════════
   TOKENS
   ══════════════════════════════════════════ */
#cwmWrapper {
  --cw-ink:      #0d0d0d;
  --cw-accent:   #e8ff47;
  --cw-muted:    #7a7570;
  --cw-rule:     rgba(13,13,13,.09);
  --cw-error:    #e53e3e;
  --cw-green:    #22c55e;
  --cw-blue:     #3b82f6;
  --cw-surface:  #f8f8f6;
  --cw-f-dis:    'DM Serif Display', Georgia, serif;
  --cw-f-mono:   'DM Mono', monospace;
  --cw-f-body:   'DM Sans', system-ui, sans-serif;
  --cw-ease:     cubic-bezier(.22,.68,0,1.2);
  --cw-speed:    .22s;
}

/* ══════════════════════════════════════════
   WRAPPER PRINCIPAL
   ══════════════════════════════════════════ */
#cwmWrapper {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; height: 100%;
  background: #fff; overflow: hidden;
  position: relative;
}

/* ══════════════════════════════════════════
   PROGRESS — linha + step indicator integrado
   ══════════════════════════════════════════ */
.cwm-top-bar {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--cw-rule);
  padding: 14px 18px 0;
}

/* Pills de navegação — clicáveis */
.cwm-pills-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 14px;
}
.cwm-pill {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(13,13,13,.12);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--cw-f-mono); font-size: 11px; font-weight: 700;
  color: var(--cw-muted);
  cursor: pointer; flex-shrink: 0;
  transition: all .3s var(--cw-ease);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.cwm-pill:active { transform: scale(.88); }
.cwm-pill.done {
  background: var(--cw-green); border-color: var(--cw-green);
  color: #fff; font-size: 13px; /* ✓ */
}
.cwm-pill.active {
  background: var(--cw-ink); border-color: var(--cw-ink);
  color: #fff; transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(13,13,13,.25);
}
.cwm-pill-line {
  flex: 1; height: 2px;
  background: rgba(13,13,13,.08);
  margin: 0 4px; flex-shrink: 0;
  border-radius: 1px; overflow: hidden;
  position: relative;
}
.cwm-pill-line::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--cw-green); width: 0%;
  transition: width .4s var(--cw-ease);
}
.cwm-pill-line.done::after { width: 100%; }

/* Step header — compacto */
.cwm-step-header {
  padding-bottom: 14px;
}
.cwm-step-eyebrow {
  font-family: var(--cw-f-mono); font-size: 9px;
  font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--cw-muted);
  display: block; margin-bottom: 3px;
}
.cwm-step-title {
  font-family: var(--cw-f-dis); font-size: 20px;
  font-weight: 700; letter-spacing: -.025em;
  color: var(--cw-ink); line-height: 1.1; margin: 0;
}
.cwm-step-title em { font-style: italic; font-weight: 400; color: var(--cw-muted); }

/* ══════════════════════════════════════════
   PROGRESS BAR FINA — embaixo do top-bar
   ══════════════════════════════════════════ */
.cwm-progress-track {
  height: 2px; background: rgba(13,13,13,.06); flex-shrink: 0;
}
.cwm-progress-fill {
  height: 100%; background: var(--cw-ink); width: 0%;
  transition: width .45s var(--cw-ease);
}

/* ══════════════════════════════════════════
   CONTEÚDO SCROLLÁVEL
   ══════════════════════════════════════════ */
.cwm-content {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 20px 18px 28px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.cwm-content::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════════════
   PANELS — transição slide
   ══════════════════════════════════════════ */
.cwm-panel { display: none; }
.cwm-panel.active {
  display: block;
  animation: cwm-slide-in .2s var(--cw-ease) both;
}
.cwm-panel.prev-exit {
  animation: cwm-slide-out-left .18s ease both;
}
@keyframes cwm-slide-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes cwm-slide-in-reverse {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes cwm-slide-out-left {
  to { opacity: 0; transform: translateX(-12px); }
}
.cwm-panel.anim-back { animation: cwm-slide-in-reverse .2s var(--cw-ease) both; }

/* ══════════════════════════════════════════
   STEP CARD — envolve cada campo com visual
   ══════════════════════════════════════════ */
.cwm-step-card {
  background: var(--cw-surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.cwm-step-card:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════
   FORM FIELDS — touch-friendly premium
   ══════════════════════════════════════════ */
#cwmWrapper .form-group { margin-bottom: 0; }

#cwmWrapper .form-label {
  font-family: var(--cw-f-mono) !important;
  font-size: 10px !important; font-weight: 700 !important;
  letter-spacing: .1em !important; text-transform: uppercase !important;
  color: var(--cw-muted) !important;
  display: flex !important; align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 10px !important;
}

#cwmWrapper .form-control {
  border-radius: 8px !important;
  border: 2px solid rgba(13,13,13,.1) !important;
  font-family: var(--cw-f-body) !important;
  font-size: 16px !important;
  color: var(--cw-ink) !important;
  background: #fff !important;
  padding: 14px 15px !important;
  width: 100% !important; box-sizing: border-box !important;
  transition: border-color .2s, box-shadow .2s !important;
  -webkit-appearance: none !important; appearance: none !important;
  line-height: 1.5 !important;
}
#cwmWrapper .form-control:focus {
  border-color: var(--cw-ink) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(13,13,13,.06) !important;
}
#cwmWrapper .form-control::placeholder {
  color: rgba(13,13,13,.25) !important; font-size: 14px !important;
}
#cwmWrapper .form-control.error {
  border-color: var(--cw-error) !important;
  box-shadow: 0 0 0 3px rgba(229,62,62,.1) !important;
}
#cwmWrapper textarea.form-control {
  resize: none !important;
  min-height: 130px !important; line-height: 1.65 !important;
}

/* Char counter */
.cwm-char-counter {
  font-family: var(--cw-f-mono);
  font-size: 9px; color: var(--cw-muted); letter-spacing: .06em;
}
.cwm-char-counter.warn { color: var(--cw-error); }

/* ══════════════════════════════════════════
   PRICE CHIPS — seleção rápida
   ══════════════════════════════════════════ */
.cwm-price-chips {
  display: flex; gap: 8px; margin-bottom: 10px;
  flex-wrap: wrap;
}
.cwm-price-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(13,13,13,.15);
  background: #fff;
  font-family: var(--cw-f-body); font-size: 13px; font-weight: 600;
  color: var(--cw-muted); cursor: pointer;
  transition: all .2s var(--cw-ease);
  -webkit-tap-highlight-color: transparent;
}
.cwm-price-chip:active { transform: scale(.93); }
.cwm-price-chip.active {
  background: var(--cw-ink); border-color: var(--cw-ink);
  color: #fff; box-shadow: 0 2px 8px rgba(13,13,13,.2);
}

/* ══════════════════════════════════════════
   CATEGORIAS / INSTRUTORES — mobile override
   ══════════════════════════════════════════ */
#cwmWrapper .category-tags-input,
#cwmWrapper .instructor-select-input { position: relative; }

#cwmWrapper .selected-tags {
  border-radius: 8px !important;
  min-height: 52px !important;
  padding: 10px !important;
  background: var(--cw-surface) !important;
}

#cwmWrapper .tag {
  font-size: 13px !important; padding: 8px 12px !important;
  min-height: 36px !important; border-radius: 8px !important;
}
#cwmWrapper .tag-remove {
  width: 28px !important; height: 28px !important;
  font-size: 16px !important;
}

#cwmWrapper .search-input {
  font-size: 16px !important; border-radius: 8px !important;
  padding: 14px 44px 14px 16px !important; min-height: 50px !important;
  border: 2px solid rgba(13,13,13,.1) !important;
}
#cwmWrapper .search-input:focus {
  border-color: var(--cw-ink) !important;
  box-shadow: 0 0 0 3px rgba(13,13,13,.06) !important;
  outline: none !important;
}

/* Dropdown static no mobile */
#cwmWrapper .categories-dropdown {
  position: static !important;
  margin-top: 6px !important;
  border-radius: 8px !important;
  border: 1.5px solid rgba(13,13,13,.1) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,.08) !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  animation: cwm-slide-in .16s ease both !important;
}
#cwmWrapper .category-item {
  padding: 14px 16px !important; min-height: 52px !important;
  border-radius: 0 !important;
}
#cwmWrapper .category-item:active { background: var(--cw-surface) !important; }

/* ══════════════════════════════════════════
   DYNAMIC LIST (Objetivos) — premium touch
   ══════════════════════════════════════════ */
#cwmWrapper .list-item {
  background: #fff;
  border-radius: 10px;
  border: 1.5px solid rgba(13,13,13,.08);
  padding: 4px !important;
  margin-bottom: 10px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
#cwmWrapper .item-input {
  font-size: 16px !important; padding: 12px 14px !important;
  min-height: 48px !important; border-radius: 8px !important;
  border: none !important; background: transparent !important;
}
#cwmWrapper .item-input:focus { box-shadow: none !important; }
#cwmWrapper .remove-item-btn {
  width: 44px !important; height: 44px !important;
  flex-shrink: 0 !important; border-radius: 8px !important;
  font-size: 14px !important;
}
#cwmWrapper .drag-handle { display: none !important; }
#cwmWrapper .add-item-btn {
  font-size: 15px !important; padding: 15px !important;
  min-height: 52px !important; border-radius: 10px !important;
  border: 2px dashed rgba(13,13,13,.15) !important;
}

/* ══════════════════════════════════════════
   IMAGE UPLOAD — mobile-first
   ══════════════════════════════════════════ */
#cwmWrapper .mode-switcher {
  width: 100% !important; margin-bottom: 14px !important;
}
#cwmWrapper .mode-btn {
  font-size: 14px !important; padding: 10px 16px !important;
  min-height: 44px !important; flex: 1 !important;
}
#cwmWrapper .url-input,
#cwmWrapper input[type="url"] {
  font-size: 16px !important; padding: 14px 15px !important;
  min-height: 50px !important; border-radius: 8px !important;
  border: 2px solid rgba(13,13,13,.1) !important;
  box-sizing: border-box !important; width: 100% !important;
}
#cwmWrapper .url-input:focus,
#cwmWrapper input[type="url"]:focus {
  border-color: var(--cw-ink) !important;
  box-shadow: 0 0 0 3px rgba(13,13,13,.06) !important;
  outline: none !important;
}
#cwmWrapper .upload-btn {
  padding: 24px 20px !important; min-height: 100px !important;
  border-radius: 10px !important; border: 2px dashed rgba(13,13,13,.15) !important;
}
#cwmWrapper .preview-container {
  margin-top: 14px !important;
  border-radius: 10px !important; overflow: hidden !important;
}

/* ══════════════════════════════════════════
   ERROS
   ══════════════════════════════════════════ */
#cwmWrapper .cw-field-error {
  font-family: var(--cw-f-mono); font-size: 10px;
  color: var(--cw-error); letter-spacing: .04em;
  margin-top: 8px; display: none;
  padding: 6px 10px; background: rgba(229,62,62,.08);
  border-radius: 6px; border-left: 3px solid var(--cw-error);
}
#cwmWrapper .cw-field-error.visible { display: block; }

/* ══════════════════════════════════════════
   FOOTER STICKY — botões premium
   ══════════════════════════════════════════ */
.cwm-footer {
  flex-shrink: 0;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--cw-rule);
  background: #fff;
  gap: 10px;
}
.cwm-footer-left { flex: 1; display: flex; align-items: center; }
.cwm-footer-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* Cancelar */
.cwm-btn-cancel {
  background: none; border: none;
  font-family: var(--cw-f-body); font-size: 13px; color: var(--cw-muted);
  cursor: pointer; padding: 10px 4px; min-height: 44px;
  letter-spacing: -.01em;
  -webkit-tap-highlight-color: transparent;
}
.cwm-btn-cancel:active { color: var(--cw-ink); }

/* Voltar */
.cwm-btn-back {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cw-surface); border: none;
  border-radius: 10px; color: var(--cw-ink);
  font-size: 18px; cursor: pointer; flex-shrink: 0;
  transition: background .2s, transform .2s var(--cw-ease);
  -webkit-tap-highlight-color: transparent;
}
.cwm-btn-back:active { transform: scale(.9); background: rgba(13,13,13,.1); }
.cwm-btn-back:disabled { opacity: .25; pointer-events: none; }

/* Continuar */
.cwm-btn-next {
  height: 44px; padding: 0 22px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cw-ink); color: #fff;
  border: none; border-radius: 10px;
  font-family: var(--cw-f-body); font-size: 14px; font-weight: 700;
  cursor: pointer; letter-spacing: -.02em;
  transition: transform .2s var(--cw-ease), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 12px rgba(13,13,13,.2);
}
.cwm-btn-next:active {
  transform: scale(.94);
  box-shadow: 0 1px 4px rgba(13,13,13,.15);
}

/* Criar Curso */
.cwm-btn-submit {
  height: 44px; padding: 0 22px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--cw-accent); color: var(--cw-ink);
  border: none; border-radius: 10px;
  font-family: var(--cw-f-body); font-size: 14px; font-weight: 800;
  cursor: pointer; letter-spacing: -.02em;
  transition: transform .2s var(--cw-ease), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 14px rgba(232,255,71,.5);
}
.cwm-btn-submit:active {
  transform: scale(.94);
  box-shadow: 0 1px 4px rgba(232,255,71,.3);
}
.cwm-btn-submit:disabled { opacity: .5; pointer-events: none; }

/* ══════════════════════════════════════════
   SWIPE HINT — mostra que dá pra deslizar
   ══════════════════════════════════════════ */
.cwm-swipe-hint {
  position: absolute; bottom: 70px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--cw-f-mono); font-size: 9px;
  color: rgba(13,13,13,.2); letter-spacing: .08em;
  text-transform: uppercase; pointer-events: none;
  animation: cwm-fade-hint 2s ease 1.5s both;
  white-space: nowrap;
}
@keyframes cwm-fade-hint {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ══════════════════════════════════════════
   STEP 1 — emoji big tap area
   ══════════════════════════════════════════ */
#cwmWrapper #newCourseEmoji.form-control {
  cursor: pointer !important;
  background: var(--cw-surface) !important;
  text-align: center !important;
  font-size: 28px !important;
  padding: 18px !important;
  border: 2px dashed rgba(13,13,13,.12) !important;
  color: var(--cw-ink) !important;
}

/* ══════════════════════════════════════════
   STEP 5 — preview full-width
   ══════════════════════════════════════════ */
#cwmWrapper #newCourseImageContainer img {
  border-radius: 8px !important;
}
