/* ==========================================================================
   Tien Mobile Design System - Studio Editorial Minimal
   Inspired by Apple (Việt Nam) & UI/UX Pro Max Guidelines
   ========================================================================== */

:root {
  /* Surface Tokens */
  --surface-base: #FFFFFF;
  --surface-secondary: #F5F5F7;
  --surface-variant: #E3E2E7;
  --surface-container-high: #E9E7ED;
  --surface-container-low: #F4F3F8;
  --surface-tint: #5F5E60;

  /* Ink / Text Tokens */
  --ink-primary: #1D1D1F;
  --ink-secondary: #6E6E73;
  --ink-muted: #86868B;
  --ink-inverted: #FFFFFF;

  /* Border Tokens */
  --border-hairline: #D2D2D7;
  --border-subtle: #E5E5EA;

  /* Accent & Action Tokens */
  --accent-blue: #0071E3;
  --accent-blue-hover: #005AB7;
  --accent-blue-tint: rgba(0, 113, 227, 0.08);
  --btn-primary-bg: #1D1D1F;
  --btn-primary-hover: #000000;
  
  /* Status Tokens */
  --status-success: #34C759;
  --status-warning: #FF9500;
  --status-error: #FF3B30;

  /* Typography Font Stacks */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-pill: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  color: var(--ink-primary);
  background-color: var(--surface-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  line-height: 1.5;
  background-color: var(--surface-base);
  color: var(--ink-primary);
  overflow-x: hidden;
}

/* Typography Presets */
.display-hero {
  font-size: clamp(32px, 8.2vw, 56px);
  text-wrap: balance;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink-primary);
}

.headline-lg {
  font-size: clamp(28px, 3.5vw, 36px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.headline-md {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
}

.headline-sm {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
}

.body-lg {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-secondary);
}

.body-md {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.body-sm {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.label-eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-secondary);
}

/* Components: Cards */
.info-card {
  background-color: var(--surface-base);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-normal);
}

.info-card:hover {
  border-color: var(--ink-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.product-card {
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 12px;
  min-width: 0; /* cho phép thẻ co lại trong lưới, tránh tràn ngang trên màn hình hẹp */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
}

@media (min-width: 640px) {
  .product-card { padding: 16px; }
}

/* Hiệu ứng hover chỉ cho thiết bị có chuột, tránh bị "kẹt" hover trên cảm ứng */
@media (hover: hover) {
  .product-card:hover {
    border-color: #8E8E93;
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
  }
}

/* Pill Buttons */
.btn-pill-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  background-color: var(--btn-primary-bg);
  color: var(--ink-inverted);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  text-decoration: none;
}

.btn-pill-primary:hover {
  background-color: var(--btn-primary-hover);
  transform: scale(1.02);
}

.btn-pill-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  background-color: transparent;
  color: var(--ink-primary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ink-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.btn-pill-secondary:hover {
  background-color: var(--surface-secondary);
}

/* Service Card */
.service-card {
  background-color: var(--surface-secondary);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background-color var(--transition-normal), transform var(--transition-normal);
  border: 1px solid transparent;
}

.service-card:hover {
  background-color: #EFEFEF;
  border-color: var(--border-hairline);
  transform: translateY(-2px);
}

/* Scrollbar Utility */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Swatches */
.swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1px var(--border-hairline);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.active {
  box-shadow: 0 0 0 2px var(--ink-primary);
}

/* Storage Chip */
.storage-chip {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
  background-color: transparent;
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.storage-chip:hover {
  border-color: var(--ink-primary);
}

.storage-chip.active {
  background-color: var(--ink-primary);
  color: var(--ink-inverted);
  border-color: var(--ink-primary);
}

/* Drawer & Modal Animations */
.modal-overlay {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity var(--transition-normal);
}

.drawer-panel {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.drawer-panel.open {
  opacity: 1;
  transform: none;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--ink-primary);
  color: var(--ink-inverted);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  animation: slideInToast 0.3s ease-out forwards;
  transition: opacity 0.25s, transform 0.25s;
}

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

/* ==========================================================================
   Tien Mobile - Subtle Frosted Apple Watermark Background & 18 Pro Max 3D Stage
   ========================================================================== */

/* 1. Subtle Frosted Apple Logo Background (Nền cân đối cho phần 'Điện thoại mới. Sửa xong trong ngày.') */
.hero-editorial-col {
  position: relative;
  overflow: visible;
}

.apple-bg-watermark {
  position: absolute;
  top: 48%;
  left: 40%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

@media (min-width: 1280px) {
  .apple-bg-watermark {
    width: 460px;
    height: 460px;
    top: 48%;
    left: 42%;
  }
}

@media (max-width: 1024px) {
  .apple-bg-watermark {
    top: 42%;
    left: 48%;
    width: 320px;
    height: 320px;
  }
}

.apple-watermark-svg {
  width: 100%;
  height: 100%;
  color: #1D1D1F;
  opacity: 0.088; /* Cân đối rõ nét, thanh lịch chuẩn mực Apple Studio (không bị quá chìm) */
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.025));
}

/* 1.2. Navigation Active Underline Indicator Bar (Thanh ngang dưới mục được chọn) */
.nav-layer-link {
  position: relative;
  cursor: pointer;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-active-bar {
  border-radius: 2px 2px 0 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3.5. Tranquil Studio Water Ripples Stage (1/3 màn dưới chuẩn ảnh mẫu) */
.water-ripples-stage {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 38%; /* Chiếm chuẩn 1/3 phần dưới màn hình */
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.95) 70%, rgba(0, 0, 0, 0) 100%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.95) 70%, rgba(0, 0, 0, 0) 100%);
}

#waterRipplesCanvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 4. 2-Layer Hero Stage: Hand Layer + 18 Pro Max 3D Layer */
.perspective-container {
  perspective: 1200px;
  transform-style: preserve-3d;
}

#phoneContainer3D {
  position: relative;
  min-height: 340px;
  width: 100%;
}
@media (min-width: 1024px) {
  #phoneContainer3D { min-height: 520px; }
}

/* LỚP 1: BÀN TAY XÒE ĐỠ TÁCH LỚP */
.hand-layer-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hand-open-image {
  max-height: 440px;
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  transform: rotate(-9deg) translate(28px, 18px);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.05));
  animation: handCornerCradleBreathe 7s ease-in-out infinite alternate;
  transform-origin: bottom center;
  will-change: transform;
}

@keyframes handCornerCradleBreathe {
  0% {
    transform: rotate(-9deg) translate(28px, 18px) scale(1);
  }
  50% {
    transform: rotate(-8deg) translate(28px, 24px) scale(0.995);
  }
  100% {
    transform: rotate(-10deg) translate(28px, 16px) scale(1.005);
  }
}

/* Bóng đổ tiếp xúc 3D chân thực lên lòng bàn tay */
.phone-contact-shadow {
  position: absolute;
  bottom: 145px;
  left: calc(50% - 60px);
  width: 140px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(40, 14, 20, 0.50) 0%, rgba(50, 18, 26, 0.22) 45%, transparent 75%);
  filter: blur(8px);
  pointer-events: none;
  transform-origin: center center;
  transition: transform 0.1s ease-out, opacity 0.1s ease-out;
  z-index: 11;
}

/* ==========================================================================
   Single-Layer App Architecture (Chuyển đổi từng layer độc lập)
   ========================================================================== */
.app-layer {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

.app-layer.active {
  display: block;
  opacity: 1;
  /* Phải là none: bất kỳ transform nào (kể cả translateY(0)) biến lớp thành khối chứa của phần tử position:fixed,
     làm danh sách chọn tùy biến (.cs-list) bị lệch khi trang đã cuộn. */
  transform: none;
}

.layer-tab-btn {
  background-color: transparent;
  color: var(--ink-secondary);
  border: 1px solid transparent;
  cursor: pointer;
}

.layer-tab-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--ink-primary);
}

.layer-tab-btn.active {
  background-color: #FFFFFF;
  color: var(--ink-primary);
  font-weight: 600;
  border-color: var(--border-hairline);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* LỚP 2: THREE.JS 3D CANVAS PHONE */
.phone-3d-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Cho phép cuộn dọc trang khi vuốt lên điện thoại 3D; chỉ vuốt ngang mới xoay máy */
  touch-action: pan-y;
}

#phone3DCanvas {
  /* Máy 3D hiện dần khi tải xong, không có hình tạm */
  opacity: 0; transition: opacity .6s ease;
  width: 100% !important;
  height: 100% !important;
  outline: none;
  display: block;
}
.is-3d-ready #phone3DCanvas { opacity: 1; }

.cursor-grab {
  cursor: grab;
}

.cursor-grab:active,
.active\:cursor-grabbing:active {
  cursor: grabbing;
}

/* 5. Frosted Glass Depth for Metric Cards */
.hero-glass-metric {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(210, 210, 215, 0.75) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03) !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
              border-color 0.25s ease, 
              box-shadow 0.25s ease, 
              background-color 0.25s ease !important;
  position: relative;
  overflow: hidden;
}

.hero-glass-metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

.hero-glass-metric:hover::before {
  left: 100%;
}

.hero-glass-metric:hover {
  transform: translateY(-4px) scale(1.02) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: var(--ink-primary) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08) !important;
}

/* 6. Hero Line Reveal Animation */
.hero-line-mask {
  display: block;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
}

/* Mobile Responsiveness adjustments */
@media (max-width: 640px) {
  .hero-phone-arm {
    max-height: 380px !important;
  }
}

/* ==========================================================================
   Halora 3D Sage Studio Hero Section Styles
   Scale: --s = min(100vw/2048, 100vh/1152) with 0.55px floor
   ========================================================================== */
.halora-hero-stage {
  --vw-scale: calc(100vw / 2048);
  --vh-scale: calc(100vh / 1152);
  --s: max(0.55px, min(var(--vw-scale), var(--vh-scale)));

  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background-color: #CBCFB8;
  color: #1E3227;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.halora-media-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.halora-video {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  min-width: 100%;
  object-fit: cover;
  object-position: bottom center;
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.halora-video.ready {
  opacity: 1;
}

.halora-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 65%, transparent 45%, rgba(203, 207, 184, 0.35) 75%, #CBCFB8 100%);
  pointer-events: none;
  z-index: 2;
}

.halora-glass-arc {
  position: absolute;
  bottom: calc(-100 * var(--s));
  left: 50%;
  transform: translateX(-50%);
  width: calc(880 * var(--s));
  height: calc(880 * var(--s));
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 calc(60 * var(--s)) rgba(255, 255, 255, 0.2) inset, 0 0 calc(40 * var(--s)) rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 2;
}

.halora-stage-content {
  position: relative;
  z-index: 10;
  width: 100%;
  flex-grow: 1;
  padding: calc(60 * var(--s)) calc(64 * var(--s)) calc(40 * var(--s));
  display: grid;
  grid-template-columns: calc(640 * var(--s)) 1fr calc(260 * var(--s));
  align-items: center;
  pointer-events: none;
}

.halora-stage-content > * {
  pointer-events: auto;
}

.halora-copy-zone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: calc(620 * var(--s));
}

.halora-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: calc(10 * var(--s));
  font-size: calc(18 * var(--s));
  font-weight: 600;
  color: #3F5447;
  margin-bottom: calc(20 * var(--s));
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.halora-tracking-dot {
  width: calc(9 * var(--s));
  height: calc(9 * var(--s));
  border-radius: 50%;
  background-color: #1E3227;
  position: relative;
}

.halora-tracking-dot::after {
  content: '';
  position: absolute;
  inset: calc(-4 * var(--s));
  border-radius: 50%;
  border: 1px solid #1E3227;
  opacity: 0.5;
  animation: pulsePing 2.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.halora-headline-mask {
  overflow: hidden;
  margin-bottom: calc(4 * var(--s));
}

.halora-headline-line {
  display: block;
  font-size: calc(69 * var(--s));
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: #1E3227;
}

.halora-paragraph {
  font-size: calc(22 * var(--s));
  font-weight: 400;
  line-height: 1.5;
  color: #3F5447;
  margin-top: calc(24 * var(--s));
  margin-bottom: calc(38 * var(--s));
  max-width: calc(560 * var(--s));
}

.halora-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(60 * var(--s));
  padding: 0 calc(38 * var(--s));
  border-radius: 9999px;
  background-color: #1E3227;
  color: #FFFFFF;
  font-size: calc(19 * var(--s));
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.halora-cta-btn:hover {
  transform: scale(1.03);
  background-color: #000000;
}

.halora-metrics-zone {
  display: flex;
  flex-direction: column;
  gap: calc(18 * var(--s));
  align-items: flex-end;
}

.halora-glass-card {
  width: calc(222 * var(--s));
  height: calc(160 * var(--s));
  border-radius: calc(20 * var(--s));
  background-color: rgba(224, 227, 212, 0.42);
  border: 1px solid rgba(30, 50, 39, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: calc(20 * var(--s)) calc(22 * var(--s));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.halora-glass-card:hover {
  transform: translateY(calc(-3 * var(--s)));
  border-color: rgba(30, 50, 39, 0.5);
  background-color: rgba(224, 227, 212, 0.6);
}

.halora-metric-label {
  font-size: calc(13 * var(--s));
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1E3227;
}

.halora-metric-numeral {
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  font-size: calc(42 * var(--s));
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #1E3227;
  margin-top: calc(4 * var(--s));
}

.halora-metric-sublabel {
  font-size: calc(13 * var(--s));
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9B8A3E;
}

@media (max-width: 1200px) {
  .halora-stage-content {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

@media (max-width: 820px) {
  .halora-hero-stage {
    --s: max(0.48px, 100vw / 600);
    min-height: auto;
  }
  .halora-stage-content {
    grid-template-columns: 1fr;
    padding: calc(40 * var(--s)) calc(24 * var(--s));
    gap: 28px;
  }
  .halora-metrics-zone {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    align-items: flex-start;
  }
  .halora-glass-card {
    width: calc(50% - 10px);
    height: auto;
    min-height: calc(130 * var(--s));
  }
}



/* ==========================================================================
   Mobile / tablet navigation (menu < 1024px)
   ========================================================================== */
.mobile-nav-link {
  display: flex;
  align-items: center;
  min-height: 56px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  text-decoration: none;
  border-bottom: 1px solid #D2D2D7;
}

.mobile-nav-link:focus-visible,
#mobileMenuBtn:focus-visible {
  outline: 2px solid #0071E3;
  outline-offset: 2px;
}

body.menu-open {
  overflow: hidden;
}

/* Vùng an toàn của iPhone (tai thỏ / thanh home) */
/* Header kính nổi (giữ bảng màu trắng của web) */
.site-header { padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; background: transparent; pointer-events: none; }
.nav-pill, .mega-menu, .search-overlay { pointer-events: auto; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; max-width: 1240px; margin: 0 auto; }
.nav-pill {
  height: 52px; padding: 0 22px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: background .2s, box-shadow .2s, transform .2s;
}
.nav-pill:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 10px 26px rgba(0, 0, 0, 0.12); }
.nav-menu { flex: 1 1 auto; justify-content: center; gap: 8px; padding: 0 18px; }
.nav-actions { padding: 0 9px 0 14px; gap: 14px !important; }
.site-header.is-scrolled .nav-pill { background: rgba(255, 255, 255, 0.92); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .nav-pill, .mega-menu::before, .search-panel { background: #fff; } }
/* Mục menu: chữ xám, rê vào thì sáng lên, nhấc nhẹ và gạch chân chạy ra */
#mainNav a { position: relative; height: 34px; padding: 0 11px; color: #6E6E73 !important; font-weight: 500 !important; transition: color .18s, transform .18s; }
#mainNav a::before { content: ''; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px; border-radius: 2px; background: #1D1D1F; transform: scaleX(0); transform-origin: left; transition: transform .22s ease; }
#mainNav a:hover, #mainNav a:focus-visible, #mainNav a.active { color: #1D1D1F !important; }
#mainNav a:hover, #mainNav a:focus-visible { transform: translateY(-1px); }
#mainNav a:hover::before, #mainNav a:focus-visible::before, #mainNav a.active::before { transform: scaleX(1); }
#mainNav .nav-active-bar { display: none !important; }
#mainNav a[data-mega]::after { content: ''; width: 5px; height: 5px; margin: 0 0 3px 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: .55; transition: transform .2s; }
#mainNav a[data-mega][aria-expanded="true"]::after { transform: rotate(225deg) translate(-1px, -1px); }
.nav-search-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 50%; background: rgba(255, 255, 255, 0.6); color: #1D1D1F; cursor: pointer; transition: background .15s, transform .15s; }
.nav-search-btn:hover { background: #fff; transform: translateY(-1px); }

.search-overlay { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 84px 16px 16px; background: rgba(245, 245, 247, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); opacity: 0; transition: opacity .18s ease; }
.search-overlay[hidden] { display: none; }
.search-overlay.is-open { opacity: 1; }
.search-panel { width: 100%; max-width: 620px; border-radius: 22px; background: rgba(255, 255, 255, 0.92); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 24px 56px rgba(0, 0, 0, 0.18); overflow: hidden; transform: translateY(-8px); transition: transform .2s ease; }
.search-overlay.is-open .search-panel { transform: none; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 18px; height: 56px; color: #6E6E73; }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font: inherit; font-size: 16px; color: #1D1D1F; box-shadow: none !important; }
.search-field kbd { padding: 2px 7px; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 6px; font: inherit; font-size: 11px; color: #6E6E73; }
.search-results { max-height: min(60vh, 420px); overflow-y: auto; border-top: 1px solid rgba(0, 0, 0, 0.06); }
.search-results:empty { display: none; }
.search-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 18px; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.search-item:hover, .search-item.is-active { background: rgba(0, 0, 0, 0.05); }
.search-item img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #F5F5F7; flex: none; }
.search-item .si-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: #1D1D1F; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .si-price { font-size: 13px; font-weight: 600; color: #1D1D1F; white-space: nowrap; }
.search-empty { padding: 18px; font-size: 14px; color: #6E6E73; }

.mega-menu {
  position: absolute; top: calc(100% + 4px); width: 280px; max-width: calc(100vw - 24px);
  padding: 10px 6px; isolation: isolate;
  opacity: 0; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease;
}
/* Không có khung: nền mờ chỉ là lớp tan dần ra mép, chữ vẫn đọc được trên mọi nền */
.mega-menu::before {
  content: ''; position: absolute; inset: -18px -22px; z-index: -1; pointer-events: none;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse closest-side, #000 62%, transparent 100%);
}
.mega-menu[hidden] { display: none; }
.mega-menu.is-open { opacity: 1; transform: none; }
.mega-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 14px; border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 500; color: #1D1D1F; text-align: left; cursor: pointer; transition: transform .15s, color .15s; }
.mega-link:hover, .mega-link:focus-visible { transform: translateX(4px); color: #000; outline: none; }
.mega-link small { font-size: 12px; font-weight: 500; color: #6E6E73; }
.mega-tags { display: flex; gap: 22px; padding: 4px 14px 10px; }
.mega-tag { position: relative; padding: 2px 0; border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: #1D1D1F; cursor: pointer; }
.mega-tag span { margin-left: 4px; font-size: 12px; font-weight: 500; color: #6E6E73; }
.mega-tag::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: #1D1D1F; transform: scaleX(0); transform-origin: left; transition: transform .2s; }
.mega-tag:hover::after, .mega-tag:focus-visible::after { transform: scaleX(1); }
.mega-link:disabled, .mega-tag:disabled { opacity: .4; cursor: default; pointer-events: none; }
.mobile-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 6px; }
.mobile-quick .mega-chip { padding: 9px 16px; border: 0; border-radius: 999px; background: #F5F5F7; font: inherit; font-size: 14px; font-weight: 500; color: #1D1D1F; cursor: pointer; }
@media (max-width: 1279px) { .mega-menu { display: none !important; } .nav-pill { height: 46px; padding: 0 14px; } .nav-actions { padding: 0 6px 0 10px; } }

@media (max-width: 1279px) {
  #mobileMenuPanel {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* Người dùng bật giảm chuyển động: tắt animation và chuyển cảnh */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ==========================================================================
   Dropdown tùy chỉnh (thay <select> gốc) - đồng bộ phong cách website
   ========================================================================== */
.cs { position: relative; display: inline-block; max-width: 100%; }
.cs-block { display: block; width: 100%; }
.cs-native {
  position: absolute !important; width: 1px !important; height: 1px !important;
  opacity: 0; pointer-events: none; overflow: hidden;
}
.cs-trigger {
  display: flex !important; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.cs-trigger:hover { background-color: #EAEAEC !important; }
.cs-trigger[aria-expanded="true"] { box-shadow: 0 0 0 2px #1D1D1F; }
.cs-trigger:focus-visible { box-shadow: 0 0 0 2px #1D1D1F; outline: none; }
.cs-trigger.cs-placeholder .cs-text { color: #6E6E73; }
.cs-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chevron {
  flex: none; width: 9px; height: 9px; margin-right: 2px;
  border-right: 2px solid #1D1D1F; border-bottom: 2px solid #1D1D1F;
  transform: translateY(-2px) rotate(45deg); transition: transform .18s ease;
}
.cs-trigger[aria-expanded="true"] .cs-chevron { transform: translateY(2px) rotate(-135deg); }
.cs-list {
  position: fixed; z-index: 3000; margin: 0; padding: 6px; list-style: none;
  max-width: calc(100vw - 16px); overflow-y: auto; overscroll-behavior: contain;
  background: #FFFFFF; border: 1px solid #D2D2D7; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  animation: cs-pop .14s ease-out;
}
.cs-list[hidden] { display: none; }
.cs-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; min-height: 40px; border-radius: 10px; cursor: pointer;
  font-size: 14px; line-height: 1.3; color: #1D1D1F; white-space: nowrap;
}
.cs-option.cs-active { background: #F5F5F7; }
.cs-option.cs-empty { color: #6E6E73; }
.cs-option[aria-selected="true"] { font-weight: 600; }
.cs-option[aria-selected="true"]::after { content: "\2713"; font-size: 13px; }
.cs-option[aria-disabled="true"] { color: #8E8E93; cursor: not-allowed; }
@keyframes cs-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cs-list { animation: none; } .cs-chevron { transition: none; } }

/* Nút tròn kín đáo dẫn tới trang đăng nhập quản trị (góc trái cuối trang) */
.admin-login-dot {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 9999px; color: #6E6E73; background: transparent;
  border: 1px solid #D2D2D7; opacity: .55; transition: opacity .2s ease, background-color .2s ease, color .2s ease;
}
.admin-login-dot:hover, .admin-login-dot:focus-visible { opacity: 1; background: #1D1D1F; color: #FFFFFF; border-color: #1D1D1F; outline: none; }

/* Nút liên hệ nhanh (gọi, Zalo, Google Maps) */
.contact-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 44px; border-radius: 9px; text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.contact-icon img { display: block; width: 34px; height: 34px; object-fit: contain; }
.contact-icon img.maps-icon { width: 25px; height: 34px; }
.contact-icon:hover { transform: translateY(-2px); filter: brightness(1.08); }
.contact-icon:focus-visible { outline: 2px solid #1D1D1F; outline-offset: 2px; }
.contact-icon-call { background: #1D1D1F; }
.contact-icon-zalo { background: #0068FF; }
.contact-icon-map { background: #EA4335; }

/* Tên thương hiệu trên thanh đầu trang: 2 dòng trên điện thoại để không đẩy mất logo/giỏ hàng */
.brand-two-lines { display: inline-flex; flex-direction: column; line-height: 1.15; }
.brand-two-lines .brand-l1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: #1D1D1F; }
.brand-two-lines .brand-l2 { margin-top: 1px; font-size: 11px; font-weight: 400; letter-spacing: 0.02em; color: #6E6E73; }
.nav-logo { gap: 10px !important; }
.cart-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0; border: 0; background: transparent; color: #1D1D1F; cursor: pointer; font: inherit; transition: transform .15s; }
.cart-chip:hover { transform: translateY(-1px); }
.cart-ico { position: relative; display: inline-flex; }
.cart-count { position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #1D1D1F; color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
.cart-total { font-size: 13px; font-weight: 600; white-space: nowrap; }
@media (max-width: 639px) { .brand-two-lines .brand-l1 { font-size: 14px; } .nav-actions { gap: 10px !important; } .nav-row { gap: 10px; } }

/* ===== Sửa lỗi hiển thị nhỏ (ảnh, chữ bị cắt, nút nổi trên điện thoại) ===== */
/* Ảnh sản phẩm nền trắng hòa vào nền xám của khung thay vì lộ hình chữ nhật trắng */
#productGrid img, #accessoryGrid img, #cart-items-list img, .tm-product-img { mix-blend-mode: multiply; }
/* Chữ một dòng không bị cắt chân chữ (g, y, ặ...) */
.truncate, .line-clamp-1, .line-clamp-2 { padding-bottom: 0.08em; }
/* Khối chữ lớn dùng mặt nạ cuộn lên: chừa chỗ cho chân chữ */
.hero-line-mask { padding-bottom: 0.06em; }
@media (max-width: 640px) {
  /* Nút Gọi / Zalo nổi nhỏ lại để không che nút "Giỏ hàng" của thẻ sản phẩm */
  .fixed.bottom-6.right-6 { bottom: 14px; right: 10px; gap: 8px; }
  .fixed.bottom-6.right-6 > * { transform: scale(0.8); transform-origin: bottom right; }
  #productGrid, #accessoryGrid { padding-bottom: 72px; }
  #cart-drawer-panel { max-height: 94vh; border-radius: 18px; }
  #cart-drawer-panel img { max-width: 100%; }
}

/* Ảnh Apple có nhiều khoảng trắng quanh máy: phóng to để máy to bằng các ảnh khác (khung đã cắt phần thừa) */
img.tm-zoom { transform: scale(2.3); transform-origin: center 52%; transition: transform .3s ease; }
.group:hover img.tm-zoom { transform: scale(2.45); }
.tm-product-img.tm-zoom { transform: scale(2.4); }
.search-item img.tm-zoom { transform: none; object-fit: cover; object-position: center; }
img.tm-zoom { mix-blend-mode: normal !important; }

/* Thanh tag / bộ lọc trên điện thoại: một hàng vuốt ngang, bám mép màn hình, mờ dần ở mép phải để biết còn nữa */
.tag-scroller { scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.tag-scroller > * { scroll-snap-align: start; flex-shrink: 0; }
@media (max-width: 639px) {
  .tag-scroller { -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%); scroll-padding-left: 24px; }
  #brandFilterPills .brand-btn, #accessoryFilterPills .accessory-filter-btn { min-height: 40px; padding-left: 16px; padding-right: 16px; }
  .tag-scroller select { height: 40px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
}
