/* components-3d.css: Duolingo 3D chunky buttons & toggles, Ruangguru badges/chips, */

/* 6. Buttons — Duolingo tactile 3D */
.btn {
  --bc: var(--green); --bd: var(--green-d); --bt: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 14px;
  background: var(--bc); color: var(--bt);
  border: 2px solid var(--bc); border-bottom: 4px solid var(--bd);
  font-weight: 800; font-size: 14.5px; line-height: 1.2; white-space: nowrap; user-select: none;
  transition: transform .08s ease, border-bottom-width .08s ease, margin .08s ease, filter .15s, background .15s;
  margin-bottom: 0;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.btn:disabled { cursor: not-allowed; --bc: #E5E7EB; --bd: #D1D5DB; --bt: #9CA3AF; filter: none; }
.btn-caps { text-transform: uppercase; letter-spacing: .06em; font-size: 14px; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 13px; border-radius: 12px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { min-height: 54px; padding: 12px 26px; font-size: 16px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 46px; }
.btn-icon.btn-sm { width: 38px; }
.btn-primary { --bc: var(--green); --bd: var(--green-d); }
.btn-sky { --bc: var(--sky); --bd: var(--sky-d); }
.btn-indigo { --bc: var(--indigo); --bd: var(--indigo-d); }
.btn-gold { --bc: var(--gold); --bd: var(--gold-d); }
.btn-orange { --bc: var(--orange); --bd: var(--orange-d); }
.btn-danger { --bc: var(--red); --bd: var(--red-d); }
.btn-tint { --bc: var(--c); --bd: var(--cd); }
.btn-white { --bc: #fff; --bd: var(--line-strong); --bt: var(--ink-2); border-color: var(--line); border-bottom-color: var(--line-strong); }
.btn-white:hover:not(:disabled) { background: var(--bg-soft); filter: none; }
.btn-soft { --bc: var(--cs); --bd: color-mix(in srgb, var(--c) 45%, transparent); --bt: var(--ct); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); min-height: 40px; padding: 8px 12px; }
.btn-ghost:hover:not(:disabled) { background: var(--slate-s); color: var(--ink); filter: none; }
.btn-ghost:active:not(:disabled) { transform: none; border-bottom-width: 4px; margin-bottom: 0; }

/* 7. Badges, chips, tags */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; background: var(--cs); color: var(--ct); font-size: 12px; font-weight: 800; line-height: 1.3; white-space: nowrap; }
.badge svg { width: 14px; height: 14px; }
.badge-solid { background: var(--c); color: #fff; }
.badge-outline { background: #fff; border: 2px solid var(--line); color: var(--ink-2); }
.badge-sq { border-radius: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; background: #fff; border: 2px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; transition: border-color .15s, background .15s, color .15s; }
.chip svg { width: 15px; height: 15px; }
.chip:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.chip.active { background: var(--cs); border-color: var(--c); color: var(--ct); }
.tag { display: inline-block; padding: 3px 9px; border-radius: 8px; background: var(--slate-s); color: var(--slate-t); font-size: 12px; font-weight: 700; }
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 2px solid var(--line); border-bottom-width: 3px; font-size: 11px; font-weight: 800; color: var(--muted); background: #fff; }

/* 8. Progress & data viz */
.prog { position: relative; height: 14px; border-radius: 99px; background: #E9EDF2; overflow: hidden; }
.prog > span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--c); transition: width .7s cubic-bezier(.2, .8, .2, 1); min-width: 0; }
.prog > span::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .35); }
.prog.sm { height: 10px; }
.prog.sm > span::after { top: 2px; height: 3px; left: 5px; right: 5px; }
.prog.xs { height: 6px; }
.prog.xs > span::after { display: none; }
.prog.gold > span { background: var(--gold); }
.prog.orange > span { background: var(--orange); }

.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }

.stat-card { padding: 20px; }
.stat-card .stat-value { font-family: var(--font-display); font-weight: 900; font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; }
.stat-card .stat-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.delta.up { background: var(--green-s); color: var(--green-t); }
.delta.down { background: var(--red-s); color: var(--red-t); }

/* Mastery bars (GO Expert) */
.mastery-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 54px; align-items: center; gap: 14px; padding: 10px 0; }
.mastery-row + .mastery-row { border-top: 2px dashed var(--line); }
.mastery-no { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; font-size: 14px; font-family: var(--font-display); background: var(--cs); color: var(--ct); }
.mastery-val { font-family: var(--font-display); font-weight: 900; font-size: 18px; text-align: right; }

/* Column chart */
.colchart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; align-items: end; height: 170px; padding-top: 22px; }
.colchart .col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.colchart .bar { position: relative; width: 100%; max-width: 38px; border-radius: 10px 10px 6px 6px; background: var(--gold-s); border-bottom: 4px solid color-mix(in srgb, var(--gold) 45%, transparent); transition: height .7s cubic-bezier(.2, .8, .2, 1); min-height: 8px; }
.colchart .bar.today { background: var(--gold); border-bottom-color: var(--gold-d); }
.colchart .bar .val { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 900; font-family: var(--font-display); color: var(--gold-t); white-space: nowrap; }
.colchart .day { font-size: 12px; font-weight: 800; color: var(--faint); }
.colchart .day.today { color: var(--ink); }

/* 9. Forms */
.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg-soft); font-size: 14.5px; font-weight: 600; color: var(--ink); outline: none; transition: border-color .15s, background .15s; }
.input:focus { border-color: var(--sky); background: #fff; }
.input::placeholder { color: var(--faint); font-weight: 500; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.label { display: block; font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 18px; height: 18px; }
.search .input { padding-left: 42px; }

/* 10. Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 800; font-size: 14px; color: var(--faint); white-space: nowrap; }
.tabs button svg { width: 18px; height: 18px; }
.tabs button:hover { color: var(--ink-2); }
.tabs button.active { color: var(--ct); }
.tabs button.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--c); }
.pills { display: inline-flex; flex-wrap: wrap; gap: 8px; }

/* 11. Quiz option — tombol 3D (A–E) */
.opt {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 12px 16px; min-height: 60px; border-radius: 16px;
  background: #fff; border: 2px solid var(--line); border-bottom-width: 4px;
  font-weight: 700; font-size: 15px; color: var(--ink-2); line-height: 1.45;
  transition: background .12s, border-color .12s, transform .08s, border-bottom-width .08s, margin .08s;
}
.opt:hover:not(:disabled) { background: var(--bg-soft); }
.opt:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.opt .key { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; border: 2px solid var(--line); font-family: var(--font-display); font-weight: 900; font-size: 15px; color: var(--muted); background: #fff; transition: inherit; }
.opt.selected { background: var(--sky-s); border-color: var(--sky); color: var(--sky-t); }
.opt.selected .key { border-color: var(--sky); background: var(--sky); color: #fff; }
.opt.correct { background: var(--green-50); border-color: var(--green); color: var(--green-t); }
.opt.correct .key { border-color: var(--green); background: var(--green); color: #fff; }
.opt.wrong { background: var(--red-s); border-color: var(--red); color: var(--red-t); animation: shake .4s; }
.opt.wrong .key { border-color: var(--red); background: var(--red); color: #fff; }
.opt.dim { opacity: .55; }
.opt:disabled { cursor: default; }

/* Feedback sheet (Duolingo) */
.feedback { border-radius: 16px; padding: 18px 20px; border: 2px solid; animation: sheetUp .32s cubic-bezier(.2, 1.1, .3, 1); }
.feedback.ok { background: var(--green-50); border-color: #A7F3D0; color: var(--green-t); }
.feedback.bad { background: #FEF2F2; border-color: #FECACA; color: var(--red-t); }
.feedback-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 900; font-size: 20px; }
.feedback-title .fb-ic { width: 38px; height: 38px; border-radius: 99px; display: grid; place-items: center; background: #fff; }

/* Step-by-step pembahasan (GO Expert) */
.steps { counter-reset: step; }
.step { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding-bottom: 14px; }
.step:last-child { padding-bottom: 0; }
.step::before { counter-increment: step; content: counter(step); width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 900; font-size: 13px; font-family: var(--font-display); position: relative; z-index: 1; }
.step::after { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.step:last-child::after { display: none; }
.step-body { padding-top: 4px; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.answer-box { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--green-50); border: 2px dashed #6EE7B7; color: var(--green-t); font-weight: 800; }

/* Timer (tryout) */
.timer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: var(--slate-s); border: 2px solid var(--line); font-family: var(--font-display); font-weight: 900; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.timer svg { width: 18px; height: 18px; color: var(--muted); }
.timer.warn { background: var(--red-s); border-color: #FECACA; color: var(--red-d); animation: tick 1s infinite; }
.timer.warn svg { color: var(--red-d); }

/* 12. Modal & toast */
body.modal-open { overflow: hidden !important; overscroll-behavior: none; }
.modal-wrap { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .54); animation: fadeIn .18s ease; overflow-y: auto; }
.modal { position: relative; width: 100%; max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border: 2px solid var(--line); border-radius: 24px; animation: popIn .3s cubic-bezier(.2, 1.15, .3, 1); }
.modal.sm { max-width: 440px; } .modal.md { max-width: 560px; } .modal.lg { max-width: 760px; } .modal.xl { max-width: 980px; }
.modal-wrap.closing { animation: fadeOut .18s ease forwards; }
.modal-wrap.closing .modal { animation: popOut .18s ease forwards; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 2px solid var(--line); }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 2px solid var(--line); display: flex; align-items: center; gap: 12px; }

.toast-root { position: fixed; z-index: 10020; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px; padding: 12px 16px; border-radius: 16px; background: #fff; border: 2px solid var(--line); border-bottom-width: 4px; animation: toastIn .3s cubic-bezier(.2, 1.15, .3, 1); }
.toast.out { animation: toastOut .25s ease forwards; }
.toast .ic-box { width: 38px; height: 38px; border-radius: 11px; }
.toast .ic-box svg { width: 20px; height: 20px; }
.float-xp { position: fixed; z-index: 10030; pointer-events: none; font-family: var(--font-display); font-weight: 900; font-size: 22px; color: var(--gold); -webkit-text-stroke: 1px var(--gold-d); animation: floatUp 1.3s ease-out forwards; }
#confetti { position: fixed; inset: 0; z-index: 10010; pointer-events: none; }

/* 13. Avatars */
.avatar { flex-shrink: 0; border-radius: 99px; display: grid; place-items: center; font-weight: 800; color: #fff; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.avatar-stack { display: flex; }
.avatar-stack > * + * { margin-left: -10px; }
.mascot { display: block; }

/* 3D Toggle switch (Duolingo) */
.toggle { position: relative; display: inline-flex; flex-shrink: 0; width: 58px; height: 34px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; border-radius: 99px; background: #E5E7EB; border: 2px solid #D1D5DB; border-bottom-width: 4px; transition: background .15s, border-color .15s; }
.toggle .thumb { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 99px; background: #fff; border: 2px solid #D1D5DB; transition: transform .18s cubic-bezier(.3, 1.4, .5, 1), border-color .15s; }
.toggle input:checked + .track { background: var(--green); border-color: var(--green-d); }
.toggle input:checked + .track + .thumb { transform: translateX(24px); border-color: var(--green-d); }
.toggle input:focus-visible + .track { outline: 3px solid var(--sky-s); outline-offset: 2px; }

/* Range slider */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 99px; background: #E9EDF2; outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 99px; background: #fff; border: 3px solid var(--c); box-shadow: 0 3px 0 var(--cd); cursor: pointer; }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 99px; background: #fff; border: 3px solid var(--c); cursor: pointer; }

/* Choice cards (pilih target / kelas) */
.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.choice { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px; border-radius: 14px; background: #fff; border: 2px solid var(--line); border-bottom-width: 4px; font-weight: 800; text-align: center; cursor: pointer; transition: background .12s, border-color .12s; }
.choice:hover { background: var(--bg-soft); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.active, .choice:has(input:checked) { background: var(--cs); border-color: var(--c); color: var(--ct); }
.choice small { font-size: 11.5px; font-weight: 700; color: var(--muted); }

/* Cloud status pill */
.cloud-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 800; white-space: nowrap; color: var(--muted); }
.cloud-pill .dot { width: 9px; height: 9px; border-radius: 99px; background: var(--faint); }
.cloud-pill.online { color: var(--green-t); border-color: #A7F3D0; background: var(--green-50); }
.cloud-pill.online .dot { background: var(--green); animation: livePulseG 2s infinite; }
.cloud-pill.local { color: var(--gold-t); border-color: #FDE68A; background: var(--gold-s); }
.cloud-pill.local .dot { background: var(--gold); }
.cloud-pill.checking .dot { background: var(--sky); animation: livePulseG 1s infinite; }
@keyframes livePulseG { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); } 70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

@media (max-width: 768px) {
  .input, select.input, .select, textarea { font-size: 16px !important; }
  .tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .btn { white-space: normal; text-align: center; }
  .badge { white-space: normal; max-width: 100%; }
  .modal-wrap { padding: 10px; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; }
  .q-text { font-size: 15.5px; }
  .opt { padding: 10px 12px; min-height: 52px; font-size: 14px; gap: 10px; }

  /* Full-Screen Avatar Studio & PDF Reader Modal di Mobile (<= 768px) */
  .modal-wrap.modal-wrap-fullscreen,
  .modal-wrap.modal-wrap-pdf {
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 0 !important;
    overflow: hidden;
    align-items: stretch;
    justify-items: stretch;
  }
  .modal.modal-avatar-studio,
  .modal.modal-textbook-reader,
  .modal.modal-pdf-reader {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
}
