/* ==========================================================================
   TENALI DOUBLE HORSE - COA VERIFICATION PORTAL STYLES
   Mobile-First, Professional FMCG Branding
   ========================================================================== */

:root {
  --primary: #8b111b;
  --primary-hover: #700a12;
  --primary-light: #fff1f2;
  --gold: #d4af37;
  --gold-dark: #aa771c;
  --gold-light: #fef9c3;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #8b111b;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- Layout & Header ---------------- */
.header-top {
  background: #ffffff;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  padding: 0.75rem 0;
  position: relative;
}

.header-top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4af37, #8b111b, #d4af37);
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logo-img {
  height: 44px;
  width: auto;
  max-width: 100%;
  display: block;
}

@media (max-width: 480px) {
  .brand-logo-img {
    height: 36px;
  }
}

.admin-nav-link {
  color: #8b111b;
  text-decoration: none;
  font-size: 0.825rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.admin-nav-link:hover {
  background: #8b111b;
  color: #ffffff;
  border-color: #8b111b;
  transform: translateY(-1px);
}

/* Trust Badges Strip */
.trust-strip {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: #334155;
}

.trust-item svg {
  color: var(--gold-dark);
}

/* ---------------- Hero Section ---------------- */
.hero-section {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}

.hero-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 550px;
  margin: 0 auto;
}

/* ---------------- Search Card ---------------- */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.search-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--primary), var(--gold));
}

.search-form-group {
  margin-bottom: 1.25rem;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.5rem;
}

.search-box-wrap {
  position: relative;
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

@media (min-width: 600px) {
  .search-box-wrap {
    flex-direction: row;
  }
}

.search-input {
  flex: 1;
  height: 52px;
  padding: 0 1.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: monospace, -apple-system, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-main);
  background: #f8fafc;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  width: 100%;
}

.search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 17, 27, 0.12);
}

.btn-search {
  height: 52px;
  padding: 0 1.75rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(139, 17, 27, 0.25);
}

.btn-search:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-search:active {
  transform: translateY(0);
}

.quick-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sample-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: monospace;
  text-decoration: underline;
}

.sample-badge:hover {
  background: #ffe4e6;
}

.toggle-guide-link {
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
}

.toggle-guide-link:hover {
  text-decoration: underline;
}

/* Pack Guide Card */
.pack-guide-container {
  margin-top: 1rem;
  padding: 1rem;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  border: 1px dashed #cbd5e1;
  display: none;
}

.pack-guide-container.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.pack-guide-img {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: block;
}

/* ---------------- Result Cards ---------------- */
.result-container {
  margin-bottom: 2rem;
}

.card-verified {
  background: #ffffff;
  border: 2px solid #86efac;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.35s ease;
}

.verified-header {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.verified-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.verified-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.verified-sub {
  font-size: 0.85rem;
  opacity: 0.9;
}

.verified-body {
  padding: 1.5rem 1.25rem;
}

.cert-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 520px) {
  .cert-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.detail-item {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.detail-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

.badge-batch {
  font-family: monospace;
  color: var(--primary);
  font-size: 1.15rem;
}

/* Action Buttons */
.action-btn-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .action-btn-row {
    flex-direction: row;
  }
}

.btn-action {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary-action {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  box-shadow: 0 4px 6px rgba(139, 17, 27, 0.2);
}

.btn-primary-action:hover {
  background: var(--primary-hover);
}

.btn-secondary-action {
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
}

.btn-secondary-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Error Card */
.card-not-found {
  background: #ffffff;
  border: 2px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.35s ease;
}

.not-found-icon {
  width: 54px;
  height: 54px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal for PDF Preview */
.pdf-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pdf-modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.pdf-modal-content {
  background: #ffffff;
  width: 100%;
  max-width: 900px;
  height: 90vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
}

.pdf-modal-header {
  padding: 1rem 1.25rem;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pdf-modal-title {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close-modal {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.4);
}

.pdf-frame-wrapper {
  flex: 1;
  background: #e2e8f0;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------------- Footer ---------------- */
.main-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.825rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
}

/* ---------------- Admin Panel Styles ---------------- */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.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: 700;
  color: #475569;
  border-bottom: 1px solid var(--border);
}

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

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

/* Form Styles */
.form-control {
  width: 100%;
  height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 17, 27, 0.1);
}

.form-group {
  margin-bottom: 1rem;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  display: none;
}

.toast-notice.show {
  display: block;
  animation: slideUp 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
