/* ========================================================
   Medical Supplies Catalog — Modern Clean Medical Styling
   ======================================================== */

:root {
  --primary: #006837;        /* Thammasat Hospital Medical Green */
  --primary-hover: #00522c;
  --primary-light: #e6f4ea;
  --primary-dark: #003d20;
  
  --success: #059669;        /* Active Green */
  --success-light: #d1fae5;
  --success-dark: #065f46;

  --warning: #d97706;
  --warning-light: #fef3c7;

  --danger: #e11d48;         /* Danger Red */
  --danger-light: #ffe4e6;
  --danger-hover: #be123c;

  --bg-main: #f8fafc;        /* Slate-50 */
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;

  --text-main: #0f172a;      /* Slate-900 */
  --text-muted: #64748b;     /* Slate-500 */
  --text-light: #94a3b8;     /* Slate-400 */

  --border-color: #e2e8f0;   /* Slate-200 */
  --border-focus: #38bdf8;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-sans: 'IBM Plex Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* -------------------------------------------------------------
   Header & Navigation
   ------------------------------------------------------------- */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ffffff;
  padding: 1px;
  border: 1.5px solid rgba(0, 104, 55, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.brand-group:hover .brand-logo-img {
  transform: scale(1.05);
}

.brand-icon {
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.brand-text .sub-title {
  font-size: 0.74rem;
  color: #047857;
  font-weight: 600;
  display: block;
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background-color: var(--bg-alt);
  color: var(--text-main);
}

.nav-btn.active {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-btn.admin-badge {
  border-color: var(--border-color);
  background-color: #f8fafc;
}

.nav-btn.admin-badge:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: #f0f9ff;
}

.nav-btn.admin-badge.logged-in {
  background-color: #ecfdf5;
  color: var(--success);
  border-color: #a7f3d0;
}

/* -------------------------------------------------------------
   Main App Content
   ------------------------------------------------------------- */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem 1.25rem;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* -------------------------------------------------------------
   Hero Search & Filter Section
   ------------------------------------------------------------- */
.search-hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.hero-content {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.hero-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}


/* Search Box & Autocomplete */
.search-box-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 1.25rem;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.search-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

.search-icon {
  position: absolute;
  left: 1.15rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 52px;
  padding: 0 170px 0 3.25rem;
  font-size: 1.05rem;
  font-family: inherit;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  outline: none;
  color: var(--text-main);
}

.search-input::placeholder {
  color: #94a3b8;
  font-size: 0.98rem;
}

.search-clear-btn {
  position: absolute;
  right: 142px;
  background: #e2e8f0;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.search-clear-btn:hover {
  background: #cbd5e1;
  color: var(--text-main);
}

.search-image-btn {
  position: absolute;
  right: 0.35rem;
  background: #e6f4ea;
  color: #006837;
  border: 1px solid rgba(0, 104, 55, 0.2);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  height: 38px;
}

.search-image-btn:hover {
  background: #006837;
  color: #ffffff;
  border-color: #006837;
  box-shadow: 0 2px 6px rgba(0, 104, 55, 0.25);
}

/* Suggestions Dropdown */
.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  max-height: 380px;
  overflow-y: auto;
  text-align: left;
}

.suggestion-item {
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.1s ease;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: #f0f9ff;
}

.suggestion-text {
  font-size: 0.92rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-match {
  font-weight: 700;
  color: var(--primary);
}

.suggestion-type-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.badge-type-name {
  background-color: #f1f5f9;
  color: #475569;
}

.badge-type-code {
  background-color: #e0f2fe;
  color: #0369a1;
  font-family: var(--font-mono);
}

.badge-type-location {
  background-color: #ecfdf5;
  color: #059669;
}

/* Category Filter Pills */
.category-filters-container {
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.category-filters-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cat-pill {
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cat-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f9ff;
}

.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

/* -------------------------------------------------------------
   Results Header & Controls
   ------------------------------------------------------------- */
.results-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding: 0 0.25rem;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.meta-filter-tag {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.results-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.view-toggle-label {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.view-toggle-btns {
  display: flex;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.view-btn.active {
  background: #f1f5f9;
  color: var(--primary);
}

/* -------------------------------------------------------------
   Product Grid & Cards (Visitor)
   ------------------------------------------------------------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* Card Mode */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.card-img-wrap {
  width: 100%;
  height: 180px;
  background-color: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

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

.card-no-img {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  background: #f8fafc;
}

.card-no-img svg {
  color: #cbd5e1;
}

.card-no-img span {
  font-size: 0.82rem;
  font-weight: 500;
  color: #94a3b8;
}

.card-body {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.card-code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: #0369a1;
  background: #e0f2fe;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.card-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.8em;
}

.card-footer-info {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.card-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #334155;
}

.card-location svg {
  color: #059669;
  flex-shrink: 0;
}

.location-val {
  font-weight: 600;
  color: #0f172a;
}

.location-none {
  color: #94a3b8;
  font-style: italic;
  font-weight: 400;
}

.card-category {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* List Mode View */
.products-grid.list-mode {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.products-grid.list-mode .product-card {
  flex-direction: row;
  height: 110px;
}

.products-grid.list-mode .card-img-wrap {
  width: 120px;
  height: 100%;
  border-bottom: none;
  border-right: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.products-grid.list-mode .card-body {
  padding: 0.75rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
}

.products-grid.list-mode .card-title {
  -webkit-line-clamp: 1;
  height: auto;
  margin-bottom: 0.25rem;
}

.products-grid.list-mode .card-footer-info {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
  flex-direction: row;
  align-items: center;
  gap: 1.25rem;
}

/* -------------------------------------------------------------
   Pagination Bar
   ------------------------------------------------------------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: #cbd5e1;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* -------------------------------------------------------------
   Empty & Loading States
   ------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  margin: 2rem auto;
}

.empty-icon {
  color: #94a3b8;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* -------------------------------------------------------------
   Admin Login Section
   ------------------------------------------------------------- */
.login-card-wrapper {
  max-width: 440px;
  margin: 3rem auto;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin: 0 auto 0.85rem auto;
  display: block;
  background: #ffffff;
  border-radius: 50%;
  padding: 2px;
  border: 1.5px solid rgba(0, 104, 55, 0.2);
  box-shadow: 0 2px 6px rgba(0, 104, 55, 0.15);
}

.login-shield-icon {
  width: 56px;
  height: 56px;
  background: #f0fdf4;
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
}

.login-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.login-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
}

/* -------------------------------------------------------------
   Admin Management Section
   ------------------------------------------------------------- */
.admin-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-role-badge {
  background: #059669;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.user-welcome {
  font-size: 0.9rem;
  color: #cbd5e1;
}

.user-welcome strong {
  color: #ffffff;
}

.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-header-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.admin-title-row h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.admin-title-row p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.admin-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 240px;
}

.admin-search-input-wrap svg {
  position: absolute;
  left: 0.85rem;
  color: var(--text-light);
  pointer-events: none;
}

.admin-search-input-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 2.25rem 0 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  background: #f8fafc;
  transition: all 0.15s;
}

.admin-search-input-wrap input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.admin-select-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-select {
  height: 42px;
  padding: 0 2rem 0 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff 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") no-repeat right 0.6rem center/1.25rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  appearance: none;
}

.form-select:focus {
  border-color: var(--primary);
}

/* -------------------------------------------------------------
   Admin Table
   ------------------------------------------------------------- */
.admin-table-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.admin-table-stats {
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background-color: #f8fafc;
}

.admin-table-img-cell {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.admin-table-img-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-table-img-none {
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.1;
  padding: 2px;
}

.admin-table-code {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #0369a1;
  font-size: 0.86rem;
}

.admin-table-name {
  font-weight: 500;
  color: var(--text-main);
  max-width: 320px;
}

.admin-table-location {
  font-weight: 600;
  color: #334155;
  font-size: 0.86rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
}

.status-badge:hover {
  opacity: 0.85;
}

.status-active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.status-inactive {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.admin-table-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* -------------------------------------------------------------
   Modals
   ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease-out;
}

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

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalSlideUp 0.2s ease-out;
}

@keyframes modalSlideUp {
  from { transform: translateY(15px); }
  to { transform: translateY(0); }
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-sub-code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  display: block;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-footer-split {
  justify-content: space-between;
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-group label .req {
  color: var(--danger);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  background: #ffffff;
  transition: all 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.switch-label input {
  display: none;
}

.switch-slider {
  width: 44px;
  height: 24px;
  background-color: #cbd5e1;
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.switch-label input:checked + .switch-slider {
  background-color: var(--success);
}

.switch-label input:checked + .switch-slider::after {
  transform: translateX(20px);
}

.switch-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
}

.form-error-alert {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* -------------------------------------------------------------
   Image & Mobile Camera Modal
   ------------------------------------------------------------- */
.modal-image-card {
  max-width: 520px;
}

.image-preview-stage {
  position: relative;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 280px;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.image-display-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-display-box img {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
}

.no-image-placeholder {
  color: #64748b;
  text-align: center;
  padding: 3rem 1rem;
}

.no-image-placeholder p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #94a3b8;
}

/* Live Camera Viewfinder */
.live-camera-container {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.live-camera-container video {
  width: 100%;
  height: 100%;
  max-height: 380px;
  object-fit: cover;
}

.camera-overlay-controls {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 1rem;
  z-index: 10;
}

.btn-camera-snap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.1s;
}

.btn-camera-snap:active {
  transform: scale(0.92);
}

.snap-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
}

.image-opt-stats {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(15, 23, 42, 0.8);
  color: #38bdf8;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

/* Camera Actions Grid */
.image-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.camera-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s ease;
  min-height: 72px;
}

.camera-action-btn:hover {
  border-color: var(--primary);
  background: #f0f9ff;
  color: var(--primary);
}

.camera-native {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
}

.camera-native:hover {
  background: #e0f2fe;
}

/* -------------------------------------------------------------
   Buttons & Badges Common
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #f1f5f9;
  border-color: var(--border-color);
  color: #334155;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-outline-danger {
  background-color: transparent;
  border-color: #fecdd3;
  color: var(--danger);
}

.btn-outline-danger:hover:not(:disabled) {
  background-color: #fff1f2;
  border-color: var(--danger);
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
}

.btn-light {
  background-color: rgba(255, 255, 255, 0.85);
  color: #0f172a;
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.88rem;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-block {
  width: 100%;
}

/* -------------------------------------------------------------
   Toasts & Notifications
   ------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
}

.toast {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastIn 0.25s ease-out;
}

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

.toast.toast-success {
  background-color: #059669;
}

.toast.toast-error {
  background-color: #e11d48;
}

.toast.toast-info {
  background-color: #0284c7;
}

/* -------------------------------------------------------------
   Detail Modal Content (Visitor)
   ------------------------------------------------------------- */
.detail-modal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
}

.detail-img-box {
  width: 100%;
  height: 240px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.detail-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-specs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.spec-item {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.4rem;
}

.spec-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.spec-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.spec-val-code {
  font-family: var(--font-mono);
  color: #0369a1;
}

/* -------------------------------------------------------------
   Responsive Breakpoints (Mobile First Considerations)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .header-container {
    padding: 0.5rem 1rem;
  }

  .brand-logo-img {
    width: 30px;
    height: 30px;
  }

  .brand-text h1 {
    font-size: 0.92rem;
  }

  .brand-text .sub-title {
    display: block;
    font-size: 0.68rem;
  }

  .app-main {
    padding: 1rem 0.75rem 2rem 0.75rem;
  }

  .search-hero {
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
  }

  .hero-title {
    font-size: 1.35rem;
  }

  .hero-desc {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  .search-input {
    height: 46px;
    font-size: 0.95rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .card-img-wrap {
    height: 130px;
  }

  .card-body {
    padding: 0.75rem;
  }

  .card-title {
    font-size: 0.88rem;
    height: 2.6em;
    -webkit-line-clamp: 2;
  }

  .card-code {
    font-size: 0.74rem;
  }

  .detail-modal-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .detail-img-box {
    height: 180px;
  }

  .admin-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .admin-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-select-filters {
    width: 100%;
    flex-direction: column;
  }

  .form-select {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .image-action-grid {
    grid-template-columns: 1fr;
  }

  .search-input {
    padding: 0 4.5rem 0 2.5rem;
  }

  .search-clear-btn {
    right: 44px;
  }

  .search-image-btn {
    padding: 0.35rem 0.6rem;
  }

  .search-image-btn span {
    display: none;
  }

  .img-search-results-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------
   Image Search Modal & Scanner Animation
   ------------------------------------------------------------- */
.modal-image-search-card {
  max-width: 660px;
}

.modal-sub-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  font-weight: 500;
}

.image-search-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.image-search-dropzone:hover,
.image-search-dropzone.dragover {
  border-color: var(--primary);
  background: #f0fdf4;
}

.image-search-dropzone svg {
  color: #006837;
  margin-bottom: 0.75rem;
}

.image-search-dropzone h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.image-search-dropzone p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.img-search-buttons-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Radar Scan Preview */
.search-preview-container {
  position: relative;
  max-width: 320px;
  height: 250px;
  margin: 0 auto 1rem auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
}

.search-preview-container img {
  max-width: 100%;
  max-height: 250px;
  object-fit: contain;
}

.search-radar-scanner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 104, 55, 0.2) 0%, rgba(5, 150, 105, 0) 100%);
  overflow: hidden;
  pointer-events: none;
}

.radar-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #10b981;
  box-shadow: 0 0 10px #10b981, 0 0 18px #34d399;
  animation: radarSweep 1.6s ease-in-out infinite alternate;
}

@keyframes radarSweep {
  0% { top: 0; }
  100% { top: calc(100% - 3px); }
}

.search-preview-hint {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Image Search Results Stage */
.img-search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.img-search-results-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.img-search-count-badge {
  background: #e6f4ea;
  color: #006837;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.img-search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.25rem;
}

.similarity-badge {
  background: #006837;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.similarity-badge.sim-high {
  background: #059669;
}

.similarity-badge.sim-med {
  background: #d97706;
}

/* Admin Image Index Badge */
.index-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.index-badge-ready {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.index-badge-na {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

/* -------------------------------------------------------------
   Crop & Rotate Toolbar & Interactive Overlay
   ------------------------------------------------------------- */
.crop-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem 0;
  flex-wrap: wrap;
}

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.crop-box {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  border: 2px dashed #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  cursor: move;
  box-sizing: border-box;
}

.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: 
    linear-gradient(to right, transparent 33.3%, rgba(255, 255, 255, 0.3) 33.3%, rgba(255, 255, 255, 0.3) 34%, transparent 34%, transparent 66.6%, rgba(255, 255, 255, 0.3) 66.6%, rgba(255, 255, 255, 0.3) 67%, transparent 67%),
    linear-gradient(to bottom, transparent 33.3%, rgba(255, 255, 255, 0.3) 33.3%, rgba(255, 255, 255, 0.3) 34%, transparent 34%, transparent 66.6%, rgba(255, 255, 255, 0.3) 66.6%, rgba(255, 255, 255, 0.3) 67%, transparent 67%);
}

.crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }

/* -------------------------------------------------------------
   Multi-Image Gallery (Visitor & Admin)
   ------------------------------------------------------------- */
.detail-gallery-strip {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.detail-gallery-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  object-fit: cover;
  cursor: pointer;
  opacity: 0.75;
  transition: all 0.15s ease;
  background: #f1f5f9;
  flex-shrink: 0;
}

.detail-gallery-thumb:hover {
  opacity: 1;
  border-color: var(--primary);
}

.detail-gallery-thumb.active {
  opacity: 1;
  border-color: #006837;
  box-shadow: 0 0 0 2px rgba(0, 104, 55, 0.25);
}

/* Admin Gallery Management */
.gallery-management-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.gallery-section-header {
  margin-bottom: 0.75rem;
}

.gallery-section-header h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.gallery-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.gallery-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.gallery-slot-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

.gallery-slot-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #0f172a;
}

.gallery-slot-meta {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.gallery-slot-tag {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
}

.gallery-slot-delete {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.gallery-slot-delete:hover {
  background: #fee2e2;
}

.gallery-add-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem;
  background: #f1f5f9;
  border-radius: var(--radius-md);
}

/* -------------------------------------------------------------
   Audit Logs Badges
   ------------------------------------------------------------- */
.audit-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-login { background: #e0f2fe; color: #0369a1; }
.badge-create { background: #ecfdf5; color: #047857; }
.badge-update { background: #fef3c7; color: #b45309; }
.badge-toggle { background: #f3e8ff; color: #7e22ce; }
.badge-upload { background: #ecfdf5; color: #059669; }
.badge-delete { background: #fee2e2; color: #b91c1c; }
.badge-backup { background: #e0e7ff; color: #3730a3; }
.badge-export { background: #f1f5f9; color: #334155; }
.badge-password { background: #fef08a; color: #854d0e; }

/* -------------------------------------------------------------
   Voice Search (Thai Web Speech API)
   ------------------------------------------------------------- */
.search-voice-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.35rem;
  flex-shrink: 0;
}

.search-voice-btn:hover {
  background: #f1f5f9;
  color: #006837;
  border-color: #006837;
}

.search-voice-btn.listening {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
}

.voice-pulse-ring {
  display: none;
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  animation: voicePulse 1.2s infinite ease-out;
}

.search-voice-btn.listening .voice-pulse-ring {
  display: block;
}

@keyframes voicePulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 0.4; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* -------------------------------------------------------------
   Mobile Connect & PWA Modal
   ------------------------------------------------------------- */
.mobile-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.qr-canvas-wrap {
  padding: 12px;
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
}

.qr-instruction-text {
  margin: 1rem 0 0.75rem 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.5;
}

.url-copy-box {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 360px;
}

.url-copy-box input {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: #ffffff;
  color: #006837;
  font-family: monospace;
}

.pwa-platform-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  text-align: left;
}

.pwa-step-box {
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: #334155;
}

.pwa-step-box strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  color: #0f172a;
}

/* -------------------------------------------------------------
   Excel Batch Diff & Sync
   ------------------------------------------------------------- */
.excel-dropzone {
  border: 2px dashed #006837;
  border-radius: var(--radius-lg);
  background: #f0fdf4;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.excel-dropzone.dragover {
  background: #dcfce7;
  border-color: #059669;
}

.diff-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.diff-stat-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid transparent;
}

.diff-stat-card.stat-new {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.diff-stat-card.stat-updated {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.diff-stat-card.stat-unchanged {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

.diff-stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
}

.diff-stat-label {
  font-size: 0.82rem;
  font-weight: 500;
}

.diff-table-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.diff-table-header {
  padding: 0.6rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
}

.diff-badge-new {
  background: #d1fae5;
  color: #065f46;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.diff-badge-updated {
  background: #fef3c7;
  color: #92400e;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.diff-change-field {
  margin-bottom: 0.2rem;
  line-height: 1.4;
}

.diff-change-field .old-val {
  text-decoration: line-through;
  color: #94a3b8;
  margin-right: 0.3rem;
}

.diff-change-field .new-val {
  color: #006837;
  font-weight: 600;
}

/* -------------------------------------------------------------
   Popular Keywords Quick Bar (Visitor Hero)
   ------------------------------------------------------------- */
.popular-keywords-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.popular-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.popular-tags-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.popular-keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.22rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popular-keyword-chip:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 104, 55, 0.2);
}

/* -------------------------------------------------------------
   Search Analytics & Insights Modal (Admin)
   ------------------------------------------------------------- */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.analytics-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem 0.85rem;
  text-align: center;
  color: #334155;
  transition: all 0.2s ease;
}

.analytics-kpi-card .kpi-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-kpi-card .kpi-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.analytics-kpi-card.stat-warn .kpi-num {
  color: #e11d48;
}

.analytics-kpi-card.stat-success .kpi-num {
  color: #006837;
}

.analytics-tabs-bar {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.analytics-tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -4px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.analytics-tab-btn:hover {
  color: var(--primary-color);
}

.analytics-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.methods-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding: 0.5rem 0;
}

.method-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
}

.method-card-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.method-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.method-card-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.method-card-pct {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

.method-progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.method-progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* -----------------------------------------------------------
   MEDICAL SYNONYM DICTIONARY & NOTICE BAR
----------------------------------------------------------- */
.synonym-notice-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #a7f3d0;
  border-left: 4px solid var(--primary-color);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: #065f46;
  animation: fadeIn 0.25s ease-out;
}

.synonym-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.synonym-notice-text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.synonym-tags-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.synonym-chip {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #10b981;
  color: #047857;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.8rem;
}

/* Admin Synonym Box & Form */
.synonym-add-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.synonym-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .synonym-form-grid {
    grid-template-columns: 1fr;
  }
}



