/* KV Custom CSS System - Complete Replacement for Tailwind CSS */
/* Optimized for Thai content, performance, and maintainability */

/* CSS Reset and Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  border: 0 solid #e5e7eb;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  line-height: 1.5;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

body {
  margin: 0;
  padding: 0;
  overflow-y: scroll;
  background-color: #fff;
  min-height: 100vh;
  color: #1f2937;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Core Utility System */

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.table { display: table; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-initial { flex: 0 1 auto; }
.flex-none { flex: none; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow { flex-grow: 1; }

/* Alignment */
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Gap */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Space Between */
.space-x-1 > * + * { margin-left: 0.25rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Positioning */
.static { position: static; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.sticky { position: sticky; }

/* Top/Right/Bottom/Left */
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.top-1\/2 { top: 50%; }
.left-1\/2 { left: 50%; }

/* Z-index */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Overflow */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-scroll { overflow: scroll; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Sizing */
.w-auto { width: auto; }
.w-full { width: 100%; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333333%; }
.w-2\/3 { width: 66.666667%; }
.w-1\/4 { width: 25%; }
.w-3\/4 { width: 75%; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.w-24 { width: 6rem; }

.h-auto { height: auto; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.h-24 { height: 6rem; }

/* Max/Min Width & Height */
.max-w-none { max-width: none; }
.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-full { max-width: 100%; }
.max-w-screen-sm { max-width: 640px; }
.max-w-screen-md { max-width: 768px; }
.max-w-screen-lg { max-width: 1024px; }
.max-w-screen-xl { max-width: 1280px; }

.min-h-0 { min-height: 0; }
.min-h-full { min-height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Spacing - Margins */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }
.m-auto { margin: auto; }

.mx-0 { margin-left: 0; margin-right: 0; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; }
.mx-3 { margin-left: 0.75rem; margin-right: 0.75rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.mx-6 { margin-left: 1.5rem; margin-right: 1.5rem; }
.mx-8 { margin-left: 2rem; margin-right: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: 0.25rem; margin-bottom: 0.25rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-3 { margin-top: 0.75rem; margin-bottom: 0.75rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.ml-4 { margin-left: 1rem; }

/* Spacing - Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }

.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

.font-thin { font-weight: 100; }
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }

/* Colors */
.text-black { color: #000; }
.text-white { color: #fff; }
.text-gray-50 { color: #f9fafb; }
.text-gray-100 { color: #f3f4f6; }
.text-gray-200 { color: #e5e7eb; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }

.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-800 { color: #1e40af; }

.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }

.text-green-600 { color: #16a34a; }
.text-green-700 { color: #15803d; }

.text-yellow-500 { color: #eab308; }
.text-orange-600 { color: #ea580c; }
.text-orange-700 { color: #c2410c; }

.text-pink-600 { color: #db2777; }
.text-pink-700 { color: #be185d; }

/* Background Colors */
.bg-transparent { background-color: transparent; }
.bg-white { background-color: #fff; }
.bg-black { background-color: #000; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-gray-500 { background-color: #6b7280; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-900 { background-color: #111827; }

.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-500 { background-color: #3b82f6; }
.bg-blue-600 { background-color: #2563eb; }

.bg-red-50 { background-color: #fef2f2; }
.bg-red-100 { background-color: #fee2e2; }
.bg-red-500 { background-color: #ef4444; }

.bg-green-50 { background-color: #f0fdf4; }
.bg-green-100 { background-color: #dcfce7; }

.bg-yellow-50 { background-color: #fefce8; }
.bg-orange-100 { background-color: #ffedd5; }
.bg-pink-100 { background-color: #fce7f3; }
.bg-lime-50 { background-color: #f7fee7; }
.bg-cyan-50 { background-color: #ecfeff; }
.bg-indigo-50 { background-color: #eef2ff; }
.bg-purple-50 { background-color: #faf5ff; }

/* Border */
.border { border-width: 1px; }
.border-0 { border-width: 0; }
.border-2 { border-width: 2px; }
.border-t { border-top-width: 1px; }
.border-r { border-right-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-l { border-left-width: 1px; }

.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-gray-400 { border-color: #9ca3af; }
.border-blue-200 { border-color: #bfdbfe; }
.border-blue-300 { border-color: #93c5fd; }
.border-green-200 { border-color: #bbf7d0; }
.border-orange-200 { border-color: #fed7aa; }
.border-red-200 { border-color: #fecaca; }
.border-pink-200 { border-color: #fbcfe8; }
.border-lime-200 { border-color: #d9f99d; }
.border-indigo-200 { border-color: #c7d2fe; }

/* Border Radius */
.rounded { border-radius: 0.25rem; }
.rounded-sm { border-radius: 0.125rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Shadow */
.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

/* Cursor */
.cursor-auto { cursor: auto; }
.cursor-default { cursor: default; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* User Select */
.select-none { user-select: none; }
.select-text { user-select: text; }
.select-all { user-select: all; }
.select-auto { user-select: auto; }

/* Text Decoration */
.underline { text-decoration: underline; }
.no-underline { text-decoration: none; }

/* Text Transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* White Space */
.whitespace-normal { white-space: normal; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre { white-space: pre; }
.whitespace-pre-line { white-space: pre-line; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* Responsive Design */
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .sm\:text-base { font-size: 1rem; line-height: 1.5rem; }
}

@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:flex { display: flex !important; }
  .md\:hidden { display: none !important; }
  .md\:inline { display: inline !important; }
  .md\:inline-block { display: inline-block !important; }
  /* Alternative selector using attribute for md:inline */
  [class*="md:inline"] { display: inline !important; }
}
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:text-lg { font-size: 1.125rem; line-height: 1.75rem; }
  .md\:text-xl { font-size: 1.25rem; line-height: 1.75rem; }
}

@media (min-width: 1024px) {
  .lg\:block { display: block; }
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Ultra-Optimized Variable System */
:root {
  --color-primary: #2563eb;
  --color-secondary: #0d47a1;
  --color-accent: #ff4081;
  --color-success: #22c55e;
  --color-warning: #eab308;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  --color-neutral: #6b7280;
  --color-white: #ffffff;
  
  --shadow-focus: 0 0 0 4px;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;
  --transition: all 0.2s ease-in-out;
  
  --size-xs: 0.75rem;
  --size-sm: 1rem;
  --size-md: 1.25rem;
  --size-lg: 2rem;
  --size-xl: 3rem;
  
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
}


/* Custom Component System */

/* Unified Component System */
.avatar {
  display: block;
  border-radius: 9999px;
  overflow: hidden;
}
.avatar-block { overflow: auto; }

/* Unified Size System */
.avatar-xs, .loading-xs, .checkbox-xs, .badge-xs, .tab-xs, .menu-xs li > * { font-size: var(--size-xs); }
.avatar-sm, .loading-sm, .checkbox-sm, .badge-sm, .tab-sm, .menu-sm li > * { font-size: var(--size-sm); }
.avatar-lg, .loading-lg, .checkbox-lg, .badge-lg, .tab-lg, .menu-lg li > * { font-size: var(--size-lg); }
.avatar-xl, .loading-xl, .tab-xl, .menu-xl li > * { font-size: var(--size-xl); }

.avatar-xs { height: 1.5rem; width: 1.5rem; }
.avatar-sm { height: 3rem; width: 3rem; }
.avatar-md { height: 8rem; width: 8rem; }
.avatar-lg { height: 16rem; width: 16rem; }

/* Navigation Components - Lean Implementation */
.navbar {
  display: flex;
  align-items: center;
  background-color: #fff;
  margin-left: auto;
  margin-right: auto;
  max-width: 1280px;
  min-height: 2rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  gap: 1rem;
}

/* Navbar works with existing Tailwind flex utilities */
.navbar .flex-1 {
  flex: 1 1 0%;
}

.navbar .flex-none {
  flex: none;
}

@media (min-width: 1024px) {
  .navbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Navbar Button Consistency */
.navbar a, .navbar form, .navbar button {
  color: #1d4ed8;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

.navbar form {
  display: inline;
}

.navbar-divider {
  height: 0.25rem; /* h-1 */
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 0;
  background: linear-gradient(
    to right,
    transparent,
    #e5e7eb 20%,
    #e5e7eb 80%,
    transparent
  );
  margin: 0;
}

/* Card Components - Lean Implementation */
.card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.card-title,
.title {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

/* Title in box has bottom border */
.box .title {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

.card-body > * + * {
  margin-top: 1rem;
}

/* Unified Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  min-height: 2.5rem;
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

/* Unified Color Variant System */
.btn:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-light):not(.btn-ghost):not([class*="btn-outline"]) { background-color: #f3f4f6; color: #374151; border-color: #d1d5db; }
.btn:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-light):not(.btn-ghost):not([class*="btn-outline"]):hover { background-color: #e5e7eb; border-color: #9ca3af; }

/* Direct colors for critical above-the-fold elements - optimizes LCP */
.btn-primary, .badge-primary, .checkbox-primary { background-color: #2563eb; color: #ffffff; border-color: #2563eb; }
.btn-secondary, .badge-secondary, .checkbox-secondary { background-color: var(--color-secondary); color: var(--color-white); border-color: var(--color-secondary); }
.btn-danger, .badge-error, .checkbox-error { background-color: var(--color-error); color: var(--color-white); border-color: var(--color-error); }
.btn-light { background-color: #e5e7eb; color: #374151; border-color: #e5e7eb; }
.btn-ghost { background-color: transparent; color: #374151; border-color: transparent; }

.btn-primary:hover, .btn-secondary:hover, .btn-danger:hover { filter: brightness(0.9); }
.btn-light:hover { background-color: #d1d5db; border-color: #d1d5db; }
.btn-ghost:hover { background-color: #f3f4f6; border-color: #e5e7eb; }

/* Unified Outline System */
[class*="btn-outline-"], [class*="badge-outline"] { background-color: transparent; }
.btn-outline-primary, .badge-outline.badge-primary { color: #2563eb; border-color: #2563eb; }
.btn-outline-secondary, .badge-outline.badge-secondary { color: var(--color-secondary); border-color: var(--color-secondary); }
.btn-outline-danger, .badge-outline.badge-error { color: var(--color-error); border-color: var(--color-error); }
.btn-outline-warning { color: var(--color-warning); border-color: var(--color-warning); }
.btn-outline-success, .badge-outline.badge-success { color: var(--color-success); border-color: var(--color-success); }
.btn-outline-dark { color: #1f2937; border-color: #1f2937; }

.btn-outline-primary:hover { background-color: #2563eb; color: #ffffff; }
.btn-outline-secondary:hover { background-color: var(--color-secondary); color: var(--color-white); }
.btn-outline-danger:hover { background-color: var(--color-error); color: var(--color-white); }
.btn-outline-warning:hover { background-color: var(--color-warning); color: var(--color-white); }
.btn-outline-success:hover { background-color: var(--color-success); color: var(--color-white); }
.btn-outline-dark:hover { background-color: #1f2937; color: #ffffff; }
.btn-outline:not([class*="btn-outline-"]) { color: #4b5563; border-color: #d1d5db; }
.btn-outline:not([class*="btn-outline-"]):hover { background-color: #f9fafb; border-color: #9ca3af; }

/* Unified Size and State System */
.btn-sm { padding: 0.25rem 0.75rem; min-height: 2rem; font-size: var(--size-xs); }
.btn-lg { padding: 0.75rem 1.5rem; min-height: 3.5rem; font-size: var(--size-md); }
.btn-active { transform: scale(0.95); }
.btn-form { margin-top: var(--space-lg); }

/* Unified Form System */
.input, .file-input, .textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-lg);
  transition: var(--transition);
  min-height: 3rem;
}
.input:focus, .file-input:focus, .textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}
.textarea { resize: vertical; min-height: 6rem; }

.select {
  width: 100%;
  font-size: 0.875rem;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  appearance: none;
  padding: var(--space-sm) 2.5rem var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  transition: var(--transition);
  min-height: 3rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-sm) center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
}
.select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

fieldset.fieldset { margin-bottom: var(--space-lg); }

/* Optimized Checkbox System */
.checkbox {
  --chkbg: var(--color-primary);
  --chkfg: var(--color-white);
  flex-shrink: 0;
  cursor: pointer;
  height: var(--size-md);
  width: var(--size-md);
  appearance: none;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  background-color: transparent;
  transition: var(--transition);
}

.checkbox:checked, .checkbox:indeterminate {
  background-color: var(--chkbg);
  border-color: var(--chkbg);
  background-size: 75% 75%;
  background-position: center;
  background-repeat: no-repeat;
  animation: checkmark 0.2s ease-in-out;
}
.checkbox:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='3' stroke='white'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M4.5 12.75l6 6 9-13.5'/%3e%3c/svg%3e");
}
.checkbox:indeterminate {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='3' stroke='white'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M5 12h14'/%3e%3c/svg%3e");
}
.checkbox:hover { border-color: var(--chkbg); }
.checkbox:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--chkbg) 20%, transparent); }
.checkbox:disabled { cursor: not-allowed; opacity: 0.5; }

/* Unified Checkbox Colors */
.checkbox-accent { --chkbg: var(--color-accent); }
.checkbox-success { --chkbg: var(--color-success); }
.checkbox-warning { --chkbg: var(--color-warning); }
.checkbox-neutral { --chkbg: var(--color-neutral); }

/* Unified Component Sizes */
.checkbox-xs { height: var(--size-xs); width: var(--size-xs); border-radius: var(--radius-sm); }
.checkbox-sm { height: var(--size-sm); width: var(--size-sm); border-radius: var(--radius-sm); }
.checkbox-lg { height: var(--size-lg); width: var(--size-lg); border-radius: var(--radius-lg); }

@keyframes checkmark { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* Optimized File Input */
.file-input::file-selector-button {
  margin-right: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius);
  border: 0;
  font-size: 0.875rem;
  font-weight: 600;
  background-color: #f3f4f6;
  color: #374151;
  cursor: pointer;
}
.file-input::file-selector-button:hover { background-color: #e5e7eb; }

/* Optimized Form Labels */
legend.fieldset-legend { font-weight: 400; font-size: 1.125rem; line-height: 1.75rem; }
label.fieldset-label { font-size: 0.875rem; font-weight: 500; color: #374151; }
label.fieldset-label:has(.checkbox) { display: flex; align-items: center; gap: var(--space-sm); }

/* Optimized List System */
.list-row { display: flex; align-items: flex-start; gap: var(--space-lg); padding: var(--space-lg); }
.list-row > .mt-2 { flex-shrink: 0; margin-top: 0; }
.list-row > .flex.flex-col { flex: 1 1 0%; min-width: 0; }

/* Optimized Badge System */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  font-weight: 500;
  padding: var(--space-xs) calc(var(--space-xs) * 2.5);
  font-size: var(--size-xs);
}
.badge-success { background-color: var(--color-success); color: var(--color-white); }
.badge-warning { background-color: var(--color-warning); color: #451a03; }
.badge-neutral { background-color: #6b7280; color: #ffffff; }

/* Unified Badge Outline */
.badge-outline { background-color: transparent; border: 1px solid #d1d5db; color: #4b5563; }
.badge-outline.badge-warning { color: var(--color-warning); border-color: var(--color-warning); }
.badge-outline.badge-neutral { color: #4b5563; border-color: #6b7280; }

/* Unified Badge Sizes */
.badge-sm { padding: var(--space-xs) calc(var(--space-xs) * 2); }
.badge-lg { padding: var(--space-sm) var(--space-md); font-size: var(--size-sm); }

/* Ultra-Optimized Loading */
.loading {
  display: inline-block;
  border: 2px solid #d1d5db;
  border-right-color: transparent;
  border-radius: 50%;
  width: var(--size-sm);
  height: var(--size-sm);
  animation: spin 1s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .loading { animation: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-xs { width: var(--size-xs); height: var(--size-xs); }
.loading-lg { width: var(--size-lg); height: var(--size-lg); border-width: 3px; }
.loading-xl { width: var(--size-xl); height: var(--size-xl); border-width: 4px; }

/* Ultra-Optimized Alert System */
.alert {
  display: flex;
  align-items: flex-start;
  border: 1px solid;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
}
.alert-info { background-color: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.alert-success { background-color: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-warning { background-color: #fefce8; color: #a16207; border-color: #fde68a; }
.alert-error { background-color: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-outline { background-color: transparent; }
.alert-outline.alert-info { color: #1d4ed8; border-color: #93c5fd; }
.alert-outline.alert-success { color: #15803d; border-color: #86efac; }
.alert-outline.alert-warning { color: #b45309; border-color: #fcd34d; }
.alert-outline.alert-error { color: #dc2626; border-color: #fca5a5; }
.alert-soft { border-color: transparent; }
.alert-soft.alert-info { background-color: #eff6ff; color: #1d4ed8; }
.alert-soft.alert-success { background-color: #f0fdf4; color: #15803d; }
.alert-soft.alert-warning { background-color: #fefce8; color: #b45309; }
.alert-soft.alert-error { background-color: #fef2f2; color: #dc2626; }

/* Optimized Tab System */
.tabs { display: flex; align-items: center; }
.tab {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  text-decoration: none;
  cursor: pointer;
  padding: var(--space-sm) var(--space-lg);
  transition: var(--transition);
}
.tab:hover { color: #1f2937; text-decoration: none; }
.tab-active, .tab.tab-active { color: #2563eb; font-weight: 600; }

/* Unified Tab Variants */
.tabs-border { border-bottom: 1px solid #e5e7eb; }
.tabs-border .tab { border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-border .tab:hover { border-color: #d1d5db; }
.tabs-border .tab-active, .tabs-border .tab.tab-active { border-color: #2563eb; }
.tabs-boxed { background-color: #f3f4f6; padding: 0.25rem; border-radius: var(--radius-lg); }
.tabs-boxed .tab { border-radius: var(--radius); }
.tabs-boxed .tab-active, .tabs-boxed .tab.tab-active { background-color: #ffffff; color: #111827; box-shadow: var(--shadow-md); }

/* Unified Tab Sizes */
.tab-sm { padding: var(--space-xs) var(--space-md); }
.tab-lg { padding: var(--space-md) calc(var(--space-lg) * 2); font-size: var(--size-md); }

/* Ultra-Optimized Menu System */
.menu {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-xs) / 2);
  padding: var(--space-sm);
}
.menu.w-full {
  padding: 0;
}
.menu li { list-style: none; }
.menu li > * {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.menu.w-full li > * {
  padding-left: 0;
  padding-right: 0;
}
.menu li > *:hover { background-color: rgba(243, 244, 246, 0.75); text-decoration: none; }
.menu li > *.active, .menu li > *[aria-current] { background-color: #eff6ff; color: #1d4ed8; font-weight: 500; }

/* Unified Menu Variants */
.menu-horizontal { flex-direction: row; }

/* Stat Components - Lean and Fast Implementation */
.stats {
  display: flex;
  background-color: #ffffff;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.stats.shadow {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.stats-vertical {
  flex-direction: column;
}

/* Responsive stats variants */
@media (min-width: 640px) {
  .sm\:stats-horizontal {
    flex-direction: row;
  }
}

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
  min-height: 6rem;
  flex: 1 1 0%;
}

.stat:not(:last-child) {
  border-right: 1px solid rgb(229 231 235); /* border-gray-200 */
}

.stats-vertical .stat:not(:last-child) {
  border-right: none;
  border-bottom: 1px solid rgb(229 231 235);
}

/* Responsive border behavior */
@media (min-width: 640px) {
  .sm\:stats-horizontal .stat:not(:last-child) {
    border-bottom: none;
    border-right: 1px solid rgb(229 231 235);
  }
}

.stat-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.stat-desc {
  font-size: 0.75rem;
  color: #4b5563;
}

.stat-figure {
  position: absolute;
  top: 1rem;
  right: 1rem;
  opacity: 0.2;
}

.stat-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

/* Stat Color Variants - Optimized */
.stat-title.text-primary { color: #2563eb; }
.stat-title.text-secondary { color: var(--color-secondary); }
.stat-title.text-accent { color: #ff4081; }
.stat-title.text-success { color: var(--color-success); }
.stat-title.text-warning { color: var(--color-warning); }
.stat-title.text-error { color: var(--color-error); }

.stat-value.text-primary { color: #2563eb; }
.stat-value.text-secondary { color: var(--color-secondary); }
.stat-value.text-accent { color: #ff4081; }
.stat-value.text-success { color: var(--color-success); }
.stat-value.text-warning { color: var(--color-warning); }
.stat-value.text-error { color: var(--color-error); }

/* Stat Size Variants */
.stat-value.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.stat-value.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.stat-value.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.stat-value.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

/* Compact stat variant */
.stats.stats-compact .stat {
  padding: 1rem;
  min-height: 4rem;
}
.stats.stats-compact .stat-value {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

/* Optimized Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  font-size: 0.875rem;
  white-space: nowrap;
  padding: var(--space-lg);
}
.breadcrumbs > * { display: inline; white-space: nowrap; flex-shrink: 0; }
.breadcrumbs > *::after {
  content: "›";
  color: #9ca3af;
  margin: 0 0.5rem;
}
.breadcrumbs a {
  color: #1d4ed8;
  text-decoration: none;
  transition: var(--transition);
}
.breadcrumbs a:hover {
  color: #1e40af;
  text-decoration: none;
}
.breadcrumbs > *:not(a) { color: #1f2937; font-weight: 500; }

/* Ultra-Optimized Pagination */
.pagination {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--space-xs) / 2);
  padding: var(--space-xs) var(--space-sm);
}
@media (min-width: 640px) {
  .pagination { gap: var(--space-xs); padding: var(--space-sm); }
}
.pagination-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: #374151;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  cursor: pointer;
  text-decoration: none;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: var(--space-xs);
  font-size: var(--size-xs);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
@media (min-width: 640px) {
  .pagination-item {
    min-width: 2.5rem;
    height: 2.5rem;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--size-sm);
  }
}
.pagination-item:hover {
  background-color: #f9fafb;
  color: #111827;
  border-color: #9ca3af;
  text-decoration: none;
  transform: scale(1.05);
}
.pagination-item:focus {
  outline: none;
  box-shadow: 0 0 0 2px #3b82f6, 0 0 0 4px rgba(59, 130, 246, 0.1);
  z-index: 10;
}
.pagination-item.active {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  font-weight: 700;
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}
.pagination-item.active:hover {
  filter: brightness(0.9);
  transform: scale(1.1);
}
.pagination-item.disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  border-color: #e5e7eb;
  pointer-events: none;
}
.pagination-item.nav-arrow { font-weight: 400; }
.pagination-item.nav-arrow:hover { background-color: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.pagination-ellipsis {
  color: #9ca3af;
  cursor: default;
  padding: var(--space-sm) var(--space-md);
}

/* Optimized Join System */
.join { display: inline-flex; }
.join-item {
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  border-radius: 0;
}
.join-item:not(:first-child) { border-left-width: 0; }
.join-item:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.join-item:last-child { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.join-item:only-child { border-radius: var(--radius-lg); }
.join-item.btn {
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  min-height: auto;
  border-radius: inherit;
  transition: var(--transition);
}
.join-item.btn:hover { background-color: #f9fafb; z-index: 10; }
.join-item.btn:focus {
  z-index: 20;
  outline: 2px solid color-mix(in srgb, var(--color-primary) 50%, transparent);
  outline-offset: -1px;
}
.join-item.btn.btn-active {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  z-index: 10;
  font-weight: 600;
}
.join-item.btn.btn-disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
  border-color: #e5e7eb;
}

/* Custom Typography System - Tailored for Blog Posts */
.prose {
  color: var(--tw-prose-body);
  max-width: none; /* Let container control width, not typography */
  line-height: 1.75;
}

.prose p {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

.prose h1 {
  color: var(--tw-prose-headings);
  font-weight: 800;
  font-size: 2.25em;
  margin-top: 0;
  margin-bottom: 0.889em;
  line-height: 1.111;
}

.prose h2 {
  color: var(--tw-prose-headings);
  font-weight: 700;
  font-size: 1.5em;
  margin-top: 2em;
  margin-bottom: 1em;
  line-height: 1.333;
}

.prose h3 {
  color: var(--tw-prose-headings);
  font-weight: 600;
  font-size: 1.25em;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  line-height: 1.6;
}

.prose h4 {
  color: var(--tw-prose-headings);
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.prose strong {
  color: var(--tw-prose-bold);
  font-weight: 600;
}

.prose a {
  color: var(--tw-prose-links);
  text-decoration: underline;
  font-weight: 500;
}

.prose a:hover {
  color: #1e40af;
}

.prose ul {
  list-style-type: disc;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose ol {
  list-style-type: decimal;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose blockquote {
  font-style: italic;
  color: var(--tw-prose-quotes);
  border-left-width: 0.25rem;
  border-left-color: var(--tw-prose-quote-borders);
  quotes: '"' '"' ''' ''';
  margin-top: 1.6em;
  margin-bottom: 1.6em;
  padding-left: 1em;
}

.prose blockquote p:first-of-type:before {
  content: open-quote;
}

.prose blockquote p:last-of-type:after {
  content: close-quote;
}

.prose code {
  color: var(--tw-prose-code);
  font-weight: 600;
  font-size: 0.875em;
  background-color: #f3f4f6;
  padding: 0.125em 0.25em;
  border-radius: 0.25rem;
}

.prose pre {
  color: var(--tw-prose-pre-code);
  background-color: var(--tw-prose-pre-bg);
  overflow-x: auto;
  border-radius: 0.375rem;
  margin-top: 1.714em;
  margin-bottom: 1.714em;
  padding: 0.857em 1.143em;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
  font-weight: 400;
}

.prose hr {
  border-color: var(--tw-prose-hr);
  border-top-width: 1px;
  margin-top: 3em;
  margin-bottom: 3em;
}

/* Images in prose */
.prose img, .prose figure img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--radius);
  margin-top: 2em;
  margin-bottom: 2em;
}

hr {
  border: 1px solid #e5e7eb;
  margin: var(--space-sm) 0;
}

/* Box Component System */
.box {
  border: 2px solid #f3f4f6;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.box-accent-1 { background: linear-gradient(to bottom, #ecfeff, #dbeafe); border: 2px solid #bfdbfe; }
.box-accent-2 { background: linear-gradient(to bottom, #f7fee7, #dcfce7); border: 2px solid #bbf7d0; }
.box-accent-3 { background: linear-gradient(to bottom, #fffbeb, #fed7aa); border: 2px solid #fde68a; }
.box-accent-4 { background: linear-gradient(to bottom, #fef2f2, #fee2e2); border: 2px solid #fecaca; }
.box-accent-5 { background: linear-gradient(to bottom, #faf5ff, #fce7f3); border: 2px solid #fbcfe8; }
.box-accent-6 { background: linear-gradient(to bottom, #eff6ff, #dbeafe); border: 2px solid #bfdbfe; }
.box-highlight-1 { background-color: #f7fee7; border: 2px solid #d9f99d; }
.box-highlight-2 { background-color: #eef2ff; border: 2px solid #c7d2fe; }

.section-line {
  font-size: 1.5rem;
  line-height: 2rem;
  border-bottom: 2px solid #e5e7eb;
  margin: var(--space-lg) 0;
  padding: var(--space-sm) 0;
}

.avatar-border {
  border-radius: 50%;
  background: linear-gradient(to bottom right, #bfdbfe, #93c5fd, #6366f1);
  padding: 3px;
}

.avatar-border-lg {
  border-radius: 50%;
  background: linear-gradient(to bottom right, #bfdbfe, #93c5fd, #6366f1);
  padding: 4px;
}

/* Optimized Layout Components */
#uploaded-files { max-width: 640px; overflow-x: auto; white-space: nowrap; }
.vote-buttons { min-height: 40px; }
.ad336x280 {
  margin-left: auto;
  margin-right: auto;
  height: 280px;
  width: 336px;
}

/* Prevent CLS for AdSense top responsive ad - use ID selector (critical!) */
#adsense-top-container {
  min-height: 390px; /* Mobile responsive ads can be up to 390px */
  position: relative; /* For absolute positioning of placeholder text */
}

@media (min-width: 768px) {
  #adsense-top-container {
    min-height: 280px; /* Tablet and desktop ads typically 280px */
  }
}

/* Display placeholder for unfilled AdSense ads on mobile/tablet only */
@media (max-width: 1023px) {
  #adsense-top-container:has(ins.adsbygoogle[data-ad-status="unfilled"])::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 4px;
    z-index: 1;
  }

  /* Add Thai "Advertisement" text to placeholder */
  #adsense-top-container:has(ins.adsbygoogle[data-ad-status="unfilled"])::after {
    content: "โฆษณา";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #6c757d;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
    opacity: 0.6;
    z-index: 2;
  }
}

/* On desktop, hide unfilled ads completely (CLS acceptable) */
@media (min-width: 1024px) {
  #adsense-top-container:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
    display: none !important;
    min-height: 0 !important;
  }
}

/* Hide unfilled AdSense ads */
ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

/* Additional Theme Utilities */
/* WCAG AA compliant link colors (4.5:1 contrast ratio) */
a { 
  color: #1d4ed8; 
  text-decoration: none;
}
a:hover { 
  color: #1e40af; 
  text-decoration: underline;
}

.text-secondary, .text-hint { 
  color: #6b7280; 
  font-size: 0.75rem; 
}
.text-warning { color: #eab308; }
.text-danger { color: #ef4444; }
.text-accent { color: #ff4081; }

/* Contextual link colors for different box styles */
.box-accent-2 a, .box-accent-2 a:visited { color: #16a34a; }
.box-accent-2 a:hover { color: #15803d; }
.box-accent-3 a, .box-accent-3 a:visited { color: #ea580c; }
.box-accent-3 a:hover { color: #c2410c; }
.box-accent-4 a, .box-accent-4 a:visited { color: #dc2626; }
.box-accent-4 a:hover { color: #b91c1c; }
.box-accent-5 a, .box-accent-5 a:visited { color: #db2777; }
.box-accent-5 a:hover { color: #be185d; }

.box .text-xl, .box .text-2xl, .box .text-3xl { font-weight: 400; }

/* Ultra-Optimized CLS Prevention - Zero Layout Shift Architecture */
/* CRITICAL: Fixed dimensions prevent all layout shifts */
  
  /* Vote Section - Fixed 48px height, always stable */
  .vote-section {
    height: 48px; /* Fixed height prevents CLS */
    display: flex;
    align-items: center;
    gap: 1rem;
    contain: layout; /* Optimize rendering performance */
  }
  
  .vote-button {
    min-width: 80px; /* Consistent button width */
    white-space: nowrap;
    transition: background-color 0.2s, opacity 0.2s;
  }
  
  .vote-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  /* Optimistic update states */
  .vote-button.processing {
    pointer-events: none;
    opacity: 0.7;
  }
  
  /* Spinner animation - GPU accelerated */
  .spinner {
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
  
  /* Performance optimizations */
  .vote-section {
    will-change: contents; /* Prepare for updates */
  }
}
