/* App Mode Simplified - Chỉ hiển thị khi cài đặt ra màn hình chính (PWA standalone) */

@media (display-mode: standalone), (display-mode: fullscreen) {
  /* Ẩn các phần rườm rà trên trang chủ */
  .management-section,
  .seo-block,
  #bxhPublic,
  .timeline-section,
  .floating-action-menu,
  .intro-badge,
  .intro-sub,
  p[style*="Cần tư vấn"],
  .hlx-cta-app,
  .license-selector,
  .header-actions .header-btn[title="Cài App"],
  .header-actions .header-btn[title="Cài đặt"] {
    display: none !important;
  }

  /* Hero sát lên + canh giữa */
  .intro-hero {
    padding: 14px 10px !important;
    margin: 4px 2px 2px !important;
    border-radius: 16px !important;
    text-align: center !important;
  }
  .intro-title {
    font-size: 1.35rem !important;
    margin: 0 0 10px !important;
    text-align: center !important;
  }
  .intro-sub {
    text-align: center !important;
  }
  .hlx-cta-row {
    justify-content: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Grid 4 phần thi — full ngang màn hình, sát lên, không bị che */
  .part-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 3px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    width: 100% !important;
    height: calc(100dvh - 260px) !important;
    max-height: 560px !important;
    min-height: 380px !important;
  }
  .part-card {
    min-height: 0 !important;
    height: 100% !important;
    padding: 14px 10px !important;
    border-radius: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    box-shadow: 0 5px 0 #e2e8f0, 0 8px 16px rgba(15,23,42,.1), inset 0 1px 0 rgba(255,255,255,.9) !important;
  }
  .part-card em {
    font-size: 14px !important;
    margin-bottom: 6px !important;
  }
  .part-card strong {
    font-size: 22px !important;
    margin-bottom: 4px !important;
  }
  .part-card span {
    font-size: 13.5px !important;
    line-height: 1.3 !important;
  }

  /* Mục Thành tích học tập */
  .achievements-section {
    margin: 8px 8px 20px !important;
  }
  .achievements-section .section-label {
    margin-bottom: 8px !important;
  }
  .achievement-card {
    background: #fff;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  }
  .pa-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }
  .pa-stat {
    flex: 1;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
  }
  .pa-stat .num {
    font-size: 20px;
    font-weight: 800;
    color: #0D47A1;
  }
  .pa-stat .lbl {
    font-size: 11px;
    color: #64748b;
  }
  .pa-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
  }
  .pa-item:last-child { border-bottom: none; }
  .pa-score-pass { color: #059669; font-weight: 700; }
  .pa-score-fail { color: #dc2626; font-weight: 700; }
  .pa-empty {
    text-align: center;
    padding: 20px 12px;
    color: #64748b;
  }
  .pa-empty a {
    display: inline-block;
    margin-top: 10px;
    background: #1565C0;
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
  }

  /* Ẩn heading và các phần không cần trong app */
  .part-heading,
  .path-section,
  #bxhPublic,
  .seo-block,
  .hlx-legal,
  footer,
  .hlxs-footer,
  #hlxs-footer-mount {
    display: none !important;
  }

  /* Bottom nav gọn hơn - 4 mục chính */
  nav.bottom-nav .bottom-nav-inner {
    justify-content: space-around !important;
  }
  nav.bottom-nav .nav-item:nth-child(4) { /* Thành tích */
    display: none !important;
  }
  nav.bottom-nav .nav-label {
    font-size: 11px !important;
  }

  /* Header gọn */
  .app-header, header {
    padding: 8px 12px !important;
  }
  .header-title, .logo-text {
    font-size: 15px !important;
  }

  /* Full ngang, sát lên */
  .main-content, .content-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 4px !important;
  }

  body {
    padding-bottom: 64px !important;
  }
}

/* Desktop: giao diện thi thử giống phần mềm Công An / GTVT */
@media (min-width: 1024px) {
  body.exam-active #examScreen {
    max-width: 1100px !important;
    margin: 20px auto !important;
    border: 2px solid #1e40af !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    background: #f8fafc !important;
  }
  body.exam-active .mp-top {
    background: linear-gradient(180deg, #1e40af, #1e3a8a) !important;
    color: white !important;
    padding: 12px 20px !important;
  }
  body.exam-active .question-area,
  body.exam-active .exam-content {
    font-size: 16px !important;
    line-height: 1.6 !important;
    padding: 24px !important;
  }
  body.exam-active .answer-option {
    padding: 14px 16px !important;
    margin: 8px 0 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 15px !important;
  }
  body.exam-active .answer-option:hover {
    background: #eff6ff !important;
    border-color: #3b82f6 !important;
  }
  body.exam-active .timer, .exam-timer {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #dc2626 !important;
  }
}
