/* ============================================
   Mon TOEIC Recorder UI v4.3 – eStudy Style
   ============================================ */

/* --- Prep Phase --- */
.prep-ui {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.prep-bubble {
  background: #eaf2ff;
  color: #2a66ff;
  font-size: 15px;
  font-weight: 500;
  border-radius: 30px;
  padding: 5px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  position: relative;
}
.prep-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #eaf2ff transparent transparent transparent;
}
.prep-box {
  background: linear-gradient(180deg, #fff 0%, #f6f8ff 100%);
  border: 1px solid rgba(180, 180, 180, 0.2);
  border-radius: 50px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.on-hold {
  font-size: 10px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
}
.on-hold .dot {
  width: 10px;
  height: 10px;
  background: #ccc;
  border-radius: 50%;
}
#mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3d84ff 0%, #2a69f7 100%);
  color: #fff;
  font-size: 15px;
  border: none;
  cursor: default;
  box-shadow: 0 4px 12px rgba(45, 118, 255, 0.25);
  transition: 0.3s;
}
#toeic-controls .prep-box .skip-btn {
  background: linear-gradient(180deg, #4c9fff 0%, #2979ff 100%);
  color: #fff;
  border-radius: 30px;
  padding: 10px 20px;
  border: none;
  box-shadow: 0 4px 12px rgba(41, 121, 255, 0.25);
  cursor: pointer;
  transition: 0.25s;
  font-size: 10px !important;
}
#toeic-controls .prep-box .skip-btn:hover {
  background: linear-gradient(180deg, #5bb1ff 0%, #358aff 100%);
}

/* --- Recording Phase --- */
.record-ui {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.record-tooltip {
  background: #eaf2ff;
  color: #2a66ff;
  font-size: 15px;
  font-weight: 500;
  border-radius: 30px;
  padding: 5px 14px;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.record-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #eaf2ff transparent transparent transparent;
}
.record-box {
  background: linear-gradient(180deg, #fff 0%, #f6f8ff 100%);
  border: 1px solid rgba(180, 180, 180, 0.2);
  border-radius: 50px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.record-left,
.record-right {
  font-size: 15px;
  color: #333;
  font-weight: 500;
}
.record-right span {
  color: #2a66ff;
  font-weight: 600;
}
.record-dot {
  width: 10px;
  height: 10px;
  background: #ff4d4f;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
#record-tooltip .record-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4c9fff 0%, #2979ff 100%);
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(41, 121, 255, 0.25);
  transition: 0.25s;
}
#record-tooltip .record-btn:hover {
  background: linear-gradient(180deg, #5bb1ff 0%, #358aff 100%);
}
#record-tooltip .record-btn.recording {
  background: linear-gradient(180deg, #ff4d4f 0%, #ff6f61 100%);
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;       /* màu icon */
}

.icon-btn svg {
  width: 25px;
  height: 25px;
}

.icon-btn svg path {
  fill: currentColor;
}

/* Nút icon giữa (stop/pause/done) */
#record-toggle.record-btn{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 0;
  line-height: 0;

  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}


/* Trạng thái đang ghi: nút đỏ */
#record-toggle.recording{
  background: #ff3b30;
  color: #fff;
}

#record-toggle.recording .icon-stop rect{
  width: 10px;
  height: 10px;
  x: 7;
  y: 7;
  rx: 2;
}


/* Icon SVG */
#record-toggle svg{
  width: 16px;
  height: 16px;
  display: block;
}

/* Rect/path theo currentColor */
#record-toggle svg rect,
#record-toggle svg path{
  fill: currentColor;
}

/* === EXAM TIMER (Trên cùng khung bài) === */
#toeic-timer-bar {
  position: absolute;
  top: 10px;
  left: 92%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  padding: 4px 12px;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 500;
  color: #444;
  font-size: 16px;
  display: none; /* 🛠 mặc định ẩn */
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  z-index: 20;
  min-width: 120px;
  transition: all 0.25s ease;
}
#toeic-timer-bar.recording {
  border-color: #ff4d4f;
  background: #fff5f5;
  color: #c30000;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.25);
}
#toeic-timer-icon {
  font-size: 18px;
  color: #666;
  transition: 0.25s;
}
#toeic-timer-bar.recording #toeic-timer-icon {
  color: #ff3333;
}

/* === CONTROLS AREA (Bottom of frame) === */
#toeic-controls {
  display: none; /* 🛠 JS sẽ bật */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 999;
  min-width: 500px;
}

/* === After Record === */
#after-record {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  border: 1px solid rgba(180, 180, 180, 0.2);
  border-radius: 50px;
  padding: 10px 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  min-width: 300px;
  transition: 0.3s ease;
  position: relative;
  z-index: 10000;
  pointer-events: auto;
}

#btn-retry, #btn-listen, #btn-next {
  border-radius: 30px;
  padding: 10px 18px;
  font-size: 10px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  transition: 0.25s ease;
}
#btn-retry {
  background: #f3f4f7;
  color: #333;
}
#btn-retry:hover { background: #e5e6ea; }
#btn-listen {
  background: linear-gradient(180deg, #4c9fff 0%, #2979ff 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(41, 121, 255, 0.25);
}
#btn-listen:hover {
  background: linear-gradient(180deg, #5bb1ff 0%, #358aff 100%);
}
#btn-next {
  display:none;
  background: linear-gradient(180deg, #3dbb68 0%, #1ea854 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(30, 168, 84, 0.25);
}
#btn-next:hover {
  background: linear-gradient(180deg, #4bd97a 0%, #27b965 100%);
}

/* Đồng hồ đỏ cảnh báo */
.prep-warning {
    color: #e11d48 !important;
    font-weight: bold;
    animation: toeicBlink 1s infinite;
}

@keyframes toeicBlink {
    0% { opacity: 1; }
    50% { opacity: .3; }
    100% { opacity: 1; }
}

/* Progress bar 5 giây cuối */
#toeic-prep-progress {
    height: 5px;
    width: 100%;
    background-color: #22c55e; /* xanh khi > 5s */
    margin-top: 6px;
    transition: width 1s linear, background-color .3s ease;
}

#toeic-prep-progress.warning {
    background-color: #facc15 !important; /* vàng */
}

#toeic-prep-progress.danger {
    background-color: #e11d48 !important; /* đỏ */
}
/* --- Qtitle --- */
.toeic-qtitle-wrap {
    display: inline-flex;     /* inline để ô không kéo dài full width */
    align-items: center;
    gap: 6px;                 /* khoảng cách giữa chữ và icon */
}

#toeic-qtitle {
    margin: 0; /* tránh h2 bị nhảy xuống */
}

.listen-title-btn {
    cursor: pointer;
    font-size: 22px; /* chỉnh kích thước icon nếu muốn */
    line-height: 1;
}

/* ============================================
   TOEIC Question Pagination – Pro Center Style
   ============================================ */

.toeic-question-pagination {
  display: flex;
  justify-content: center;      /* căn giữa ngang */
  align-items: center;
  gap: 14px;

  margin: 22px auto 10px;       /* cách nội dung & controls */
  width: 100%;
  pointer-events: auto;
}

/* Nút số câu */
.toeic-q-page {
  width: 44px;
  height: 44px;
  border-radius: 50%;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: #f4f6f8;
  border: 1px solid #d6dae1;

  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #333;

  cursor: pointer;
  user-select: none;

  transition: 
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.15s ease;
}

/* Hover */
.toeic-q-page:hover {
  background: #e9edf3;
  transform: translateY(-1px);
}

/* Active (giống hình bạn gửi) */
.toeic-q-page.active {
  background: #ff4d4f;
  color: #fff;
  border-color: #ff4d4f;

  box-shadow:
    0 0 0 6px rgba(255, 77, 79, 0.18),
    0 6px 16px rgba(255, 77, 79, 0.35);

  transform: none;
  cursor: default;
}

/* Disable khi đang record (JS add class .is-locked) */
.toeic-question-pagination.is-locked .toeic-q-page {
  opacity: 0.45;
  pointer-events: none;
}


/* --- Mobile --- */
@media (max-width: 768px) {
  .toeic-tabs .tab {font-size:11px;}
  #toeic-controls {
    min-width: 100px;
  }
  #toeic-timer-bar {
  position: absolute;
  top: 20px;
  left: 80%;
  }
  .toeic-qtitle-wrap {width:100%;}
  .toeic-q-page {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .toeic-question-pagination {
    gap: 10px;
    margin: 18px auto 6px;
  }
}