/* =====================================================
   Kaguya — Custom CSS
   Supplements Tailwind CDN with animations, components
   ===================================================== */

/* CSS Custom Properties */
:root {
  --color-primary: #2a6770;
  --color-primary-dark: #235f6a;
  --color-primary-darker: #1a5460;
  --color-secondary: #655F3E;
  --color-body-text: #454F5E;
  --color-secondary-text: #535353;
  --color-dark-bg: #0F172A;
  --color-accent-light: #DCE8E7;
  --color-accent-light2: #CCE5E2;
  --color-warm-bg: #FFF9EA;
  --color-light-bg: #F5F5F5;
}

/* =====================================================
   BASE STYLES
   ===================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Prompt', sans-serif;
  font-size: 18px;
  color: var(--color-body-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =====================================================
   IMAGE PLACEHOLDERS
   ===================================================== */
.img-placeholder {
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  min-height: 80px;
}

.img-placeholder > * {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

/* =====================================================
   NAVIGATION
   ===================================================== */
#main-nav {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

#main-nav.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Mobile menu transition */
#mobile-menu {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

#mobile-menu.open {
  display: block;
}

/* =====================================================
   COMPARISON TABLE
   ===================================================== */
.comparison-table-wrapper {
  -webkit-overflow-scrolling: touch;
}

.comparison-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.comparison-table-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.comparison-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 10px;
}

.comparison-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

/* =====================================================
   FAQ ACCORDION
   ===================================================== */
.faq-item {
  transition: box-shadow 0.2s ease;
}

.faq-item.active {
  box-shadow: 0 4px 16px rgba(45, 107, 118, 0.12);
  border-color: var(--color-primary);
}

.faq-question {
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.faq-answer {
  animation: fadeDown 0.3s ease;
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-icon {
  transition: transform 0.3s ease, color 0.2s ease;
  line-height: 1;
  font-weight: 300;
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
  color: var(--color-primary);
}

/* =====================================================
   STICKY MOBILE CTA
   ===================================================== */
.sticky-mobile-cta {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Ensure footer doesn't overlap mobile CTA */
@media (max-width: 768px) {
  body {
    padding-bottom: 0;
  }
}

/* =====================================================
   SMOOTH SCROLL (enhanced)
   ===================================================== */
.smooth-scroll {
  cursor: pointer;
}

/* =====================================================
   PAYMENT OPTION CARDS
   ===================================================== */
.payment-option {
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.payment-option.selected {
  border-color: var(--color-primary) !important;
  background-color: rgba(220, 232, 231, 0.3);
}

/* =====================================================
   FORM ELEMENTS
   ===================================================== */
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  outline: none;
  ring: 2px solid var(--color-primary);
  border-color: var(--color-primary);
}

/* Custom select arrow */
select {
  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 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  padding-right: 2.5rem !important;
}

/* =====================================================
   SLIP UPLOAD DROP ZONE
   ===================================================== */
#slip-drop-zone {
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

#slip-drop-zone.drag-over {
  border-color: var(--color-primary);
  background-color: rgba(220, 232, 231, 0.3);
}

/* =====================================================
   HERO DECORATIONS
   ===================================================== */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* =====================================================
   STAR RATING
   ===================================================== */
.star-fill {
  fill: #FBBF24;
}

/* =====================================================
   LOADING / BUTTON STATE
   ===================================================== */
.btn-loading {
  position: relative;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-loading::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* =====================================================
   RESPONSIVE TABLE SCROLL INDICATOR
   ===================================================== */
@media (max-width: 768px) {
  .comparison-table-wrapper::after {
    content: '← เลื่อนเพื่อดูทั้งหมด →';
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-secondary-text);
    padding: 0.5rem;
    background: var(--color-accent-light);
    border-top: 1px solid var(--color-accent-light2);
  }
}

/* =====================================================
   CARD HOVER EFFECTS
   ===================================================== */
.product-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(45, 107, 118, 0.15);
}

/* =====================================================
   TOAST / NOTIFICATION (future use)
   ===================================================== */
.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-dark-bg);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =====================================================
   FLOATING BUTTONS — mobile adjustments
   ===================================================== */
@media (max-width: 767px) {
  #line-float-btn {
    bottom: 86px !important;
  }
  #back-to-top {
    bottom: 90px !important;
  }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
  .sticky-mobile-cta,
  #main-nav,
  footer {
    display: none !important;
  }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 9999;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}
