* { 
  box-sizing: border-box; 
}

body { 
  font-family: 'Sarabun', sans-serif; 
  background-color: #f5f7fa; 
  margin: 0; 
  padding: 0; 
  color: #2c3e50;
}

/* ===== NAVBAR ===== */
nav {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  min-height: 80px;
  display: flex;
  align-items: center;
  padding: 0 40px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav img {
  height: 50px;
  object-fit: contain;
}

nav a {
  font-size: 15px;
  font-weight: 600;
  height: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
  color: #2c3e50;
  transition: color 0.25s;
}

nav a:hover {
  color: #0066cc;
}

nav .flex-nav {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.auth-menu {
  display: flex;
  gap: 12px;
  align-items: center;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #f0f4f8;
  border-radius: 20px;
}

.auth-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0066cc;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.btn-logout {
  background: #ef4444;
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s;
  font-family: 'Sarabun', sans-serif;
}

.btn-logout:hover {
  background: #dc2626;
}

.btn-login {
  background: #0066cc;
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  font-family: 'Sarabun', sans-serif;
  transition: all 0.25s;
}

.btn-login:hover {
  background: #0052a3;
}

.btn-login:active {
  transform: scale(0.97);
}

.btn-login:focus-visible {
  outline: 3px solid rgba(0, 102, 204, 0.3);
  outline-offset: 2px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  background: linear-gradient(135deg, #0066cc, #0052a3);
  color: white;
  padding: 60px 20px;
  text-align: center;
}

.page-header h1 {
  font-size: 40px;
  margin: 0 0 12px 0;
  font-weight: 700;
}

.page-header p {
  font-size: 18px;
  margin: 0;
  opacity: 0.95;
}

/* ===== SEARCH BAR ===== */
.search-section {
  max-width: 1200px;
  margin: -50px auto 50px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.search-box {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border: 1px solid #e8ecf1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.search-box input,
.search-box button {
  padding: 11px 14px;
  border-radius: 8px;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  border: 1px solid #d1d5db;
  transition: all 0.25s;
}

.search-box input {
  width: 100%;
}

.search-box input:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.search-box button {
  background: #0066cc;
  color: white;
  border: none;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.search-box button:hover {
  background: #0052a3;
  transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

main h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin: 50px 0 40px;
  color: #2c3e50;
}

/* ===== SHOP CONTAINER ===== */
#shopContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.shop-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid #e8ecf1;
  transition: all 0.3s;
}

.shop-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.shop-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.shop-card .no-image {
  width: 100%;
  height: 200px;
  background: #e8ecf1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

.shop-info {
  padding: 20px;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.shop-info h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  flex: 1;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: 8px;
}

.status-open {
  background: #d1f5e6;
  color: #10b981;
}

.status-closed {
  background: #fee2e2;
  color: #ef4444;
}

.shop-info p {
  margin: 8px 0;
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

.shop-details {
  border-top: 1px solid #e8ecf1;
  padding-top: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: #666;
}

.shop-details p {
  margin: 6px 0;
}

.shop-card a {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.25s;
  border: none;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
}

.shop-card .website-btn {
  background: #0066cc;
  color: white;
}

.shop-card .website-btn:hover {
  background: #0052a3;
}

.shop-card .no-website {
  background: #d1d5db;
  color: #666;
  cursor: not-allowed;
}

.no-result {
  text-align: center;
  color: #e74c3c;
  font-weight: 600;
  font-size: 16px;
  margin: 60px 0;
  grid-column: 1 / -1;
}

/* ===== FOOTER ===== */
footer {
  background: #1f2937;
  color: #9ca3af;
  text-align: center;
  padding: 28px;
  margin-top: 60px;
  font-size: 14px;
}

/* ===== FLOATING BUTTONS ===== */
.line-float {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: #06C755;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 9999;
  animation: floatBtn 2s infinite;
  transition: all 0.3s;
}

.call-float {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #e53935;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 9999;
  animation: floatBtn 2s infinite 0.3s;
  transition: all 0.3s;
}

.line-float:hover,
.call-float:hover {
  transform: scale(1.15);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

@keyframes floatBtn {
  0% { transform: translateY(0); }
  25% { transform: translateY(-8px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* ===== AI CHAT STYLES ===== */
.chat-toggle-ai {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  background: #2563eb;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  z-index: 10000;
  transition: transform 0.3s;
}

.chat-toggle-ai:hover {
  transform: scale(1.1);
}

.chat-container-ai {
  position: fixed;
  bottom: 90px;
  left: 20px;
  z-index: 9999;
  font-family: 'Sarabun', sans-serif;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-box-ai {
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.header-ai {
  background: #2563eb;
  color: white;
  padding: 15px;
  font-size: 16px;
  font-weight: bold;
}

.messages-ai {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
}

.message-ai {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 85%;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.5;
}

.user-ai {
  background: #2563eb;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.bot-ai {
  background: white;
  color: #1f2937;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.loading-ai {
  background: transparent;
  border: none;
  box-shadow: none;
  align-self: flex-start;
  font-style: italic;
  color: #6b7280;
  padding: 5px 0;
}

.input-area-ai {
  display: flex;
  background: white;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  gap: 10px;
  align-items: center;
}

.input-area-ai input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  font-family: 'Sarabun', sans-serif;
  width: 100%;
}

.input-area-ai input:focus {
  border-color: #2563eb;
}

.input-area-ai button {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 16px;
  flex-shrink: 0;
}

.input-area-ai button:hover {
  background: #1d4ed8;
}

.ai-image {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  nav { padding: 0 24px; }
  nav .flex-nav { gap: 20px; }
  .search-box { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  nav {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 12px 16px;
  }

  nav .flex-nav {
    width: 100%;
    margin-left: 0;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  nav a { font-size: 14px; }

  .page-header {
    padding: 40px 20px;
  }

  .page-header h1 {
    font-size: 28px;
  }

  .search-section {
    margin: -30px auto 40px;
  }

  .search-box {
    padding: 16px;
    grid-template-columns: 1fr;
  }

  #shopContainer {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  main h2 {
    font-size: 28px;
  }

  .chat-container-ai {
    left: 10px;
    bottom: 90px;
    right: 10px;
  }

  .chat-box-ai {
    width: 100%;
    height: 60vh;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 10px 12px;
  }

  nav img { height: 42px; }

  nav a { font-size: 12px; }

  nav .flex-nav { gap: 8px; }

  .page-header {
    padding: 30px 16px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .page-header p {
    font-size: 14px;
  }

  .search-section {
    margin: -20px auto 30px;
  }

  #shopContainer {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .shop-card img,
  .shop-card .no-image {
    height: 160px;
  }

  .shop-info {
    padding: 16px;
  }

  .shop-info h3 {
    font-size: 16px;
  }

  .shop-card a {
    padding: 9px;
    font-size: 13px;
    margin-top: 12px;
  }

  main h2 {
    font-size: 22px;
    margin: 40px 0 30px;
  }

  main {
    padding: 0 16px 40px;
  }

  .line-float, .call-float {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }

  .chat-toggle-ai {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }
}