/* ==========================================================
   [PHASE 122] SSOT Surface & Gradient Tokens
   Зорилго: Бүх хуудасны хатуу кодлогдсон bg-color, gradient-ыг
   семантик классаар солих.
   ========================================================== */

/* --- Surface Backgrounds (Light/Dark adaptive) --- */
.surface-muted {
  background-color: var(--surface-muted);
}

.surface-card-accent {
  border-width: 1px;
  border-color: var(--border);
  background-color: var(--surface);
}

.dark .surface-card-accent {
  background-color: rgba(124, 58, 237, 0.06);
  border-color: rgba(124, 58, 237, 0.15);
}

/* --- Tag / Badge Tokens --- */
.tag-neutral {
  border-radius: 9999px;
  border-width: 1px;
  border-color: var(--border);
  background-color: var(--surface);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--foreground);
}

.dark .tag-neutral {
  border-color: rgb(255 255 255 / 0.1);
  background-color: rgb(255 255 255 / 0.05);
  --tw-text-opacity: 1;
  color: rgb(203 213 225 / var(--tw-text-opacity, 1));
}

/* [122.0.2 FIX] text-sm хассан — inline text-xs давхардал үүсэхгүй.
   Font-size-ыг inline-аар тодорхойлно (text-sm эсвэл text-xs). */
/* [PHASE 175.5] Quiet Luxury Tags: 100% Semantic & Interactive SSOT */
.tag-accent {
  /* Light Mode: Clean Editorial Style - No Literal Colors */
  border-radius: 9999px;
  border-width: 1px;
  border-color: var(--border);
  background-color: var(--surface);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  color: var(--text-muted);
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

.tag-accent:hover {
  /* Light Mode Hover: Subtle Brand Invitation */
  color: var(--foreground);
  --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
  background-color: color-mix(in srgb, var(--brand-primary) 5%, transparent);
}

.dark .tag-accent {
  /* Dark Mode: Muted Midnight Style */
  /* [FIXED] Kept surface/40 instead of bg-transparent to maintain Depth Hierarchy */
  border-color: var(--border);
  color: var(--text-muted);
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
  background-color: color-mix(in srgb, var(--surface) 40%, transparent);
}

.dark .tag-accent:hover {
  /* Dark Mode Hover: Luxury Brand Invitation - Absolute Consistency */
  /* [FIX] @apply shadow-luxury → direct CSS (circular dependency prevention) */
  color: var(--foreground);
  /* [PHASE 231.V] SSOT: --shadow-card токеноор удирдагдана (tokens-dark.css). */
  box-shadow: var(--shadow-card);
  border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
  background-color: color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

/* --- CTA Block (Sidebar "Үнэгүй зөвлөгөө" стиль) --- */
.cta-block {
  border-radius: 0.5rem;
  border-width: 1px;
  border-color: var(--border);
  background-color: var(--surface);
  padding: 1.5rem;
}

.dark .cta-block {
  border-color: rgb(255 255 255 / 0.1);
  background-color: rgb(255 255 255 / 0.05);
  --tw-backdrop-blur: blur(4px);
  backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}

/* --- Filter Select Input SSOT --- */
.filter-select {
  width: 100%;
  border-radius: 0.5rem;
  border-width: 1px;
  border-color: var(--border);
  background-color: var(--surface);
  padding: 0.75rem;
  color: var(--foreground);
}

/* [122.0.3 FIX] outline-none нэмсэн — browser default outline + ring давхардахаас сэргийлсэн. */
.filter-select:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--brand-primary);
  border-color: var(--brand-primary);
}

.dark .filter-select {
  border-color: rgb(255 255 255 / 0.1);
  background-color: rgb(255 255 255 / 0.05);
  --tw-text-opacity: 1;
  color: rgb(226 232 240 / var(--tw-text-opacity, 1));
}

.dark .filter-select:focus {
  border-color: var(--luxury-gold);
  --tw-ring-color: var(--luxury-gold);
}

/* --- Error / Feedback State --- */
.error-state {
  border-radius: 0.5rem;
  border-width: 1px;
  border-color: rgb(244 63 94 / 0.15);
  background-color: rgb(244 63 94 / 0.05);
  padding: 1.5rem;
  text-align: center;
}

.dark .error-state {
  border-color: rgb(153 27 27 / 0.2);
  background-color: rgb(127 29 29 / 0.1);
}

.error-text {
  --tw-text-opacity: 1;
  color: rgb(220 38 38 / var(--tw-text-opacity, 1));
}

.dark .error-text {
  --tw-text-opacity: 1;
  color: rgb(248 113 113 / var(--tw-text-opacity, 1));
}

.retry-link {
  font-weight: 500;
  color: var(--foreground);
}

.retry-link:hover {
  color: var(--foreground);
}

.retry-link:is(.dark *) {
  color: var(--luxury-gold);
}

.dark .retry-link {
  color: var(--luxury-gold);

  &:hover {
    color: color-mix(in srgb, var(--luxury-gold) 80%, transparent);
  }
}

/* --- Price Text SSOT --- */
.price-text {
  font-weight: 700;
  color: var(--foreground);
}

.dark .price-text {
  color: var(--luxury-gold);
}

/* --- Stat Number SSOT --- */
.stat-accent {
  font-weight: 700;
  color: var(--foreground);
}

.dark .stat-accent {
  color: var(--luxury-gold);
}

/* --- Loading Spinner --- */
.spinner-border {
  border-bottom-width: 2px;
  border-color: var(--foreground);
}

.dark .spinner-border {
  border-bottom-width: 2px;
  border-color: var(--luxury-gold);
}

/* --- Active Category (Sidebar навигаци) --- */
.category-active {
  border-width: 1px;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
  background-color: var(--foreground);
  color: var(--background);
  border-color: transparent;
}

.category-active span,
.category-active p,
.category-active li,
.category-active svg {
  color: inherit;
}

.dark .category-active {
  border-width: 1px;
  background-color: color-mix(in srgb, var(--luxury-gold) 20%, transparent);
  color: var(--luxury-gold);
  border-color: color-mix(in srgb, var(--luxury-gold) 30%, transparent);
}

.dark .category-active span,
.dark .category-active p,
.dark .category-active li,
.dark .category-active svg {
  color: inherit;
}

.category-inactive {
  color: var(--foreground);
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

.category-inactive:hover {
  background-color: var(--brand-primary-light);
}

.dark .category-inactive {
  color: var(--text-muted);
}

.dark .category-inactive:hover {
  background-color: color-mix(in srgb, var(--foreground) 5%, transparent);
}

/* --- Benefit Text (green-700 орлуулагч) --- */
.benefit-text {
  color: var(--foreground);
}

.dark .benefit-text {
  color: var(--text-muted);
}

@keyframes floatOrb {
  from {
    transform: translate(-50%, -50%) scale(1);
  }

  to {
    transform: translate(-50%, -50%) translate(10%, 10%) scale(1.1);
  }
}

/* [PHASE 140.8 & 140.1 → 231.V] shadow-luxury: Floating Clinical Effect
   [PHASE 231.V] Light Mode hardening: 5% opacity → "ширхэг+ring" хос давхарга.
   0 4px 16px -2px: ойр, бодит сүүдэр. 0 0 0 1px: 1px subtile ring — card дэвсгэрээс тусгаарлана. */
.shadow-luxury {
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.10),
              0 0 0 1px rgba(0, 0, 0, 0.05);
}

.dark .shadow-luxury {
  /* [PHASE 231.V] SSOT: --shadow-card токеноор удирдагдана (tokens-dark.css). */
  box-shadow: var(--shadow-card);
}
/* ==========================================================
   BUTTON SYSTEM & SEMANTIC TOKENS (SSOT) - PHASE 126 → 263
   ========================================================== */
/* [PHASE 263] components.css дахь .btn-primary дублирлэгдсэн тодорхойлолт устгагдан utilities.css SSOT-руу даатгасан.
   Anti-SSOT split mandate (Architectural-Governance Law 1).
   Зөвхөн inline-flex layout SSOT alias хэвээр үлдэв. Outline визуал хэрэгжилт utilities.css L245-L260 дээр төвлөрсөн. */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Accessibility Styles for TIIMUU Platform */

/* [PHASE 211] .dark token override DELETED — Phase 209 SSOT-аас зөрсөн 16 ширхэг ZOMBIE token. Дэлгэрэнгүй: --background: #0f172a vs Phase 209 #0B0B0F; --primary: #3b82f6 vs Phase 127.1 --brand-primary: #C6A96B. SSOT regression risk арилгасан. */

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .dark {
    --background: #000000;
    --foreground: #ffffff;
    --card: #1a1a1a;
    --border: #ffffff;
  }

  :root {
    --background: #ffffff;
    --foreground: #000000;
    --card: #ffffff;
    --border: #000000;
  }
}

/* Reduced Motion Support */
@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;
  }
}

/* Focus Management */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.dark *:focus {
  outline-color: #60a5fa;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* High contrast buttons */
@media (prefers-contrast: high) {

  button,
  .btn {
    border: 2px solid currentColor;
  }
}

/* Text selection colors */
::-moz-selection {
  background-color: #3b82f6;
  color: #ffffff;
}
::selection {
  background-color: #3b82f6;
  color: #ffffff;
}

.dark ::-moz-selection {
  background-color: #60a5fa;
  color: #000000;
}

.dark ::selection {
  background-color: #60a5fa;
  color: #000000;
}

/* Accessibility controls styling */
.accessibility-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Text-to-Speech visual feedback */
.tts-highlight {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  box-shadow: 0 0 0 2px #f59e0b;
  border-radius: 2px;
}

.dark .tts-highlight {
  background-color: #451a03 !important;
  color: #fcd34d !important;
  box-shadow: 0 0 0 2px #f59e0b;
}

/* Font size transitions */
* {
  transition: font-size 0.3s ease;
}

/* Mobile accessibility adjustments */
@media (max-width: 768px) {
  .accessibility-controls {
    position: relative;
    top: auto;
    right: auto;
    margin: 16px;
    width: calc(100% - 32px);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .mobile-accessibility-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
  }
}

/* Keyboard navigation improvements */
.keyboard-navigation *:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Ensure sufficient color contrast */
.text-gray-500 {
  color: #6b7280;
}

.dark .text-gray-500 {
  color: #9ca3af;
}

/* Large text mode adjustments */
.large-text h1 {
  font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem) !important;
}

.large-text h2 {
  font-size: clamp(2rem, 1.8rem + 1.5vw, 3rem) !important;
}

.large-text h3 {
  font-size: clamp(1.75rem, 1.5rem + 1vw, 2.5rem) !important;
}

.large-text p,
.large-text span {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem) !important;
}

.large-text button {
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem) !important;
  padding: 12px 20px !important;
}

/* Animation controls */
.reduce-motion * {
  animation: none !important;
  transition: none !important;
}

/* Print styles */
@media print {

  .accessibility-controls,
  .tts-controls,
  .theme-toggle {
    display: none !important;
  }

  * {
    background: white !important;
    color: black !important;
  }
}

/* Error and success message accessibility */
.error-message {
  color: #dc2626;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  padding: 12px;
  border-radius: 6px;
  margin: 8px 0;
}

.dark .error-message {
  color: #f87171;
  background-color: #7f1d1d;
  border-color: #991b1b;
}

.success-message {
  color: #6366f1;
  background-color: #f0f4ff;
  border: 1px solid #c7d2fe;
  padding: 12px;
  border-radius: 6px;
  margin: 8px 0;
}

.dark .success-message {
  color: #a78bfa;
  background-color: #312e81;
  border-color: #4338ca;
}

/* Loading states */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.dark .loading-spinner {
  border-color: #374151;
  border-top-color: #60a5fa;
}

/* Tooltip accessibility */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 120px;
  background-color: #1f2937;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
}

.tooltip:hover .tooltip-text,
.tooltip:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Form accessibility */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--foreground);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 16px;
  /* Prevents zoom on iOS */
}

.form-input:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-color: #3b82f6;
}

.form-error {
  color: #dc2626;
  font-size: 14px;
  margin-top: 4px;
}

.dark .form-error {
  color: #f87171;
}

/* Modal accessibility */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--background);
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Ensure text readability */
.text-contrast-check {
  color: #1f2937;
  background-color: #ffffff;
}

.dark .text-contrast-check {
  color: #f9fafb;
  background-color: #111827;
}
/* Дэлгэцийн аюулгүй байдлын CSS */

/* Print хамгаалалт */
@media print {
  * {
    display: none !important;
  }

  body::before {
    content: "Энэ хуудсыг хэвлэх боломжгүй!";
    display: block !important;
    font-size: 24px;
    text-align: center;
    margin: 50px auto;
    color: red;
  }
}

/* Текст сонголт хамгаалалт тестийн хуудсанд */
.protected-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Зураг хамгаалалт */
.protected-image {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* Drag & drop хамгаалалт */
.no-drag {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* DevTools мэдрэхүйц стиль */
.devtools-warning {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 0, 0, 0.9);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  z-index: 999999;
  text-align: center;
}

/* Хамгаалалтын усны тэмдэг */
.security-watermark {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.05;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 100px,
    rgba(0,0,0,0.1) 100px,
    rgba(0,0,0,0.1) 120px
  );
}

/* Баруун дар хамгаалалт */
.no-context-menu {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* Консол анхааруулга стиль */
.console-warning {
  display: none;
}

/* Мобайл дээрх screenshot хамгаалалт */
@media screen and (max-width: 768px) {
  body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
  }

  /* Мобайл дээр screenshot хамгаалалт */
  .mobile-protected {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Хамгаалагдсан текстийн tooltip */
.protected-tooltip {
  position: relative;
}

.protected-tooltip:hover::after {
  content: "Энэ агуулга хамгаалагдсан";
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
}

/* Хамгаалалтын индикатор */
.security-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(76, 175, 80, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 11px;
  font-weight: bold;
  z-index: 9999;
  pointer-events: none;
}

/* [PHASE 211] .security-indicator::before DELETED — Quality-Sentinel §5.7 + Architectural-Governance Law 5 Emoji Purge mandate-аар "🔒" emoji арилсан. JSX consumer-р Lucide React Icon-р render хийгдсэн бол JSX layer-руу шилжүүлэх. CSS-r anhdагч `.security-indicator` элемент хэвээр (мөр 148-160). */

/* Тестийн хуудасны хамгаалалт */
.test-environment {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.test-environment * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  user-drag: none !important;
}

/* Админ панелийн хамгаалалт */
.admin-protected {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* F12 товч дарсан үед анхааруулга */
.f12-blocked-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ff4444;
  color: white;
  padding: 20px 40px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  z-index: 999999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
