/* Unified CSS for barcode page — includes header/footer and page-specific styles
   This allows `barcode.html` to use only this stylesheet. Theme matches preference-edit.css */

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

/* Body styling and page background */
body {
  background-color: #d2b48c;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(75, 83, 32, 0.1) 0,
    rgba(75, 83, 32, 0.1) 10px,
    transparent 10px,
    transparent 20px
  );
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  color: #2f3e1c;
  min-height: 100vh;

  /* Ensure fixed header/footer don't cover content */
  padding-top: 72px;
  padding-bottom: 72px;
}

/* Header and nav (copied from common.css) */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: #4b5320;
  color: #f0e6d2;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(139, 69, 19, 0.15) 0,
      rgba(139, 69, 19, 0.15) 10px,
      rgba(160, 82, 45, 0.15) 10px,
      rgba(160, 82, 45, 0.15) 20px
    ),
    linear-gradient(to right, rgba(75, 83, 32, 1), rgba(75, 83, 32, 0));
  background-repeat: repeat;
  background-size: auto, 40px 40px, 100% 100%;
  background-blend-mode: overlay, multiply;
}

header img.logo {
  width: 4rem;
  height: 4rem;
  margin-right: 1rem;
}

header h3 {
  margin-right: 40px;
  font-size: 1.8rem;
  flex-shrink: 0;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

nav ul li a {
  text-decoration: none;
  color: #d2b48c;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background-color 0.3s, color 0.3s;
  position: relative;
  padding-bottom: 8px;
}

nav ul li a:hover {
  background-color: #7c6f42;
  color: #f0e6d2;
  box-shadow: 0 0 8px 2px rgba(143, 151, 121, 0.7);
}

nav ul li a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 3px;
  background-color: #8f9779;
  transition: width 0.3s ease;
  border-radius: 2px;
}

nav ul li a:hover::after,
nav ul li a.active::after {
  width: 100%;
}

/* Footer (copied from common.css) */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #4b5320;
  color: #f0e6d2;
  text-align: center;
  padding: 6px 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.85rem;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(139, 69, 19, 0.15) 0,
      rgba(139, 69, 19, 0.15) 10px,
      rgba(160, 82, 45, 0.15) 10px,
      rgba(160, 82, 45, 0.15) 20px
    ),
    linear-gradient(to right, rgba(75, 83, 32, 1), rgba(75, 83, 32, 0));
  background-repeat: repeat;
  background-size: 40px 40px;
  background-blend-mode: multiply;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

/* Layout for main content — card look */
main {
  max-width: 980px;
  margin: 24px auto 40px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(240,230,210,0.95), rgba(245,240,230,0.95));
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(47,62,28,0.10);
  border: 1px solid rgba(143,151,121,0.12);
  color: #2f3e1c;
}

h2 { margin-top: 0; color: #4b5320; }

.controls {
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:14px;
}

/* Buttons — earthy, tactile */
button {
  padding:10px 14px;
  border-radius:10px;
  border:1px solid rgba(124,111,66,0.18);
  background: linear-gradient(180deg,#f0e6d2,#efe8d7);
  color: #3b4a1c;
  font-weight:600;
  cursor:pointer;
  box-shadow: 0 4px 10px rgba(75,83,32,0.06);
}

button.warn {
  background: linear-gradient(180deg,#fff3f3,#ffecec);
  border-color: #f1a0a0;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint { color:#6b6b5f; margin-top:12px; font-size:0.95rem; }

#status {
  margin-top:16px;
  padding:12px 14px;
  border-radius:8px;
  background: rgba(75,83,32,0.03);
  color: #2f3e1c;
  min-height: 24px;
}

video, img#preview {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #0f0f0f;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  display:block;
  margin-top:18px;
}

@media (max-width: 560px) {
  .controls { gap:8px; }
  main { margin: 88px 12px 120px; padding:16px; }
  button { flex: 1 1 48%; }
}

/* Result container (for server-rendered fragment) */
#barcodeResult {
  margin-top:18px;
  padding:12px;
  background: rgba(140,151,121,0.04);
  border-radius: 8px;
  border: 1px solid rgba(143,151,121,0.06);
}

.controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(75,83,32,0.12);
}

.hint small { color: #6b6b5f; }
