/* ===== MODERN UI REDESIGN FOR PHRA THONG KHAM ===== */

/* Mobile Bottom Navigation Safe Area */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Mobile Bottom Navigation Spacing */
@media (max-width: 768px) {
  body {
    padding-bottom: 64px; /* Height of bottom nav bar */
  }
  
  /* Hide chat button in mobile - it's now in bottom nav */
  #chatBtn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  /* Adjust chat box position on mobile - above bottom nav */
  #chatBox {
    bottom: 80px !important;
    right: 1rem !important;
    left: 1rem !important;
    max-width: calc(100vw - 2rem) !important;
    width: calc(100vw - 2rem) !important;
    max-height: calc(100vh - 180px) !important;
    z-index: 60 !important;
  }
  
  /* Ensure chat box is visible when not hidden */
  #chatBox:not(.hidden) {
    display: block !important;
  }
  
  /* Mobile chat button positioning */
  #mobileChatBtn {
    z-index: 55 !important;
  }
}

/* Chat box animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Mobile More Menu Animation */
@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slide-up 0.3s ease-out;
}

/* CSS Custom Properties - Modern Color Palette */
:root {
  /* Primary Colors */
  --primary-50: #fef7ed;
  --primary-100: #fdedd3;
  --primary-200: #fbd7a5;
  --primary-300: #f8b86d;
  --primary-400: #f59432;
  --primary-500: #f2761a;
  --primary-600: #e35d10;
  --primary-700: #bc4710;
  --primary-800: #963a16;
  --primary-900: #7a3016;
  
  /* Secondary Colors */
  --secondary-50: #f0f9ff;
  --secondary-100: #e0f2fe;
  --secondary-200: #bae6fd;
  --secondary-300: #7dd3fc;
  --secondary-400: #38bdf8;
  --secondary-500: #0ea5e9;
  --secondary-600: #0284c7;
  --secondary-700: #0369a1;
  --secondary-800: #075985;
  --secondary-900: #0c4a6e;
  
  /* Neutral Colors */
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  
  /* Success Colors */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-200: #bbf7d0;
  --success-300: #86efac;
  --success-400: #4ade80;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;
  --success-800: #166534;
  --success-900: #14532d;
  
  /* Warning Colors */
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-300: #fcd34d;
  --warning-400: #fbbf24;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  --warning-800: #92400e;
  --warning-900: #78350f;
  
  /* Error Colors */
  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-200: #fecaca;
  --error-300: #fca5a5;
  --error-400: #f87171;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --error-700: #b91c1c;
  --error-800: #991b1b;
  --error-900: #7f1d1d;
  
  /* Typography */
  --font-family-primary: 'Inter', 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-heading: 'Inter', 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ===== RESET & BASE STYLES ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--neutral-800);
  background: linear-gradient(135deg, var(--neutral-50) 0%, var(--primary-50) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--neutral-900);
  margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

.display-1 { font-size: 4rem; font-weight: 800; }
.display-2 { font-size: 3.5rem; font-weight: 800; }
.display-3 { font-size: 3rem; font-weight: 800; }
.display-4 { font-size: 2.5rem; font-weight: 800; }
.display-5 { font-size: 2rem; font-weight: 800; }
.display-6 { font-size: 1.75rem; font-weight: 800; }

.lead {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--neutral-600);
  margin-bottom: var(--spacing-lg);
}

.text-muted {
  color: var(--neutral-500) !important;
}

/* ===== NAVIGATION ===== */
.navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--neutral-200);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-600) !important;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--primary-700) !important;
}

.navbar-nav .nav-link {
  font-weight: 500;
  color: var(--neutral-700) !important;
  padding: var(--spacing-sm) var(--spacing-md) !important;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--primary-600) !important;
  background: var(--primary-50);
}

.navbar-nav .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--primary-500);
  border-radius: var(--radius-full);
}

.navbar-toggler {
  border: none;
  padding: var(--spacing-xs);
}

.navbar-toggler:focus {
  box-shadow: none;
}

/* ===== BUTTONS ===== */
.btn {
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-lg);
  transition: all var(--transition-fast);
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-normal);
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary-600);
  border: 2px solid var(--primary-500);
}

.btn-outline-primary:hover {
  background: var(--primary-500);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--success-600), var(--success-700));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1.125rem;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-200);
}

.card-body {
  padding: var(--spacing-lg);
}

.card-title {
  font-weight: 700;
  color: var(--neutral-900);
  margin-bottom: var(--spacing-sm);
}

.card-text {
  color: var(--neutral-600);
  margin-bottom: var(--spacing-md);
}

.card-img-top {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.card:hover .card-img-top {
  transform: scale(1.05);
}

/* ===== HERO SECTION ===== */
.hero {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-50) 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-3xl);
  margin-bottom: var(--spacing-2xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23f59e0b" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

/* ===== BADGES & CHIPS ===== */
.badge {
  font-weight: 600;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.badge-accent {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
}

.chip {
  background: var(--primary-100);
  color: var(--primary-800);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid var(--primary-200);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.chip:hover {
  background: var(--primary-200);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chip.active {
  background: var(--primary-500);
  color: white;
  box-shadow: var(--shadow-md);
}

/* ===== FORMS ===== */
.form-control {
  border: 2px solid var(--neutral-200);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  transition: all var(--transition-fast);
  background: white;
}

.form-control:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
  outline: none;
}

/* ===== MODAL ===== */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
}

.modal-header {
  border-bottom: 1px solid var(--neutral-200);
  padding: var(--spacing-lg);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-footer {
  border-top: 1px solid var(--neutral-200);
  padding: var(--spacing-lg);
}

/* ===== CAROUSEL ===== */
.carousel-control-prev-icon,
.carousel-control-next-icon {
  background-color: var(--primary-500);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
}

.carousel-control-prev,
.carousel-control-next {
  width: 5%;
}

/* ===== FOOTER ===== */
footer {
  background: linear-gradient(135deg, var(--neutral-900) 0%, var(--neutral-800) 100%);
  color: var(--neutral-100);
  padding: var(--spacing-3xl) 0 var(--spacing-xl);
  margin-top: var(--spacing-3xl);
}

footer h5 {
  color: white;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

footer .btn-light {
  background: var(--neutral-100);
  color: var(--neutral-800);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all var(--transition-fast);
}

footer .btn-light:hover {
  background: var(--primary-500);
  color: white;
  transform: translateY(-1px);
}

/* Footer: Titles underline and color accent */
.footer-title {
  position: relative;
  padding-bottom: 6px;
}

.footer-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-300));
  border-radius: var(--radius-full);
}

/* Footer: Link list alignment */
.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--neutral-200) !important;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.footer-link i {
  color: var(--primary-400);
  width: 18px;
  text-align: center;
}

.footer-link:hover {
  color: white !important;
  transform: translateX(2px);
}

/* Footer: Contact items alignment */
.footer-contact .contact-item {
  display: flex;
  align-items: center;
}

.footer-contact .contact-item i {
  color: var(--primary-400);
  width: 18px;
  text-align: center;
}

/* Footer: Divider */
footer hr {
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* ===== UTILITIES ===== */
.shadow-soft {
  box-shadow: var(--shadow-lg);
}

.rounded-3 {
  border-radius: var(--radius-xl) !important;
}

.text-center {
  text-align: center;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-lg) !important; }
.mb-5 { margin-bottom: var(--spacing-xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }
.mt-4 { margin-top: var(--spacing-lg) !important; }
.mt-5 { margin-top: var(--spacing-xl) !important; }

.py-4 { padding-top: var(--spacing-lg) !important; padding-bottom: var(--spacing-lg) !important; }
.py-5 { padding-top: var(--spacing-xl) !important; padding-bottom: var(--spacing-xl) !important; }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .hero {
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
  }
  
  .display-1 { font-size: 2.5rem; }
  .display-2 { font-size: 2.25rem; }
  .display-3 { font-size: 2rem; }
  .display-4 { font-size: 1.75rem; }
  .display-5 { font-size: 1.5rem; }
  .display-6 { font-size: 1.25rem; }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  .card-img-top {
    height: 160px;
  }
  
  .btn {
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
}

@media (max-width: 576px) {
  .hero {
    padding: var(--spacing-lg);
  }
  
  .card-body {
    padding: var(--spacing-md);
  }
  
  .card-img-top {
    height: 140px;
  }
  
  .btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }
}

/* ===== SPECIAL COMPONENTS ===== */

/* Chat Button */
#chatBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  border: none;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-fixed);
  transition: all var(--transition-normal);
  font-size: 1.5rem;
}

#chatBtn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-2xl);
}

/* Chat Box */
#chatBox {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 320px;
  max-width: calc(100vw - 40px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
  animation: slideInRight 0.3s ease-out;
}

/* Back to Top Button */
#backToTop {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  border: none;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-fixed);
  transition: all var(--transition-normal);
  display: none;
  opacity: 0;
}

#backToTop:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-2xl);
}

#backToTop i {
  font-size: 1.2rem;
}

/* Map Styling */
.map-placeholder {
  min-height: 260px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--neutral-100), var(--primary-50));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-600);
  font-weight: 600;
}

/* Section Titles */
.section-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.section-title h5 {
  margin-bottom: 0;
  color: var(--neutral-900);
}

/* Nav Pills */
.nav-pill {
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

/* Product Cards */
.card-product img {
  height: 160px !important;
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  transition: transform var(--transition-normal);
}

.card-product:hover img {
  transform: scale(1.05);
}

/* Place Cards */
.card img.rounded-start {
  height: 140px !important;
  width: 100%;
  object-fit: cover;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

/* Star Rating */
.text-warning {
  color: var(--warning-500) !important;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-500);
  border-top: 2px solid transparent;
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.nav-link:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .navbar,
  #chatBtn,
  #chatBox,
  .btn {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}