/* การตั้งค่าพื้นฐาน */
body {
  box-sizing: border-box;
  font-family: 'Kanit', sans-serif;
  background-color: #FDF2F8; /* Soft pink base */
}

@view-transition {
    navigation: auto;
}

/* Updated Global Styles */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.gradient-text {
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  background-image: linear-gradient(to right, #ec4899, #8b5cf6);
}

/* เงาและการตกแต่ง - Soft & Modern */
.card-shadow {
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 5px 15px -5px rgba(0, 0, 0, 0.02);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

/* Mobile normalization: make mobile look like desktop (no odd shrinking/overflow) */
/* Ensure images and cards scale correctly */
img, picture, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Common product card normalization */
.product-card {
  margin: 0.5rem 0.5rem;
  padding: 0.75rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -10px rgba(131,52,113,0.08);
  background-color: rgba(255,255,255,0.9);
}

/* Keep Tailwind's max-width behavior for .max-w-7xl (do not force full-width) */

/* Nav normalization: keep nav compact and consistent across viewports */
.glass-nav {
  padding-top: env(safe-area-inset-top, 0.5rem);
}
.glass-nav .h-20 {
  height: auto !important;
  min-height: 56px;
}

/* Main content spacing to avoid overlap with sticky nav */
#main-root {
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

/* Forms and inputs full width on small screens */
input, textarea, select, .form-control {
  width: 100% !important;
  box-sizing: border-box;
}

/* Small adjustments for buttons and interactive elements */
button {
  touch-action: manipulation;
}

/* Remove unexpected horizontal scroll caused by some cards */
body, html {
  overflow-x: hidden;
}

/* Thumbnail preview styles */
.thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
}
.thumb img { display: block; width: 100%; height: 80px; object-fit: cover; }
.thumb .remove-btn {
  position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.6); color: #fff; width: 26px; height: 26px; border-radius: 50%; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:14px; z-index: 10;
}
.thumb .progress-wrap { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,0.6); }
.thumb .progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg,#ec4899,#a855f7); transition: width 200ms linear; }
.thumb .spinner { position: absolute; left: 6px; bottom: 8px; width:18px; height:18px; border-radius:50%; border:2px solid rgba(255,255,255,0.9); border-top-color: rgba(0,0,0,0.2); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


.nav-shadow {
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.1);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(168, 85, 247, 0.25);
}

/* Animations */
.slide-animation {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* ปุ่มและเมนู */
.category-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: white;
}

.menu-item:hover {
    background: linear-gradient(135deg, #f3e8ff, #fce7f3);
}

.login-modal {
  backdrop-filter: blur(10px);
}

/* Modal Overlay Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-container {
  width: 100%;
  max-width: 500px;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Scrollbar Utilities */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #fbcfe8;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #f472b6;
}

/* Scroll performance helpers for large tables */
.perf-row {
  content-visibility: auto;
  contain-intrinsic-size: 56px;
}

.sticky-col {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Mobile fixes: avoid fixed background on small screens which can cause render/scroll issues */
@media (max-width: 768px) {
  body {
    background-attachment: scroll !important;
    background-position: center;
    background-size: cover;
  }
}
