/* ==========================================================================
   ADMIN CONSOLE STYLES - TIMELINE & INTERACTION TUNER
   ========================================================================== */

.admin-layout {
  padding: 2rem 0 4rem;
}

.admin-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header-left h1 {
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-header-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

@media (min-width: 900px) {
  .admin-header-actions {
    flex-direction: row;
    align-items: center;
    width: auto;
    gap: 0.75rem;
  }
}

.admin-actions-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  width: 100%;
}

@media (min-width: 900px) {
  .admin-actions-group {
    display: flex;
    align-items: center;
    width: auto;
    gap: 0.5rem;
  }
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: var(--transition-normal);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  min-height: 42px;
}

.btn-admin:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn-admin-primary {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
}

.btn-admin-primary:hover {
  background: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

.btn-admin-save {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-admin-save:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-admin-danger {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.1);
}

.btn-admin-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-admin-reset {
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.15);
}

@media (max-width: 899px) {
  .btn-admin-full {
    grid-column: span 2;
  }
}

/* Scenario Tabs in Admin - Horizontal Scroll with No Wrap */
.scenario-nav-tabs {
  display: flex;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
  padding: 0.25rem 0.25rem 0.75rem 0.25rem;
  margin-bottom: 1.75rem;
}

.scenario-nav-tabs::-webkit-scrollbar {
  display: none;
}

.scenario-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: var(--transition-normal);
}

.scenario-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.scenario-tab-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.btn-add-scenario-tab {
  background: rgba(99, 102, 241, 0.12);
  border: 1px dashed rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: var(--transition-normal);
}

.btn-add-scenario-tab:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Admin Grid */
.admin-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 960px) {
  .admin-grid-2col {
    grid-template-columns: 1fr;
  }
}

.admin-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Form inputs */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-label span.req {
  color: var(--accent-rose);
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  transition: var(--transition-normal);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

textarea.form-control {
  resize: vertical;
  min-height: 70px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Timeline scrubber in Admin */
.admin-video-scrubber-box {
  background: #000;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-glass);
}

.admin-scrubber-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #080c14;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-scrubber-stage video,
.admin-scrubber-stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-scrubber-controls {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

#btnAdminPlayPause {
  flex-shrink: 0;
  min-width: 68px;
  height: 36px;
  padding: 0 0.65rem;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

#adminScrubberSlider {
  flex: 1;
  min-width: 50px;
  height: 6px;
  margin: 0 !important;
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

#adminSliderTime {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

/* Checkpoint Accordion / Section */
.checkpoint-editor-card {
  border-left: 4px solid var(--theme-color, var(--accent-purple));
  position: relative;
}

.cp-badge-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-cp1 { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }
.badge-cp2 { background: rgba(244, 63, 94, 0.2); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.4); }

.timestamp-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-grab-time {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-normal);
}

.btn-grab-time:hover {
  background: rgba(99, 102, 241, 0.35);
}

/* Option inputs for Multiple Choice */
.mc-admin-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mc-admin-radio {
  cursor: pointer;
  accent-color: var(--accent-emerald);
  transform: scale(1.2);
  margin-left: 0.25rem;
}

.mc-admin-tag {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 20px;
}

/* Toast message notification */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-emerald);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}


/* ==========================================================================
   DYNAMIC CHECKPOINTS MANAGER & EMOJI PICKER STYLES
   ========================================================================== */

.emoji-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.emoji-input {
  width: 65px !important;
  text-align: center;
  font-size: 1.5rem !important;
  padding: 0.35rem !important;
}

.emoji-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.btn-emoji-quick {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-normal);
}

.btn-emoji-quick:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.15);
}

.checkpoints-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.checkpoints-actions-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-add-cp {
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
}

.cp-admin-card {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: var(--transition-normal);
}

.cp-admin-card.mc {
  border-left: 4px solid var(--accent-purple);
}

.cp-admin-card.speech {
  border-left: 4px solid var(--accent-rose);
}

.cp-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cp-admin-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cp-order-num {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-muted);
  width: 24px;
}

.cp-admin-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-cp-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition-normal);
}

.btn-cp-action:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-cp-delete {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-cp-delete:hover {
  background: rgba(244, 63, 94, 0.25);
}

.cp-admin-body {
  padding: 1.25rem;
}

/* ==========================================================================
   MOBILE RESPONSIVE RULES (Tràn màn hình, Không bị cắt tình huống)
   ========================================================================== */
.mobile-scenario-select-box {
  display: none;
}

@media (max-width: 900px) {
  .admin-layout {
    padding: 0.75rem 0.5rem 3rem 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .admin-header {
    margin-bottom: 1.25rem;
    gap: 0.85rem;
  }

  .admin-header-left h1 {
    font-size: 1.35rem;
    line-height: 1.3;
  }

  .admin-card {
    padding: 0.85rem !important;
    border-radius: 12px !important;
    margin-bottom: 0.85rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  }

  .admin-card-header {
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
  }

  .admin-card-title {
    font-size: 1rem;
  }

  .form-row-2col {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Scenario Tabs: Edge-to-Edge bleed with smooth scroll */
  .scenario-nav-tabs {
    margin: 0 -0.5rem 1rem -0.5rem !important;
    padding: 0.35rem 0.65rem 0.75rem 0.65rem !important;
    width: calc(100% + 1rem) !important;
    gap: 0.5rem !important;
  }

  .scenario-tab-btn {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
  }

  .btn-add-scenario-tab {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
  }

  /* Mobile Quick Dropdown Switcher */
  .mobile-scenario-select-box {
    display: flex !important;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.85rem;
  }

  .mobile-scenario-select-box label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #a5b4fc;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .mobile-scenario-select-box select {
    font-size: 16px !important; /* Safari prevent auto-zoom */
    padding: 0.55rem 0.75rem !important;
  }

  /* Admin Scrubber Stage & Controls */
  .admin-video-scrubber-box {
    padding: 0.65rem;
    border-radius: 10px;
  }

  /* Checkpoints Cards */
  .cp-admin-card {
    border-radius: 10px;
    margin-bottom: 0.85rem;
  }

  .cp-admin-header {
    padding: 0.65rem 0.85rem;
  }

  .cp-admin-body {
    padding: 0.85rem 0.75rem;
  }
}

/* ==========================================================================
   ADMIN PAGE ANIMATIONS (Smooth Entrance & Professional Feedback)
   ========================================================================== */
@keyframes adminHeaderFade {
  0% { opacity: 0; transform: translateY(-16px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes adminCardSlideIn {
  0% { opacity: 0; transform: translateY(18px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes cpCardEnter {
  0% { opacity: 0; transform: scale(0.96) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes saveButtonShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes toastSlideInTop {
  0% { opacity: 0; transform: translate(-50%, -20px) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes tabGlowActive {
  0%, 100% { box-shadow: 0 0 12px rgba(99, 102, 241, 0.35); }
  50% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.65); }
}

.admin-header {
  animation: adminHeaderFade 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scenario-nav-tabs {
  animation: adminCardSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.scenario-tab-btn.active {
  animation: tabGlowActive 3s infinite ease-in-out;
}

.admin-card {
  animation: adminCardSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cp-admin-card {
  animation: cpCardEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cp-admin-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 18px rgba(99, 102, 241, 0.25);
}

.btn-admin {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, background 0.15s ease;
}

.btn-admin:hover {
  transform: translateY(-2px);
}

.btn-admin:active {
  transform: scale(0.96);
}

.btn-admin-save {
  background-size: 200% 200%;
  animation: saveButtonShimmer 4s ease infinite;
}

.admin-toast {
  animation: toastSlideInTop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ==========================================================================
   ADMIN AUTH WALL / SECURITY GATEKEEPER
   ========================================================================== */
.admin-auth-wall {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

.wall-card {
  max-width: 520px;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: wallPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes wallPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.wall-icon-box {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(244, 63, 94, 0.25));
  border: 2px solid rgba(99, 102, 241, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  color: #a5b4fc;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
}

.wall-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wall-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.65rem;
  line-height: 1.3;
}

.wall-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

.wall-alert-box {
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
  font-size: 0.88rem;
  color: #fda4af;
  line-height: 1.5;
}

.wall-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-wall-primary {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn-wall-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6);
  color: #ffffff;
}

.btn-wall-secondary {
  width: 100%;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-wall-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-wall-warning {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(244, 63, 94, 0.4);
  transition: transform 0.15s ease;
}

.btn-wall-warning:hover {
  transform: translateY(-2px);
}
