/* frontend/css/mobile.css */
/* EUNHA PROJECT - 모바일 반응형 스타일 */

/* ===== Mobile Layout (max-width: 980px) ===== */
@media (max-width: 980px) {
  /* iOS/Chrome: prevent automatic zoom/scroll jump on focus */
  #textArea {
    font-size: 16px;
  }

  #pasteAnalyzeButton {
    flex: 1 1 180px;
  }

  /* Make the "current sentence + vocab" feel like one continuous block */
  body {
    padding-bottom: calc(86px + var(--safeBottom));
  }

  #app {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #inputPanel {
    margin-bottom: 12px;
  }

  #leftPanel {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  #rightPanel {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
  }

  #vocabScroll {
    max-height: none;
    -webkit-user-select: none;
    user-select: none;
  }

  #extrasPanel {
    display: block;
    margin-top: 12px;
  }

  /* Hide desktop-only navigation buttons on mobile */
  #navigation {
    display: none !important;
  }

  #prevButton,
  #nextButton {
    display: none !important;
  }

  #leftPanel #navigation {
    display: none;
  }

  #leftPanel #playButton {
    display: none;
  }

  #textDisplay {
    margin-bottom: 0;
  }

  /* On mobile, keep rightPanel as pure vocab table */
  #rightPanel #rightHeader {
    display: none;
  }

  #rightPanel #vocabStatus {
    display: none;
  }

  /* Extras panel: show moved header/status/toggles */
  #extrasPanel {
    display: block;
  }

  #extrasPanel #rightHeader,
  #extrasPanel #vocabStatus {
    display: block;
  }

  /* Footer */
  #siteFooter {
    padding-bottom: calc(100px + var(--safeBottom));
  }
  #siteFooter .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
  }
  #siteFooter .divider {
    display: none;
  }
}

/* ===== Unified Mobile Card Wrapper ===== */
#mobileCardWrap {
  border: 1px solid rgba(34,139,34,0.18);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

@media (max-width: 980px) {
  #mobileCardWrap {
    margin-bottom: 14px;
  }

  #mobileCardWrap #leftPanel,
  #mobileCardWrap #rightPanel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    margin: 0;
  }

  #mobileCardWrap #leftPanel {
    padding-bottom: 0;
  }

  #mobileCardWrap #rightPanel {
    padding-top: 0;
  }

  #mobileCardWrap #textDisplay {
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 0;
  }

  #mobileCardWrap #vocabScroll {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 1px solid rgba(34,139,34,0.12);
  }

  /* Ensure vocab area is not tinted green */
  #mobileCardWrap {
    background: #ffffff;
  }

  #mobileCardWrap #rightPanel {
    background: #ffffff;
  }

  #mobileCardWrap #vocabScroll {
    background: #ffffff;
  }
}

/* ===== Mobile Bottom Bar Background Fill ===== */
#mobileBottomBarFill {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--bg);
  display: none;
  z-index: 99998;
  pointer-events: none;
}

@media (max-width: 980px) {
  #mobileBottomBarFill {
    background: var(--bg) !important;
    margin-bottom: -100px;
    height: auto !important;
    min-height: 100px;
  }

  body::after {
    display: none !important;
  }

  html, body {
    background: var(--bg) !important;
  }
}

/* ===== Mobile Bottom Bar ===== */
#mobileBottomBar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px calc(10px + var(--safeBottom));
  padding-bottom: calc(10px + var(--safeBottom));
  min-height: 72px;
  height: auto;
  background: var(--bg);
  border-top: none;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  margin-bottom: -100px;
  padding-bottom: calc(110px + var(--safeBottom));
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 99999;
}

#mobileBottomBar .mbBtn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  border-radius: 16px;
  padding: 10px 12px;
  font-weight: 950;
  box-shadow: none;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--green);
  -webkit-tap-highlight-color: transparent;
}

#mobileBottomBar .mbBtnContent {
  display: flex;
  align-items: center;
  gap: 8px;
}

#mobileBottomBar .mbBtnIcon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#mobileBottomBar .mbBtnLabel {
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
}

/* Disabled look (mobile bottom bar) */
#mobileBottomBar .mbAriaDisabled .mbBtnLabel,
#mobileBottomBar .mbAriaDisabled .mbBtnIcon {
  opacity: 0.35;
}

/* Prev/Next: borderless "ghost" */
#mobileBottomBar .mbBtnGhost {
  border: none;
  background: transparent;
}

#mobileBottomBar .mbBtnGhost:active {
  transform: translateY(1px);
}

/* Play/Pause: circular primary */
#mobileBottomBar .mbBtnCircle {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  max-width: 56px;
  max-height: 56px;
  padding: 0;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0,0,0,0.10);
  display: grid;
  place-items: center;
  line-height: 0;
}

#mobileBottomBar .mbBtnCircle .mbBtnContent {
  display: flex;
  align-items: center;
  justify-content: center;
}

#mobileBottomBar .mbBtnCircle .mbBtnIcon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#mobileBottomBar .mbBtnCircle:active {
  transform: translateY(1px);
}

/* Disabled: do NOT gray the whole button */
#mobileBottomBar .mbBtn:disabled {
  opacity: 1;
  background: transparent !important;
}

#mobileBottomBar .mbBtn:disabled .mbBtnContent {
  opacity: 0.35;
}

/* ===== Mobile-only UI cleanup ===== */
@media (max-width: 980px) {
  #vocabMeta {
    display: none !important;
  }

  #rightHeader h3 {
    display: none !important;
  }

  #extrasPanel h3 {
    display: none !important;
  }

  .controlsRow {
    gap: 8px !important;
  }

  .toggleWrap {
    padding: 8px 10px !important;
  }

  .toggleWrap .desc {
    display: none !important;
  }
}

/* ===== Mobile Sentence Counter ===== */
@media (max-width: 980px) {
  .mobileCounterRow {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .mobileCounterRow .vocabLeftWrap {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
  }

  .mobileCounterRow .posRightWrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 84px;
  }

  .mobileCounterRow #position {
    margin: 0 !important;
    text-align: right !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    color: var(--muted) !important;
    padding: 6px 10px !important;
    border: 1px solid rgba(0,0,0,.08) !important;
    border-radius: 999px !important;
    background: #fff !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}
