/* ============================================================
   TAEKMO Product Verification — style.css
   Pure CSS3, no frameworks
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green:        #40b37f;
  --green-dark:   #339966;
  --green-hover:  #37a373;
  --green-light:  #e8f7f0;
  --logo-mo:      #c8c000;   /* yellow-olive for "MO" part of logo */
  --text-main:    #333333;
  --text-muted:   #888888;
  --text-light:   #aaaaaa;
  --border:       #dddddd;
  --card-shadow:  0 4px 24px rgba(0,0,0,0.13);
  --radius:       8px;
  --font:         'Roboto', Arial, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text-main);
  background: #f2f2f2;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Page-load progress bar ---------- */
.top-bar {
  height: 3px;
  background: transparent;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.5s ease 0.2s;
}

.top-bar.done {
  opacity: 0;
}

.top-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 0 8px rgba(64, 179, 127, 0.6);
}

.top-bar-fill.loading {
  width: 85%;
  transition: width 1.8s cubic-bezier(0.1, 0.05, 0.2, 1);
}

.top-bar-fill.complete {
  width: 100%;
  transition: width 0.25s ease;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed;
  top: 4px;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  z-index: 100;
  height: 52px;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.logo {
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0px;
  line-height: 1;
  font-family: Arial, Helvetica, sans-serif;
}

/* "TAEK" in bright green */
.logo-taek {
  color: #3db37f;
}

/* "MO" in yellow-olive — matches reference exactly */
.logo-mo {
  color: #b8b800;
}

/* ---------- Main layout ---------- */
.main-content {
  padding-top: 76px; /* header (52) + topbar (4) + gap (20) */
  padding-bottom: 60px;
  min-height: 100vh;
}

/* ---------- Hero section ---------- */
.hero-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
}

.hero-banner {
  background: var(--green);
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
  padding: 36px 24px 52px;
}

.hero-title {
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  line-height: 1;
}

/* ---------- Card ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 0 40px 36px;
  position: relative;
  margin-bottom: 0;
  margin-top: -28px;
}

/* ---- Card label ---- */
.card-label {
  font-size: 14px;
  color: var(--text-main);
  text-align: center;
  padding: 28px 0 14px;
}

/* ---- Barcode input ---- */
.input-barcode {
  display: block;
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
  margin-bottom: 10px;
}

.input-barcode:focus {
  border-color: var(--green);
}

.input-barcode.error {
  border-color: #e53935;
}

/* ---- CAPTCHA row ---- */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.input-captcha {
  flex: 1;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 0 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.input-captcha:focus {
  border-color: var(--green);
}

.input-captcha.error {
  border-color: #e53935;
}

.captcha-block {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#captcha-canvas {
  display: block;
  border: 1.5px solid #bbb;
  border-radius: 4px;
  cursor: default;
  background: #f5f5f5;
  width: 92px;
  height: 36px;
}

.captcha-refresh {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.captcha-refresh:hover {
  color: var(--green);
  background: var(--green-light);
}

.captcha-refresh svg {
  display: block;
}

/* ---- Search button ---- */
.btn-search {
  display: block;
  width: 100%;
  height: 44px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
  margin-bottom: 28px;
}

.btn-search:hover {
  background: var(--green-hover);
}

.btn-search:active {
  transform: scale(0.98);
}

/* ---- Barcode help section ---- */
.barcode-help {
  text-align: center;
}

.help-text {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.barcode-image-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.barcode-photo {
  width: 280px;
  height: auto;
  border-radius: 6px;
  display: block;
  border: 1px solid #ddd;
}

.db-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- Inline error toast (card overlay) ---------- */
/*
 * The error toast appears overlaid on the input area of the card,
 * matching the reference screenshot style.
 */
.toast {
  position: absolute;
  /* sits over the barcode-input + captcha area */
  top: 68px;
  left: 40px;
  right: 40px;
  background: rgba(28, 28, 28, 0.93);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  text-align: left;
  line-height: 1.4;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Result Card (Query Results page) ---------- */
.result-card {
  background: #fff;
  border-radius: var(--radius) !important;
  box-shadow: var(--card-shadow);
  padding: 0 !important;
  margin-top: 0 !important;
  overflow: hidden;
  animation: fadeInUp 0.38s ease both;
}

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

/* Solar panel hero image */
.result-hero-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

/* The content below the image */
.result-body {
  padding: 28px 40px 36px;
}

.result-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 10px;
}

/* Success state: show the data table */
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.result-table tr {
  border-bottom: 1px solid #f0f0f0;
}

.result-table tr:last-child {
  border-bottom: none;
}

.result-key {
  font-size: 13.5px;
  color: var(--text-muted);
  padding: 12px 0;
  width: 40%;
  vertical-align: middle;
  white-space: nowrap;
}

.result-val {
  font-size: 13.5px;
  color: var(--text-main);
  padding: 12px 0;
  font-weight: 700;
  vertical-align: middle;
}

/* Module barcode uses monospace */
#result-barcode {
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
  word-break: break-all;
}

/* Module Type row — two bold values with spacing */
.module-type-inner {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Not-found message */
.result-not-found {
  font-size: 13.5px;
  color: #555;
  margin-top: 4px;
  margin-bottom: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  padding: 9px 0;
  margin-top: 24px;
  width: 100%;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-back:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-light);
}

/* ---------- Utility ---------- */
[hidden] {
  display: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .card {
    padding: 0 18px 28px;
  }

  .result-body {
    padding: 20px 18px 28px;
  }

  .hero-title {
    font-size: 28px;
  }

  .hero-banner {
    padding: 28px 18px 44px;
  }

  .hero-section {
    padding: 0 8px;
  }

  .barcode-photo {
    width: 230px;
  }

  .result-key {
    width: 38%;
    font-size: 12.5px;
  }

  .result-val {
    font-size: 12.5px;
  }

  .captcha-row {
    flex-wrap: nowrap;
  }

  .toast {
    left: 18px;
    right: 18px;
    font-size: 12.5px;
  }

  .result-hero-img {
    height: 180px;
  }
}

@media (max-width: 380px) {
  .card {
    padding: 0 12px 20px;
  }

  .hero-title {
    font-size: 24px;
    letter-spacing: 3px;
  }

  .toast {
    left: 12px;
    right: 12px;
  }
}
