/* GS1 Dedicated Ethics Scanner Stylesheet */

:root {
  --bg-color: #F7F3EA;
  --primary-color: #195b75;
  --primary-rgb: 25, 91, 117;
  --text-color: #252A27;
  --btn-color: #6490b5;
  --btn-hover: #527c9f;
  --accent-color: #e67e22;
  --success-color: #2ecc71;
  --danger-color: #e74c3c;
  
  --card-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(25, 91, 117, 0.12);
  --shadow: 0 8px 32px 0 rgba(25, 91, 117, 0.06);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 16px;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  line-height: 1.5;
}

.app-container {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100vh - 32px);
  position: relative;
}

/* Header */
.app-header {
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.header-logo {
  width: 32px;
  height: 32px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-color);
  opacity: 0.8;
  max-width: 90%;
  margin: 0 auto;
}

/* Main Content */
.app-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  position: relative;
}

/* Resolver Loading Overlay */
.resolver-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(247, 243, 234, 0.95);
  border-radius: var(--border-radius);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 24px;
  animation: fadeIn 0.3s ease-in-out forwards;
}

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

.spinner-container {
  position: relative;
  width: 64px;
  height: 64px;
}

.spinner {
  width: 100%;
  height: 100%;
  border: 4px solid rgba(25, 91, 117, 0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.resolver-overlay h2 {
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 700;
}

.resolver-overlay p {
  font-size: 0.875rem;
  opacity: 0.7;
}

/* Scanner Card */
.scanner-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: 0 4px 12px rgba(25, 91, 117, 0.03);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.viewport-container {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--primary-color);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
  transition: opacity 0.3s ease;
  background: rgba(0, 0, 0, 0.4);
}

.scanner-overlay.inactive {
  opacity: 0;
  display: none;
}

.scan-region {
  position: relative;
  width: 60%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4);
}

.corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 4px solid var(--bg-color);
}

.top-left { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.top-right { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.bottom-left { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.bottom-right { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

.scan-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--btn-color);
  box-shadow: 0 0 8px var(--btn-color);
  animation: scan 2.5s infinite linear;
  top: 0;
}

@keyframes scan {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

.scan-instructions {
  position: absolute;
  bottom: 12px;
  color: #fff;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.scanner-controls {
  display: flex;
  justify-content: center;
}

/* Accordion for Manual Input */
.manual-input-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(25, 91, 117, 0.03);
  transition: var(--transition);
}

.accordion-header {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  color: var(--primary-color);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
}

.accordion-arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.accordion-header.active .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding: 0 16px;
}

.accordion-content.open {
  max-height: 200px;
  padding: 0 16px 16px 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-color);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group {
  display: flex;
  gap: 8px;
}

input[type="text"] {
  flex: 1;
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

input[type="text"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(25, 91, 117, 0.15);
}

.test-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.test-badge {
  font-size: 0.7rem;
  background: rgba(25, 91, 117, 0.08);
  color: var(--primary-color);
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.test-badge:hover {
  background: rgba(25, 91, 117, 0.15);
}

/* Fallback Results UI */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.fallback-card {
  background: #fff;
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(25, 91, 117, 0.05);
}

.fallback-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fallback-icon {
  font-size: 3rem;
  line-height: 1;
}

.fallback-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.product-metadata {
  background: rgba(25, 91, 117, 0.04);
  border: 1px dashed var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.meta-label {
  font-weight: 600;
  opacity: 0.7;
}

.meta-value {
  font-family: monospace;
  color: var(--primary-color);
}

.fallback-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-note {
  border-left: 3px solid var(--primary-color);
  padding-left: 12px;
  margin-top: 4px;
}

.info-note h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.info-note p {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.85;
}

.info-note code {
  background: rgba(25, 91, 117, 0.08);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--bg-color);
}

.btn-primary:hover {
  background-color: #124458;
}

.btn-accent {
  background-color: var(--btn-color);
  color: #fff;
}

.btn-accent:hover {
  background-color: var(--btn-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background: rgba(25, 91, 117, 0.05);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Footer */
.app-footer {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.75rem;
  color: var(--text-color);
  opacity: 0.7;
}

.app-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Utility */
.hidden {
  display: none !important;
}
