/**
 * Freedom Outdoors Inventory App — global styles.
 *
 * Layout for login, product lookup, inventory scanning, modals, and full-screen
 * camera scanner overlays. Cache-bust via ?ref= on link tags in .phtml files.
 */

:root {
    --color-primary: #205293;
    --color-accent: #bf3131;
    --color-stock: #2d7a4f;
    --color-price: #1a6b7a;
    --color-date: #946508;
    --color-reference: #4a6fa5;
    --color-alert: #9e2a2a;
    --color-muted: #aaaaaa;
    --color-store-highlight: #e8eef5;
    --bg-price: #cdd9eb;
    --bg-stock: #c8ddd0;
    --bg-date: #faf0d9;
    --bg-alert: #e0cccc;
    --bg-reference: #eef2f8;
}

body {
    font-family: Arial, sans-serif;
    background-image: linear-gradient(#205293, #FFFFFF);
    margin: 0 15px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}


.container {
    position: relative;
    background: white;
    padding: 20px 20px 20px 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    max-width: 320px;
    z-index: 10;
} 

.container h2 {
    margin: 5px 0px;
}


h1.warning {
    width: 100%;
    text-align: center;
    color: #bf3131;
}

.header-img {
    position: fixed;
    z-index: 1;
    top: 10px;
    right: 10px;
}

#reader,
.scanner-container {
    display: none;
    position: fixed !important;
    z-index: 100;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    min-height: 100vh;
    overflow: hidden;
    background-color: #000;
}

#reader.scanner-active,
.scanner-container.scanner-active {
    display: block;
}

body.scanner-open {
    overflow: hidden;
}

.scanner-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.scanner-close-button {
    position: absolute;
    top: calc(8px + env(safe-area-inset-top));
    right: 8px;
    z-index: 10;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.scanner-close-button:active {
    background: rgba(255, 255, 255, 0.25);
}

#readerCamera {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

#readerCamera video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

#readerCamera > div {
    width: 100% !important;
    height: 100% !important;
}

.scanner-file-target {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 640px;
    height: 480px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.scanner-zoom-panel {
    display: none;
    position: absolute;
    z-index: 5;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 8px 8px 8px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: rgba(0, 0, 0, 0.85);
}

.scanner-zoom-panel.active {
    display: block;
}

.scanner-action-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.scanner-action-row .scanner-action-button {
    flex: 1;
    width: auto;
    margin: 0;
    padding: 12px 8px;
    background-color: #205293;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
}

.scanner-zoom-panel .manual-upc-form {
    margin-top: 8px;
}

.scanner-zoom-panel .manual-upc-form input[type="text"] {
    margin: 0;
}

.scanner-zoom-panel .manual-upc-form button {
    margin: 0;
    background-color: #205293;
}

.scanner-distance-hint {
    margin: 0 0 8px;
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.3;
    text-align: center;
}

.scanner-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.scanner-torch-toggle {
    width: 42px;
    margin: 0;
    padding: 8px 0;
    font-size: 1rem;
    line-height: 1;
    background-color: #205293;
}

.scanner-torch-toggle.active {
    background-color: #f0ad4e;
    color: #000;
}

.scanner-zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.scanner-zoom-controls button {
    width: 42px;
    margin: 0;
    padding: 8px 0;
    font-size: 1.2rem;
    line-height: 1;
    background-color: #205293;
}

#zoomLevel {
    min-width: 48px;
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
}

#barcodeTable, #productInfo1, #productInfo2, #productInfo3, #productTitle, #tierData, #storeData {
    width: 100%;
    margin-top: 20px;
    font-size: 14px;
}

#prodInfo2 {
    width: 100%;
}

#productInfo2 {
    width: 100%;
}

#prodInfo2 .productInfo2 {
    width: 65%;
}

#barcodeTable td, #barcodeTable th,
#productInfo1 td, #productInfo1 th,
#productInfo2 td, #productInfo2 th,
#productInfo3 td, #productInfo3 th,
#productTitle td,
#storeData td, #storeData th,
#tierData td, #tierData th {
    border: 1px solid #ddd;
    padding: 5px 8px;
    text-align: center;
}

#barcodeTable th, #productInfo1 th, #productInfo2 th, #productInfo3 th, #tierData th, #storeData th  {
    padding-top: 10px;
    padding-bottom: 10px;
    text-align: center;
    background-color: #205293;
    color: white;
}

#productInfo1, #productInfo2, #productInfo3, #productTitle, #tierData, #storeData {
    margin-top: 0;
}

#productInfo1 .cost {
    min-width: 50px;
}

#productInfo2 .cost {
    min-width: 50px;
}

#barcodeTable .barcode {
    width: 200px;
}

#productTitle .name {
    font-weight: bold;
    font-size: 95%;
}

#productTitle .name a.product-link {
    color: inherit;
    text-decoration: underline;
}

/* Product lookup — field highlighting */
#productInfo2 tbody td.retail {
    background-color: var(--bg-price);
    font-weight: 600;
}

#productInfo3 tbody td.lastReceived,
#lastUpdated td.lastUpdated {
    color: var(--color-date);
    font-weight: 600;
}

.value-stock {
    background-color: var(--bg-stock);
    font-weight: 600;
}

.value-alert {
    background-color: var(--bg-alert);
    font-weight: 600;
}

.value-date {
    color: var(--color-date);
    font-weight: 600;
}

.value-na {
    font-weight: normal;
    color: inherit;
    background-color: transparent;
}

#storeData {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto 20px;
}

.store-card {
    overflow: hidden;
    border: 1px solid #cfd6de;
    border-radius: 8px;
    background-color: #fff;
}

.store-card-default {
    border-color: #326b4b;
    box-shadow: 0 0 0 1px #326b4b;
}

.store-card-default .store-card-header {
    background-color: #326b4b;
}

.store-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background-color: #205293;
    color: #fff;
}

.store-card-header strong {
    font-size: 1rem;
}

.store-card-badge {
    display: none;
    margin-left: 5px;
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    color: #fff;
    font-size: 0.6rem !important;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.store-card-default .store-card-badge {
    display: inline-block;
}

.store-card-empty-label {
    display: none;
    margin-left: 5px;
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    color: #fff;
    font-size: 0.62rem !important;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.store-card-empty .store-card-empty-label {
    display: inline-block;
}

.store-card-empty .store-card-pricing,
.store-card-empty .store-card-inventory {
    display: none;
}

.store-card-header span {
    font-size: 0.72rem;
    text-align: right;
}

.store-card-pricing,
.store-card-inventory {
    display: grid;
}

.store-card-pricing {
    grid-template-columns: repeat(3, 1fr);
}

.store-card-inventory {
    grid-template-columns: repeat(4, 1fr);
}

.store-card-retail {
    background-color: var(--bg-price);
}

.store-card-available.value-stock {
    background-color: var(--bg-stock);
    font-weight: 600;
}

.store-card-available.value-alert {
    background-color: var(--bg-alert);
    font-weight: 600;
}

.store-card-pricing > div,
.store-card-inventory > div {
    padding: 7px 4px;
    text-align: center;
}

.store-card-pricing > div + div,
.store-card-inventory > div + div {
    border-left: 1px solid #e3e6e9;
}

.store-card-pricing strong,
.store-card-pricing .store-card-date,
.store-card-inventory span:last-child {
    display: block;
    margin-top: 2px;
}

.store-card-label {
    display: block;
    color: #666;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}

.store-card-date {
    color: var(--color-date);
    font-size: 0.76rem;
    font-weight: 600;
}

#barcodeTable, #productInfo1, #productInfo2, #productInfo3, #productTitle, #tierData, #storeData {
    margin-top: 8px;
}

.upc-entry-row {
    display: flex;
    gap: 6px;
}

.upc-entry-row input {
    flex: 1;
    margin: 0;
    padding: 8px;
    font-size: 0.9rem;
}

.upc-entry-row button {
    width: auto;
    margin: 0;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.85rem;
}

#barcodeTable input.count {
    width: 50px;
    text-align: center;
}

#tierData {
  border-collapse: collapse;
  width: 280px;
  margin: auto auto 20px auto;
  background-color: #fff;
}

#tierData td.tier {
    width: 50%;
    text-align: left;
    padding-left: 15px;
}

/* Tier pricing modal — uniform row fill, darker → lighter down the table */
#tierData tbody tr:nth-child(1) td {
    background-color: #cdd9eb;
}

#tierData tbody tr:nth-child(2) td {
    background-color: #e4ecf4;
}

#tierData tbody tr:nth-child(3) td {
    background-color: #eef3f9;
}

#tierData tbody tr:nth-child(4) td {
    background-color: #f8fafc;
    font-weight: 600;
}

#tierData tbody td .temp {
    font-weight: normal;
    color: #888888 !important;
}

#tierInfo {
    display: none;
}

#message {
    margin-top: 10px;
    color: red;
}


#barcodeTable td.itemRow {
    text-align: left;
}

input[type="text"], input[type="password"], button {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input {
    padding: 0 10px;
}

button {
    background-color: #bf3131;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 100%;
}

half {
    width: 40%;
    display: inline;
    margin: 10px 15px ;
}

button #closeScanner {
    display: none;
}

#openScanner {
    margin-top: 0px;
}

button.deleteItem {
    color: #bf3131;
    background-color: white;
    cursor: pointer;
    width: 20px;
    height: 20px;
    padding: 0 0 0 0;
    border: none;
}

button.plusItem {
    color: #bf3131;
    background-color: white;
    cursor: pointer;
    width: 20px;
    height: 20px;
    padding: 0 0 0 0;
    border: none;
    font-weight: normal;
}

button.minusItem {
    color: #bf3131;
    background-color: white;
    cursor: pointer;
    width: 20px;
    height: 20px;
    padding: 0 0 0 0;
    border: none;
}

button#tierInfoButton, button#storeInfoButton {
    width: 45%;
    margin: 10px 6px;
}

button#tierInfoButton2 {
    margin: auto;
    height: 70px;
}

button.disabled {
    background-color: #aaa;
}


#reader__dashboard {
    background-color: #aaaaaa;
}


.div-footer img {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: auto;
}

span.barcode {
    font-weight: normal;
    font-size: 85%;
}

span.pName {
    font-weight: bold;
    font-size: 90%;
}

span.price {
    font-weight: normal;
    font-size: 85%;
    float: left;
    margin-top: 5px;
}

span.dbut {
    float: right;
}

span.dbut button {
    margin-top: 0;
    margin-bottom: 5px;
}

span.temp {
    font-style: italic;
    color: var(--color-muted) !important;
    font-weight: normal;
}

span.minor {
    font-size: 80%;
}

a.back {
    float: right;
    margin-top: 20px;
    font-size: 90%;
}

/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 100; /* Sit on top */
  left: 0;
  top: 50;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    
}

/* Modal Content/Box */
.modal-content {
  background-color: #f2f2f2;
  margin: 15% auto; /* 15% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 80%; /* Could be more or less, depending on screen size */
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.store-modal-content {
  box-sizing: border-box;
  width: min(92%, 420px);
  margin: 3vh auto;
  padding: 8px 14px 14px;
}

.store-modal-content h2 {
    margin: 0 0 8px;
    line-height: 1.2;
}

.store-modal-content #storeData {
    margin-top: 0;
}

.store-modal-content .storeCloseButton {
    display: block;
    width: 50%;
    margin: 0 auto;
}

/* The Close Button */
.close {
  color: #bf3131;
  float: right;
  font-size: 28px;
  font-weight: bold;
  margin-top: -20px;
  margin-right: -20px;
}

.tierCloseButton, .storeCloseButton {
    position: relative;
    width: 40%;
    margin: 0 0 0 120px;
    
}


.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

.modal h2 {
    text-align: center;   
}


#lastUpdated {
    font-size: 70%;
    margin-left: 10px;
}