/**
 * Docs Services - Sappha Sports Design System
 * Unified styles matching SYSTEM/main
 */

:root {
  --color-primary: #8b5cf6;
  --color-primary-hover: #7c3aed;
  --color-accent: #facc15;
  --color-dark: #0f172a;
}

/* Base resets & typography */
html {
  touch-action: manipulation;
  font-family: 'Sarabun', 'Inter', sans-serif;
  background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 50%, #fefce8 100%) no-repeat fixed;
  background-color: #f5f3ff;
  color: #0f172a;
  margin: 0;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  touch-action: manipulation;
  font-family: 'Sarabun', 'Inter', sans-serif;
  background: transparent;
  color: #0f172a;
  margin: 0;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

/* Heading & Action Fonts */
h1, h2, h3, h4, h5, h6,
.font-heading,
.font-ibm,
.brand-title,
.btn,
button {
  font-family: 'IBM Plex Sans Thai', 'Inter', sans-serif !important;
}

/* Modal Animations & Bounces */
.modal-enter {
  animation: bounceIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.modal-exit {
  animation: fadeOut 0.2s ease-out forwards;
}
@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

/* Tactile Bouncy Button helper */
.btn-sappha {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-sappha:hover {
  transform: scale(1.02);
}
.btn-sappha:active {
  transform: scale(0.96);
}

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

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Safe area padding */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.pt-safe {
  padding-top: env(safe-area-inset-top, 0px);
}

/* Docs Content Typography & WYSIWYG Rendering */
.docs-content {
  color: #334155;
  font-size: 1.025rem;
  line-height: 1.8;
  word-break: break-word;
}

.docs-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 1.75rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  scroll-margin-top: 5rem;
}

.docs-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2rem;
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  line-height: 1.35;
  scroll-margin-top: 5rem;
}

.docs-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  scroll-margin-top: 5rem;
}

.docs-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #334155;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 5rem;
}

.docs-content p {
  margin-bottom: 1.25rem;
}

.docs-content strong {
  color: #0f172a;
  font-weight: 600;
}

.docs-content a {
  color: #7c3aed;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
.docs-content a:hover {
  color: #6d28d9;
}

/* Lists */
.docs-content ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}
.docs-content ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}
.docs-content li {
  margin-bottom: 0.4rem;
}

/* Blockquotes & Callouts */
.docs-content blockquote {
  border-left: 4px solid #8b5cf6;
  background-color: #f5f3ff;
  padding: 0.875rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 0.75rem 0.75rem 0;
  color: #475569;
  font-style: italic;
}

.callout {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  border: 1px solid transparent;
}
.callout-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.callout-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.callout-tip {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.callout-title {
  font-weight: 700;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
}

/* Tables */
.docs-content table,
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.docs-content th,
.docs-table th {
  background-color: #f5f3ff;
  color: #6d28d9;
  font-weight: 600;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.docs-content td,
.docs-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.docs-content tr:last-child td,
.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-content tr:hover td {
  background-color: #faf5ff;
}

/* Code & Preformatted */
.docs-content code:not(pre code) {
  background-color: #f1f5f9;
  color: #7c3aed;
  font-size: 0.875em;
  padding: 0.15rem 0.4rem;
  border-radius: 0.375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.docs-content pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
  position: relative;
}

.docs-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Images & Media */
.docs-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin: 1.25rem 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  display: block;
}

/* Alignment support for WYSIWYG images & paragraphs */
.docs-content img[style*="float: left"],
.docs-content img[style*="float:left"] {
  float: left;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.docs-content img[style*="float: right"],
.docs-content img[style*="float:right"] {
  float: right;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.docs-content img[style*="margin-left: auto"][style*="margin-right: auto"],
.docs-content .text-center img {
  margin-left: auto;
  margin-right: auto;
}

/* TinyMCE alignment classes */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Active navigation highlight */
.nav-topic-link.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(124, 58, 237, 0.16) 100%);
  color: #7c3aed;
  font-weight: 600;
  border-left: 3px solid #7c3aed;
}

/* Sidebar transition */
#sidebar-drawer {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
