/* ==========================================================================
   components.css — ปุ่ม / การ์ด / ไอคอน / แท็บ / ตาราง / modal / ฟอร์ม
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 24px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; pointer-events: none; }

.btn--primary { background: var(--c-primary); color: #fff; box-shadow: 0 8px 18px rgba(22, 86, 184, .25); }
.btn--primary:hover { background: var(--c-primary-hover); color: #fff; }

.btn--outline { background: #fff; color: var(--c-primary); border-color: var(--c-primary); }
.btn--outline:hover { background: var(--c-primary); color: #fff; }

.btn--ghost { background: var(--c-tint); color: var(--c-primary); }
.btn--ghost:hover { background: #d8e8fa; color: var(--c-primary-hover); }

.btn--line { background: var(--c-line-app); color: #fff; box-shadow: 0 8px 18px rgba(6, 199, 85, .22); }
.btn--line:hover { background: var(--c-line-app-hover); color: #fff; }

.btn--navy { background: var(--c-navy-2); color: #fff; }
.btn--navy:hover { background: var(--c-navy); color: #fff; }

.btn--white { background: #fff; color: var(--c-navy); }
.btn--white:hover { background: var(--c-tint); color: var(--c-navy); }

.btn--sm { min-height: 40px; padding: 7px 16px; font-size: 14px; }
.btn--block { width: 100%; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14.5px;
}
.link-arrow svg { width: 16px; height: 16px; transition: transform .2s; }
.link-arrow:hover svg { transform: translateX(3px); }

/* ---------- Icon badge ---------- */
.icon-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--c-tint);
  color: var(--c-primary);
}
.icon-badge svg { width: 24px; height: 24px; }
.icon-badge--round { border-radius: 50%; }
.icon-badge--solid { background: var(--c-primary); color: #fff; }

/* ---------- Check list ---------- */
.check-list { display: grid; gap: 10px 28px; }
.check-list--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-list li { position: relative; padding-left: 30px; }
.check-list li::before {
  content: "";
  position: absolute;
  left: 0; top: .28em;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--c-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 13px no-repeat;
}

/* ---------- Media frame ---------- */
.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--c-tint-2);
  border: 1px solid var(--c-line);
}
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-frame--contain img { object-fit: contain; padding: 24px; }

/* ---------- Image placeholder (รอรูปจริง) ---------- */
.ph {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-height: 120px;
  padding: 16px;
  border: 1px dashed #c9d8ea;
  border-radius: var(--radius);
  background: var(--c-tint-2);
  color: #8aa0bd;
  font-size: 13px;
  text-align: center;
}
.ph svg { width: 34px; height: 34px; opacity: .7; }

/* ---------- Product card ---------- */
.p-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--c-text);
  text-align: left;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.p-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #bcd2ee; color: var(--c-text); }
.p-card__media { position: relative; aspect-ratio: 4 / 3; background: var(--c-tint-2); overflow: hidden; }
.p-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.p-card:hover .p-card__media img { transform: scale(1.05); }
.p-card__media .ph { border: 0; border-radius: 0; }
.p-card__body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.p-card__title { margin: 0 0 4px; font-size: 17px; color: var(--c-navy); }
.p-card__text { margin: 0 0 12px; font-size: 14px; color: var(--c-muted); line-height: 1.55; }
.p-card__more { margin-top: auto; color: var(--c-primary); }

.tag {
  position: absolute;
  top: 12px; left: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 26, 56, .55);
  backdrop-filter: blur(3px);
  animation: fade .2s;
}
.modal[hidden] { display: none; }
.modal__box {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 30px 80px rgba(8, 26, 56, .35);
  animation: fade-up .3s var(--ease);
}
.modal__media { background: var(--c-tint-2); min-height: 260px; }
.modal__media img { width: 100%; height: 100%; object-fit: cover; }
.modal__media .ph { border: 0; border-radius: 0; }
.modal__body { padding: 32px; }
.modal__body h3 { font-size: 24px; margin-bottom: 8px; }
.modal__body > p { color: var(--c-muted); }
.modal__body .check-list { margin: 16px 0 20px; font-size: 14.5px; }
.modal__label { margin: 18px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--c-navy); }
.modal__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.modal__chips li {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--c-tint);
  color: var(--c-navy-2);
  font-size: 13px;
}
.modal__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.modal__close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--c-navy);
  box-shadow: var(--shadow-sm);
}
.modal__close svg { width: 18px; height: 18px; }
body.has-modal { overflow: hidden; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13.5px; font-weight: 700; color: var(--c-navy); }
.field .opt { font-weight: 400; color: var(--c-muted); }
.req { color: var(--c-closed); }

.input {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--c-sky); box-shadow: 0 0 0 3px rgba(47, 143, 224, .18); }
textarea.input { min-height: 84px; resize: vertical; }
select.input {
  appearance: none;
  padding-right: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6f8c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 12px center / 16px no-repeat;
}
.input::placeholder { color: #9aabc3; }
.field-hint { margin: 0; font-size: 12.5px; color: var(--c-muted); }
.field-error { display: none; margin: 0; font-size: 12.5px; color: var(--c-closed); }
.field.has-error .input { border-color: var(--c-closed); box-shadow: 0 0 0 3px rgba(224, 86, 79, .12); }
.field.has-error .field-error { display: block; }
.is-hidden { display: none !important; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
