/* assets/css/style.css - Frontend Styles matching JHM READY STOCK dashboard */

:root {
  --primary-navy: #193855;
  --secondary-navy: #183153;
  --accent-orange: #d9531e;
  --accent-orange-hover: #bf4314;
  --accent-green: #15803d;
  --bg-light: #f3f6f9;
  --bg-card: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --placeholder-bg: #eaeff4;
  /* ปรับฟอนต์ให้ตรงตามมาตรฐานสากลและรูปตัวอย่าง */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* TOP HEADER */
.top-header {
  background-color: var(--primary-navy);
  color: #ffffff;
  padding: 24px 32px 20px 32px;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.brand-section h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.brand-section p {
  font-size: 13px;
  color: #9bb1c9;
  max-width: 650px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-btn {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

.quote-list-btn {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.quote-list-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

.quote-badge {
  background-color: var(--accent-orange);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.admin-link-btn {
  color: #9bb1c9;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.2s;
}

.admin-link-btn:hover {
  color: #ffffff;
}

/* STATS ROW */
.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-item {
  font-size: 14px;
  color: #9bb1c9;
}

.stat-item strong {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin-right: 4px;
}

/* MAIN CONTAINER */
.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* HERO SECTION */
.hero-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: grid;
  grid-template-columns: 460px 1fr;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.hero-media {
  position: relative;
  background-color: #cbd5e1;
  min-height: 250px;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-caption {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.hero-content {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary-navy);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  line-height: 1.25;
}

.hero-desc {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 16px;
}

.hero-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-bullets li {
  font-size: 13px;
  color: #334155;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.bullet-square {
  width: 8px;
  height: 8px;
  background-color: var(--accent-orange);
  margin-top: 6px;
  flex-shrink: 0;
}

/* SEARCH & FILTER BAR */
.filter-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  width: 17px;
  height: 17px;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #f8fafc;
}

.search-input:focus {
  border-color: #3b82f6;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sort-select {
  padding: 9px 32px 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  color: #334155;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") no-repeat right 8px center/14px;
  appearance: none;
  cursor: pointer;
  outline: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-orange);
  cursor: pointer;
}

/* CONTENT LAYOUT (SIDEBAR + GRID) */
.content-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

/* SIDEBAR PANEL & FILTERS (Category & Brand) */
.sidebar-panel {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-section {
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #64748b;
  padding: 0 8px 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.category-list,
.brand-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.category-list::-webkit-scrollbar,
.brand-list::-webkit-scrollbar {
  width: 5px;
}
.category-list::-webkit-scrollbar-thumb,
.brand-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.category-btn,
.brand-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.category-btn:hover,
.brand-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.category-btn.active,
.brand-btn.active {
  background-color: var(--primary-navy);
  color: #ffffff;
  font-weight: 700;
}

.category-btn.active .cat-count,
.category-btn.active .brand-count,
.brand-btn.active .brand-count {
  color: rgba(255, 255, 255, 0.85);
}

.cat-name,
.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.cat-count,
.brand-count {
  font-size: 11.5px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* MAIN CATALOG GRID */
.catalog-main {
  min-width: 0;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.catalog-title {
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-navy);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

/* PRODUCT CARD */
.product-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  position: relative;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.card-img-wrap {
  background-color: var(--placeholder-bg);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.placeholder-box {
  width: 82%;
  height: 70%;
  border: 1px dashed #b8c7d6;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
}

.placeholder-cat {
  font-size: 13px;
  font-weight: 800;
  color: #4b6b94;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
}

.placeholder-brand {
  font-size: 11px;
  color: #7d96b3;
  margin-top: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.card-body {
  padding: 14px 14px 12px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-brand {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}

.card-code {
  font-size: 11.5px;
  color: #64748b;
  font-family: monospace, sans-serif;
  margin-bottom: 8px;
}

.card-stock {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: 14px;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.card-category-tag {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-add-quote {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #0f172a;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-add-quote:hover {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #ffffff;
}

.btn-add-quote.added {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

/* PAGINATION */
.pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 24px 0 48px 0;
}

.page-btn {
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}

.page-btn.active {
  background: var(--primary-navy);
  border-color: var(--primary-navy);
  color: #ffffff;
}

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

/* POPUP DETAIL MODAL */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 10px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
}

.modal-title {
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  color: #0f172a;
  letter-spacing: 0.3px;
  line-height: 1.25;
  padding-right: 12px;
}

.modal-close-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.modal-body {
  padding: 22px;
}

/* MODAL GALLERY */
.modal-gallery {
  margin-bottom: 20px;
}

.modal-main-image-wrap {
  background-color: #e5ebf1;
  height: 280px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}

.modal-main-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.modal-thumb {
  width: 58px;
  height: 58px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: #eaeff4;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-thumb:hover {
  border-color: #94a3b8;
}

.modal-thumb.active {
  border-color: var(--accent-orange);
}

/* INFO BOXES ROW */
.info-boxes-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.info-box {
  background: #f1f5f9;
  border-radius: 6px;
  padding: 10px 12px;
}

.info-box-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}

.info-box-value {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  word-break: break-all;
}

/* ACTION ROW */
.action-card-row {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: #ffffff;
}

.price-text {
  font-size: 14.5px;
  font-weight: 600;
  color: #334155;
}

.action-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #475569;
}

.qty-input {
  width: 60px;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  outline: none;
}

.qty-input:focus {
  border-color: #3b82f6;
}

.btn-add-quote-modal {
  background-color: var(--accent-orange);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-add-quote-modal:hover {
  background-color: var(--accent-orange-hover);
}

/* SPECIFICATIONS TABLE */
.specs-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
}

.specs-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #0f172a;
  margin-bottom: 12px;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table tr {
  border-bottom: 1px solid #f1f5f9;
}

.specs-table td {
  padding: 10px 4px;
  font-size: 13px;
  vertical-align: top;
}

.specs-table td.spec-name {
  width: 32%;
  color: #64748b;
  font-weight: 500;
}

.specs-table td.spec-val {
  color: #0f172a;
  font-weight: 600;
}

/* QUOTE CART DRAWER / MODAL */
.quote-drawer {
  position: fixed;
  top: 0;
  right: -550px;
  width: 100%;
  max-width: 520px;
  height: 100%;
  background: #ffffff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1100;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.quote-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-navy);
  color: #ffffff;
}

.drawer-title {
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.quote-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quote-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.quote-item-thumb {
  width: 48px;
  height: 48px;
  background: #e2e8f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.quote-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quote-item-details {
  flex: 1;
  min-width: 0;
}

.quote-item-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-item-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.quote-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
}

.quote-item-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
}

/* QUOTE FORM */
.quote-form-section {
  border-top: 1px solid var(--border-color);
  padding-top: 18px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 1