/*
Filename: style.css
Last Edit Date: 2026-10-15 EST
Purpose: Shared styles for the Inventory app (dark yellow/gold accent).
*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #8a6d00;
  --brand-light: #fff8e1;
  --brand-mid:   #b8940a;
  --green:       #2e7d32;
  --green-light: #e8f5e9;
  --green-mid:   #4caf50;
  --red:         #c62828;
  --red-light:   #ffebee;
  --amber:       #e65100;
  --amber-light: #fff3e0;
  --gray-50:     #fafafa;
  --gray-100:    #f5f5f5;
  --gray-200:    #eeeeee;
  --gray-300:    #e0e0e0;
  --gray-500:    #9e9e9e;
  --gray-700:    #616161;
  --gray-900:    #212121;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.10);
  --shadow-md:   0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.15);
  --radius:      10px;
  --radius-sm:   6px;
  --transition:  .18s ease;
}

html { font-size: 16px; }
html, body { width: 100%; min-width: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  min-width: 100vw;
  overflow-x: hidden;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font: inherit; }

.hidden   { display: none !important; }
.app-bootstrap-loading #screen-auth,
.app-bootstrap-loading #screen-app {
  display: none !important;
}

.app-bootstrap-loading #screen-loading {
  display: block !important;
}

.container{ width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 16px 40px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.flex { display: flex; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.site-header, .screen { width: 100vw; min-width: 100vw; }
.site-header { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 200; }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon-img { width: 40px; height: 40px; object-fit: contain; display: block; }
.brand-name { font-size: 1.1rem; font-weight: 700; letter-spacing: .3px; }
.brand-sub  { font-weight: 400; opacity: .85; }
.brand-version { font-size: .75em; font-weight: 400; opacity: .7; white-space: nowrap; }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-name-label { font-size: .82rem; opacity: .9; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .site-header .header-inner {
    height: auto;
    min-height: 76px;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: 8px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .site-header .brand {
    width: 100%;
    justify-content: center;
  }

  .site-header .brand-name {
    line-height: 1.25;
  }

  .site-header .header-user {
    width: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
  }

  .site-header .header-name-label {
    display: none;
  }

  .site-header .header-user .btn {
    width: 100%;
    max-width: 220px;
  }

  .site-header .brand-icon-img {
    width: 36px;
    height: 36px;
  }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border: 2px solid transparent; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: .875rem; line-height: 1; transition: background var(--transition), color var(--transition), border-color var(--transition); white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #0d47a1; }
.btn-green   { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: #1b5e20; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8e0000; }
.btn-amber   { background: var(--amber); color: #fff; }
.btn-amber:hover:not(:disabled) { background: #bf360c; }
.btn-outline { background: transparent; border-color: currentColor; }
.btn-outline.btn-primary { color: var(--brand); }
.btn-outline.btn-primary:hover:not(:disabled) { background: var(--brand-light); }
.btn-outline.btn-danger  { color: var(--red); }
.btn-outline.btn-danger:hover:not(:disabled)  { background: var(--red-light); }
.btn-ghost { background: transparent; color: var(--gray-700); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--gray-200); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-xs { padding: 3px 7px; font-size: .75rem; }
.btn-full { width: 100%; }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.card + .card { margin-top: 20px; }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: var(--gray-700); }
input[type=text], input[type=number], input[type=password], select, textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); background: #fff; transition: border-color var(--transition); font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(138,109,0,.15); }
textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

.screen { padding-top: 32px; }
.auth-login-wrap { max-width: 400px; margin: 60px auto 0; text-align: center; }
.auth-login-wrap h2 { margin-bottom: 12px; }
.auth-login-copy { color: var(--gray-700); margin-bottom: 20px; font-size: .9rem; }
.auth-login-icon { font-size: 3rem; margin-bottom: 12px; }
.hint { font-size: .82rem; color: var(--gray-500); margin-top: 6px; }
.error-msg { color: var(--red); font-size: .85rem; margin-top: 6px; }

.loading-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 60px; color: var(--gray-500); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--gray-300); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-title  { font-size: 1.05rem; font-weight: 700; }
.modal-close-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--gray-500); padding: 4px 8px; border-radius: 4px; }
.modal-close-btn:hover { background: var(--gray-200); }
.modal-body  { padding: 20px; }
.modal-body .field-group { margin-bottom: 14px; }
.modal-body .field-group:last-child { margin-bottom: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--gray-900); color: #fff; padding: 10px 22px; border-radius: 24px; font-size: .875rem; font-weight: 600; box-shadow: var(--shadow-md); z-index: 999; animation: fadeSlideUp .3s ease; }
.toast.toast-error   { background: var(--red); }
.toast.toast-success { background: var(--green); }
@keyframes fadeSlideUp { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.install-helper {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.install-helper-title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--brand);
}
.install-helper-text {
  font-size: .8rem;
  color: var(--gray-700);
  margin-top: 2px;
}
.install-helper-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@media (min-width: 769px) {
  .install-helper {
    max-width: 460px;
    left: auto;
    right: 16px;
  }
}

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; overflow-x: auto; }
.tab-btn { padding: 10px 18px; border: none; background: transparent; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--gray-700); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: color var(--transition), border-color var(--transition); }
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-weight: 700; color: var(--gray-700); border-bottom: 1.5px solid var(--gray-200); white-space: nowrap; }
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .5px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar-left  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.settings-section { max-width: 520px; }
.settings-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; color: var(--brand); }

/* ── Inventory-specific ─────────────────────────────────────────── */
.item-barcode { font-family: 'Courier New', monospace; font-size: .82rem; color: var(--gray-700); }
.item-barcode-none { color: var(--gray-500); font-style: italic; }
.qty-badge { display: inline-block; min-width: 28px; text-align: center; font-weight: 700; background: var(--brand-light); color: var(--brand); border-radius: 99px; padding: 2px 10px; font-size: .82rem; }
.qty-stepper { display: inline-flex; align-items: center; gap: 6px; }
.qty-stepper .btn { padding: 2px 9px; font-size: .95rem; }
.qty-stepper input[type=number] { width: 60px; text-align: center; padding: 6px 4px; }

.scan-btn-lg { display: inline-flex; align-items: center; gap: 8px; }

.scanner-overlay { position: fixed; inset: 0; background: #000; z-index: 800; display: flex; flex-direction: column; }
.scanner-video-wrap { position: relative; flex: 1; overflow: hidden; background: #000; }
.scanner-video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scanner-reticle { position: absolute; left: 10%; right: 10%; top: 35%; bottom: 35%; border: 3px solid rgba(255,255,255,.85); border-radius: var(--radius); box-shadow: 0 0 0 2000px rgba(0,0,0,.45); pointer-events: none; }
.scanner-toolbar { background: #111; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.scanner-status { color: #fff; font-size: .85rem; opacity: .85; }
.scanner-manual-row { display: flex; gap: 8px; padding: 10px 16px; background: #1a1a1a; }
.scanner-manual-row input { flex: 1; }

.scanner-confirm { position: absolute; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; padding: 20px; }
.scanner-confirm-card { background: #1a1a1a; border-radius: var(--radius); padding: 24px 20px; max-width: 340px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.scanner-confirm-label { color: rgba(255,255,255,.75); font-size: .82rem; margin-bottom: 8px; }
.scanner-confirm-code { color: #fff; font-family: 'Courier New', monospace; font-size: 1.3rem; font-weight: 700; word-break: break-word; margin-bottom: 18px; }
.scanner-confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.scanner-confirm-actions .btn { flex: 1; min-width: 120px; }

.search-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-row input[type=text] { max-width: 280px; }

.item-desc-cell { max-width: 320px; white-space: pre-wrap; word-break: break-word; }
.item-meta { font-size: .72rem; color: var(--gray-500); margin-top: 3px; }

@media (max-width: 900px) {
  input[type=text], input[type=number], input[type=password], select, textarea {
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  .card { padding: 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { justify-content: flex-end; }
  .tab-btn { padding: 8px 12px; font-size: .82rem; }
  .install-helper {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 8px 10px;
  }
  .install-helper-actions .btn {
    padding: 4px 8px;
    font-size: .74rem;
  }
  .item-desc-cell { max-width: 200px; }
}
