/* --- Core Styles (Enhanced Dark Mode with Premium Effects) --- */
:root {
  --font-sarabun: "Sarabun", sans-serif;
  --font-inter: "Inter", sans-serif;

  /* Premium Color Palette */
  --primary-violet: #8b5cf6;
  --primary-fuchsia: #d946ef;
  --accent-cyan: #22d3ee;
  --accent-rose: #f43f5e;
  --bg-dark: #0a0f1a;
  --bg-darker: #050810;
  --surface-dark: rgba(15, 23, 42, 0.8);
  --glow-violet: rgba(139, 92, 246, 0.5);
  --glow-fuchsia: rgba(217, 70, 239, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sarabun);
  background-color: var(--bg-dark);
  color: #f3f4f6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* --- Animated Particles Background --- */
.particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -3;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: linear-gradient(
    135deg,
    var(--primary-violet),
    var(--primary-fuchsia)
  );
  border-radius: 50%;
  animation: floatParticle 15s infinite ease-in-out;
  opacity: 0.6;
  box-shadow: 0 0 10px var(--glow-violet), 0 0 20px var(--glow-fuchsia);
}

@keyframes floatParticle {
  0%,
  100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* --- Enhanced Background Effects --- */
.bg-gradient-animate {
  background: radial-gradient(
      ellipse 80% 50% at 50% -10%,
      rgba(139, 92, 246, 0.4),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at -5% 50%,
      rgba(56, 189, 248, 0.25),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at 105% 50%,
      rgba(236, 72, 153, 0.25),
      transparent
    ),
    radial-gradient(
      ellipse 100% 80% at 50% 120%,
      rgba(139, 92, 246, 0.2),
      transparent
    );
  mix-blend-mode: screen;
  pointer-events: none;
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% {
    opacity: 0.8;
    filter: hue-rotate(0deg);
  }
  100% {
    opacity: 1;
    filter: hue-rotate(15deg);
  }
}

/* --- Floating Orbs --- */
.floating-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: floatOrb 20s ease-in-out infinite;
  z-index: -2;
}

.floating-orb-1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.3),
    rgba(217, 70, 239, 0.2)
  );
  top: -10%;
  left: -10%;
  animation-delay: 0s;
}

.floating-orb-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.2),
    rgba(34, 211, 238, 0.2)
  );
  bottom: -10%;
  right: -10%;
  animation-delay: -7s;
}

.floating-orb-3 {
  width: 300px;
  height: 300px;
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.2),
    rgba(244, 63, 94, 0.1)
  );
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes floatOrb {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -30px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(-30px, -20px) scale(1.02);
  }
}

/* --- Premium Text Effects --- */
.text-shadow-glow {
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.8),
    0 0 60px rgba(217, 70, 239, 0.5), 0 4px 10px rgba(0, 0, 0, 0.9);
  animation: textGlow 3s ease-in-out infinite alternate;
}

@keyframes textGlow {
  0% {
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.8),
      0 0 60px rgba(217, 70, 239, 0.5), 0 4px 10px rgba(0, 0, 0, 0.9);
  }
  100% {
    text-shadow: 0 0 40px rgba(139, 92, 246, 1),
      0 0 80px rgba(217, 70, 239, 0.7), 0 4px 10px rgba(0, 0, 0, 0.9);
  }
}

/* --- Enhanced Glassmorphism --- */
.glass-panel {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.75) 0%,
    rgba(30, 41, 59, 0.65) 100%
  );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(139, 92, 246, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 30px rgba(139, 92, 246, 0.15);
}

/* --- Premium Glass Card --- */
.glass-card {
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.6) 0%,
    rgba(15, 23, 42, 0.8) 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border: 0 solid transparent !important;
  border-width: 0 !important;
  outline: none !important;
  padding: 0 !important;

  border-radius: 1.25rem;
  overflow: hidden;

  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;

  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;

  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  transform: translateZ(0);
}

.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: 0.6s;
  pointer-events: none;
  z-index: 20;
}

.glass-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
  padding: 2px;
  background: linear-gradient(
    145deg,
    rgba(139, 92, 246, 0.3),
    transparent 50%,
    rgba(217, 70, 239, 0.3)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 21;
}

.glass-card:hover::before {
  left: 150%;
}

.glass-card:hover::after {
  opacity: 1;
}

.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 50px rgba(139, 92, 246, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

.card-img-wrapper {
  width: calc(100% + 2px);
  margin-top: -1px;
  margin-left: -1px;
  margin-right: -1px;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.glass-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  backface-visibility: hidden;
}

.glass-card:hover img {
  transform: scale(1.15);
}

/* --- Enhanced Navigation --- */
.nav-link {
  position: relative;
  color: #94a3b8;
  font-family: var(--font-inter);
  font-weight: 500;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
}

.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.5rem;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.2),
    rgba(217, 70, 239, 0.1)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #8b5cf6, #d946ef, #22d3ee);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
  transform: translateX(-50%);
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  text-shadow: 0 0 15px rgba(139, 92, 246, 0.7);
}

.nav-link:hover::before {
  opacity: 1;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 80%;
}

/* --- Premium Language Switcher --- */
.lang-switch {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 3px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.lang-switch:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.lang-btn {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  transition: all 0.3s;
  z-index: 2;
}

.lang-btn.active {
  color: white;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.lang-bg {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: linear-gradient(135deg, #7c3aed, #db2777, #8b5cf6);
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border-radius: 9999px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.5);
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.lang-switch[data-lang="en"] .lang-bg {
  transform: translateX(100%);
}

/* --- Premium Typography --- */
.text-gradient {
  background: linear-gradient(135deg, #c084fc, #e879f9, #22d3ee, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% auto;
  animation: gradientMove 4s linear infinite;
  filter: drop-shadow(0 2px 10px rgba(192, 132, 252, 0.4));
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* --- Social Link Buttons --- */
.social-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.3),
    rgba(217, 70, 239, 0.2)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.25rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.social-link-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 50%;
}

.social-link-btn i {
  position: relative;
  z-index: 1;
}

.social-link-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4),
    0 0 20px rgba(217, 70, 239, 0.3);
  border-color: transparent;
}

.social-link-btn:hover::before {
  opacity: 1;
}

/* --- Premium Button Styles --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: white;
  font-weight: 600;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary span,
.btn-primary i {
  position: relative;
  z-index: 1;
}

/* --- Text Rendering for Thai --- */
p {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.th-font-fix {
  letter-spacing: 0.01em;
  -moz-font-feature-settings: "liga=0";
  -webkit-font-feature-settings: "liga=0";
  font-feature-settings: "liga=0";
}

/* --- Quill Overrides --- */
.ql-editor h1,
.ql-editor h2,
.ql-editor h3 {
  color: #d8b4fe !important;
  margin-top: 1.5em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.ql-editor p,
.ql-editor li {
  color: #e2e8f0;
  line-height: 1.8;
}
.ql-editor a {
  color: #38bdf8;
  text-decoration: underline;
}
.ql-editor blockquote {
  border-left-color: #8b5cf6;
  color: #94a3b8;
}
.ql-editor pre {
  background: #1e293b;
  border-radius: 0.5rem;
  color: #e2e8f0;
}

/* --- Premium Scrollbar --- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #0a0f1a;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8b5cf6, #d946ef);
  border-radius: 5px;
  border: 2px solid #0a0f1a;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7c3aed, #c026d3);
}

/* --- Premium Animations --- */
.animate-fadeIn {
  animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slideUp {
  animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.animate-pulse-slow {
  animation: pulseSlow 4s ease-in-out infinite;
}

@keyframes pulseSlow {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* --- Section Dividers --- */
.section-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 92, 246, 0.5),
    rgba(217, 70, 239, 0.5),
    transparent
  );
  margin: 4rem 0;
}

/* --- Glow Effects --- */
.glow-text {
  animation: glowPulse 2s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  from {
    text-shadow: 0 0 10px currentColor;
  }
  to {
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
  }
}

/* --- Loading Spinner Enhancement --- */
@keyframes spinGlow {
  0% {
    transform: rotate(0deg);
    filter: drop-shadow(0 0 5px var(--primary-violet));
  }
  50% {
    filter: drop-shadow(0 0 15px var(--primary-fuchsia));
  }
  100% {
    transform: rotate(360deg);
    filter: drop-shadow(0 0 5px var(--primary-violet));
  }
}

.loading-spinner {
  animation: spinGlow 1s linear infinite;
}

/* --- Card Content Gradient Overlay --- */
.card-content-overlay {
  position: relative;
}

.card-content-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.9));
  pointer-events: none;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
  .floating-orb {
    opacity: 0.5;
  }

  .particle {
    width: 3px;
    height: 3px;
  }
}

/* --- Selection Styling --- */
::selection {
  background: rgba(217, 70, 239, 0.4);
  color: #fff;
}

::-moz-selection {
  background: rgba(217, 70, 239, 0.4);
  color: #fff;
}

/* --- Focus States for Accessibility --- */
button:focus,
a:focus {
  outline: 2px solid var(--primary-violet);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}
