/* ========================================================
   HOME REDESIGN - Modern responsive layout
   Uses existing theme variables from theme.css

   This file MUST load AFTER style.css and media-sizes.css
   to properly override conflicting styles.
   ======================================================== */


/* ==========================================================
   SECTION 1: HARD RESET - Kill all conflicting old CSS
   ========================================================== */

/* Reset zoom hacks from media-sizes.css */
.Homebuttons,
.endOfdaysContent,
.cashCountContents,
.unPaidContents,
.searchDiv,
.s_btn_product,
.table_headers,
.table-container,
.table-container-total,
.table-total-amount,
.upperButtons,
.lowerButtons,
.img-logo,
#container1,
#container2 {
  zoom: 1 !important;
  -moz-transform: none !important;
}

/* Kill position:absolute from old layout */
.table_buttons,
.table-container-total,
.searchInput_container,
.table_container_headers {
  position: relative !important;
  max-width: none !important;
}


/* ==========================================================
   SECTION 2: MAIN LAYOUT
   ========================================================== */
section {
  height: 100vh !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.home-container {
  display: flex !important;
  height: calc(100vh - 20px) !important;
  width: calc(100vw - 20px) !important;
  margin: 10px !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
  max-width: none !important;
}

/* Kill Bootstrap container-fluid padding */
.container-fluid.home-container {
  padding: 0 !important;
}

.d-flex-home {
  display: flex !important;
  width: 100% !important;
  height: 100% !important;
  gap: 0 !important;
  min-height: auto !important;
  align-items: stretch !important;
}


/* ==========================================================
   SECTION 3: LEFT PANEL (container1)
   ========================================================== */
#container1 {
  flex: 1;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 100% !important;
  background-color: var(--background-color) !important;
  color: var(--text-color) !important;
  padding: 0 !important;
}


/* ==========================================================
   SECTION 4: SEARCH BAR
   ========================================================== */
.searchDiv {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 10px 12px !important;
  background: var(--secondary-color) !important;
  border-bottom: 1px solid rgba(255,255,255,0.07) !important;
  border-radius: 8px 8px 0 0 !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  position: relative !important;
}

/* Barcode icon */
.barcode-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--text-color);
}

.search_input {
  flex: 1 !important;
  padding: 10px 14px !important;
  background: var(--background-color) !important;
  border: 1px solid rgba(255,255,255,0.07) !important;
  border-radius: 8px !important;
  color: var(--text-color) !important;
  font-size: 14px !important;
  outline: none !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

.search_input:focus {
  border-color: var(--primary-color) !important;
}

.search_input::placeholder {
  color: #666 !important;
}

.wholeSaleRetailsBtn,
.overidePrice {
  border-radius: 8px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  padding: 8px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
  cursor: pointer !important;
  width: auto !important;
  overflow: visible !important;
}

/* Override Price = outline style (transparent bg, green border) */
.overidePrice {
  background: transparent !important;
  color: var(--primary-color) !important;
  border: 1.5px solid var(--primary-color) !important;
}


/* ==========================================================
   SECTION 5: TABLE - Matching proposal column grid
   Both header and body tables must use same % widths
   Proposal grid: SKU(80px) | ITEM(flex) | QTY(65px) | PRICE(80px) | TOTAL(90px)
   Actual has 7 cols: SKU | empty | ITEM | QTY | PRICE | empty(icon) | TOTAL
   Hide columns 2 and 6, then size the rest by percentage
   ========================================================== */
.table_headers {
  margin-bottom: 0 !important;
  flex-shrink: 0 !important;
}

.table_header_row {
  border: none !important;
  border-color: transparent !important;
}

.primary_color_table {
  background-color: var(--primary-color) !important;
  color: #fff !important;
  border-color: var(--primary-color) !important;
}

.primary_color_table th {
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 8px 14px !important;
}

/* Both tables: fixed layout with same column sizing */
#theads,
#tableTransactions {
  table-layout: fixed !important;
  width: 100% !important;
  margin: 0 !important;
}

/* ---- Hide empty columns (2nd and 6th) in BOTH tables ---- */
#theads th:nth-child(2),
#theads th:nth-child(6),
#tableTransactions td:nth-child(2),
#tableTransactions td:nth-child(6) {
  display: none !important;
  width: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* ---- Column widths using % so both tables align ---- */
/* Col 1: SKU = ~7% */
#theads th:nth-child(1),
#tableTransactions td:nth-child(1) {
  width: 7% !important;
}

/* Col 3: ITEM/DESCRIPTION = auto (remaining %) */
#theads th:nth-child(3),
#tableTransactions td:nth-child(3) {
  width: auto !important;
}

/* Col 4: QTY = ~6% */
#theads th:nth-child(4),
#tableTransactions td:nth-child(4) {
  width: 6% !important;
  text-align: right !important;
}

/* Col 5: PRICE = ~7% */
#theads th:nth-child(5),
#tableTransactions td:nth-child(5) {
  width: 7% !important;
  text-align: right !important;
}

/* Col 7: TOTAL = ~8% */
#theads th:nth-child(7),
#tableTransactions td:nth-child(7) {
  width: 8% !important;
  text-align: right !important;
  font-weight: 700 !important;
}

/* Kill Bootstrap .col-* widths inside the tables */
#theads th[class*="col-"],
#tableTransactions td[class*="col-"] {
  flex: none !important;
  max-width: none !important;
}


/* ==========================================================
   SECTION 6: TABLE BODY (scrollable)
   ========================================================== */
.pos-transaction {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: none !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.table-container {
  flex: 1 !important;
  overflow-y: auto !important;
  background: var(--secondary-color) !important;
  position: relative !important;
  max-height: none !important;
  height: auto !important;
  top: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  font-size: inherit !important;
}

/* Hide scrollbar but keep scroll functionality */
.table-container::-webkit-scrollbar {
  width: 0 !important;
  display: none !important;
}

.table-container {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* Override JS inline styles on product description cells */
#tbody-cashiering tr td.prod_desc {
  max-width: none !important;
  font-size: 13px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Barcode text under product name */
#tbody-cashiering tr td.prod_desc #extraText {
  font-size: 10px !important;
  position: relative !important;
  bottom: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
}

/* Override JS inline styles on SKU cell */
#tbody-cashiering tr td#table-sku {
  max-width: none !important;
  font-size: 13px !important;
}

.pos-transaction tbody {
  font-size: 13px !important;
  line-height: normal !important;
  text-transform: none !important;
}

.pos-transaction td,
.pos-transaction th {
  font-size: 13px !important;
}

#tbody-cashiering .selectable-row {
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#tbody-cashiering .selectable-row:hover {
  background: rgba(255,255,255,0.03);
}

#tbody-cashiering .selectable-row.selected {
  background-color: var(--primary-color);
  color: #fff;
}

/* Override JS inline padding/height on all cells - vertically centered */
#tbody-cashiering tr td {
  padding: 6px 14px !important;
  vertical-align: middle !important;
  height: auto !important;
  line-height: 1.4 !important;
}


/* ==========================================================
   SECTION 7: TOTALS BAR
   ========================================================== */
.total_summary_amount {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  border: none !important;
  border-top: 2px solid var(--primary-color) !important;
  background: var(--secondary-color) !important;
  color: var(--primary-color) !important;
  margin: 0 !important;
  max-height: none !important;
  min-height: auto !important;
  height: auto !important;
  flex-shrink: 0 !important;
  border-radius: 0 0 8px 8px !important;
}

.summary-amount-row {
  display: contents !important;
  min-height: auto !important;
  max-height: none !important;
  height: auto !important;
}

.summary-amount-row > div {
  padding: 14px 8px !important;
  text-align: center !important;
  border-right: 1px solid rgba(255,255,255,0.07) !important;
  width: auto !important;
  max-width: none !important;
  flex: none !important;
}

.summary-amount-row > div:last-child {
  border-right: none !important;
}

.summary-amount-row h6 {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: var(--primary-color) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  margin-bottom: 2px !important;
}

.amount-text {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  display: block !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
  margin: 0 !important;
  align-items: unset !important;
  justify-content: unset !important;
  gap: unset !important;
}

.text-value-of-retail,
.totalPayment {
  display: inline !important;
  max-width: none !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
}

/* Reset Bootstrap col classes inside totals */
.total_summary_amount .col-6,
.total_summary_amount .col-md-3 {
  width: auto !important;
  max-width: none !important;
  flex: none !important;
  padding: 10px 8px !important;
}

/* Old total style resets */
.table-total-amount {
  height: auto !important;
  line-height: normal !important;
  bottom: auto !important;
  position: relative !important;
  max-width: none !important;
}

.table-container-total {
  position: relative !important;
  bottom: auto !important;
  max-width: none !important;
  height: auto !important;
}


/* ==========================================================
   SECTION 8: RESIZER
   ========================================================== */
.resizer {
  width: 8px !important;
  height: auto !important;
  background: transparent !important;
  cursor: ew-resize !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  flex-shrink: 0 !important;
  user-select: none !important;
  z-index: 10 !important;
  position: relative !important;
}

.resizer span {
  display: block !important;
  width: 4px !important;
  height: 4px !important;
  border-radius: 50% !important;
  background: #666 !important;
  margin: 0 !important;
  font-size: 0 !important;
  color: transparent !important;
}


/* ==========================================================
   SECTION 9: RIGHT PANEL (container2)
   Even gap: home-container margin=10px on all sides.
   No extra padding on container2 so right gap matches left.
   ========================================================== */
#container2 {
  width: 340px;
  min-width: 260px;
  flex-shrink: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background-color: var(--background-color) !important;
  color: var(--text-color) !important;
  height: 100% !important;
  overflow-y: auto !important;
  padding: 0 !important;
}

/* Hide container2 scrollbar */
#container2::-webkit-scrollbar {
  width: 0 !important;
  display: none !important;
}

#container2 {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}


/* ==========================================================
   SECTION 10: LOGO
   ========================================================== */
.img-logo {
  max-height: 20vh !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.image-container {
  margin: 8px !important;
}


/* ==========================================================
   SECTION 11: ACTION BUTTONS
   ========================================================== */
.table_buttons_1 {
  width: 100% !important;
  max-width: none !important;
  position: relative !important;
  border-spacing: 4px !important;
}

.table_buttons {
  position: relative !important;
  max-width: none !important;
  max-height: none !important;
}

.table_buttons_1 td {
  padding: 2px !important;
}

/* All button rows: same fixed height */
.table_buttons_1 tr,
.upperButtons tr,
.lowerButtons tr {
  height: 90px !important;
}

/* Buttons and cards fill the cell */
.table_buttons_1 td .homeButtons,
.table_buttons_1 td .full-height-btn,
.table_buttons_1 td button {
  height: 90px !important;
  min-height: 90px !important;
  max-height: 90px !important;
  display: flex !important;
  overflow: hidden !important;
}

.table_buttons_1 td .homeButtons .card {
  height: 100% !important;
  width: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.homeButtons {
  border: 1px solid rgba(255,255,255,0.07) !important;
  border-radius: 8px !important;
  transition: all 0.15s !important;
  box-shadow: none !important;
}

.homeButtons:hover {
  border-color: rgba(255,255,255,0.15) !important;
  background: rgba(255,255,255,0.05) !important;
}

.homeButtons:active {
  transform: scale(0.97);
}

.homeButtons .card {
  border: none !important;
  border-radius: 8px !important;
  background-color: var(--secondary-color) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 6px 6px !important;
  gap: 2px !important;
  margin: 0 !important;
}

/* Kill Bootstrap p-3 utility */
.homeButtons .card.p-3 {
  padding: 6px 6px !important;
}

/* Kill all margin/padding on icon wrappers inside buttons */
.homeButtons .card > div {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
}

.homeButtons small {
  font-size: 14px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
  color: var(--text-color) !important;
  line-height: 1.3 !important;
}

/* Force ALL icons to same size */
.homeButtons svg {
  width: 26px !important;
  height: 26px !important;
  display: block !important;
}


/* ==========================================================
   SECTION 12: STORE INFO
   ========================================================== */
.systemInformation {
  padding: 8px 10px !important;
}

.toSwitchUI {
  border: 1px solid rgba(255,255,255,0.07) !important;
  border-radius: 8px !important;
  background-color: var(--secondary-color) !important;
  box-shadow: none !important;
  max-height: none !important;
  height: auto !important;
  width: auto !important;
}

.infoSystem {
  font-size: 15px !important;
  font-family: inherit !important;
  text-align: left !important;
  color: var(--text-color) !important;
}

.infoSystem label {
  font-size: 15px !important;
  display: block !important;
  padding: 3px 0 !important;
}

.info-label {
  color: var(--information-color) !important;
  font-weight: 600 !important;
}

.info-value {
  color: var(--info-val-color) !important;
}


/* ==========================================================
   SECTION 13: LOWER BUTTONS
   ========================================================== */
.lowerButtons {
  margin-top: auto !important;
  width: 100% !important;
  position: relative !important;
  bottom: auto !important;
  margin-bottom: 0 !important;
}

.lowerButtons td {
  padding: 2px !important;
}


/* ==========================================================
   SECTION 14: SIDE PANEL MENU
   ========================================================== */
.menu-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--secondary-color);
  border-left: 1px solid rgba(255,255,255,0.07);
  z-index: 2001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.4);
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 2px solid var(--primary-color);
  flex-shrink: 0;
}

.side-menu-header .menu-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.side-menu-header .menu-close {
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: none;
}

.side-menu-header .menu-close:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.side-menu-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  border: none !important;
  background: none !important;
  width: 100%;
  text-align: left;
  font-family: inherit;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.menu-item:hover {
  background: rgba(255,255,255,0.04) !important;
  padding-left: 26px;
}

.menu-item .menu-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.menu-item .menu-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-color);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-menu-footer {
  display: flex;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.menu-footer-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 10px;
  color: var(--text-color);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  border: none !important;
  background: none !important;
  font-family: inherit;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.menu-footer-btn:first-child {
  border-right: 1px solid rgba(255,255,255,0.07) !important;
}

.menu-footer-btn:hover {
  background: rgba(255,255,255,0.04) !important;
  color: var(--primary-color);
}

.menu-footer-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-footer-btn.shutdown-btn:hover {
  color: var(--accent-color);
}


/* ==========================================================
   SECTION 15: RESPONSIVE BREAKPOINTS
   ========================================================== */

/* 1366px monitors */
@media screen and (max-width: 1399px) {
  #container2 { width: 300px; }
  .homeButtons .card { padding: 10px 4px !important; }
  .homeButtons small { font-size: 13px !important; }
  .homeButtons svg { width: 24px !important; height: 24px !important; }
  .amount-text { font-size: 1.05rem !important; }
}

/* Tablet landscape / small laptops */
@media screen and (max-width: 1279px) {
  #container2 { width: 260px; min-width: 220px; }
  .homeButtons .card { padding: 8px 3px !important; }
  .homeButtons small { font-size: 12px !important; }
  .homeButtons svg { width: 22px !important; height: 22px !important; }
  .amount-text { font-size: 0.95rem !important; }
  .infoSystem label { font-size: 13px !important; }
  .search_input { font-size: 13px !important; padding: 8px 12px !important; }
  .primary_button_style.s_btn_product { padding: 8px 12px !important; font-size: 11px !important; }
  .primary_color_table th { font-size: 10px !important; padding: 7px 10px !important; }
  #tbody-cashiering tr td { padding: 8px 10px !important; }
  .pos-transaction td,
  .pos-transaction th { font-size: 12px !important; }
}

/* Tablet portrait (768-1023px) */
@media screen and (max-width: 1023px) {
  .home-container,
  .d-flex-home {
    flex-direction: column !important;
  }

  #container1 {
    height: auto !important;
    flex: 1 !important;
    min-height: 0 !important;
  }

  .resizer {
    width: 100% !important;
    height: 8px !important;
    flex-direction: row !important;
    cursor: ns-resize !important;
  }

  #container2 {
    width: 100% !important;
    height: auto !important;
    min-width: unset !important;
    border-top: 2px solid var(--primary-color) !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    overflow-y: visible !important;
    padding: 0 !important;
  }

  .img-logo { display: none !important; }

  .upperButtons {
    flex: 1;
    min-width: 200px;
  }

  .lowerButtons {
    flex: 1;
    min-width: 200px;
    margin-top: 0 !important;
  }

  .pos-information {
    flex: 1;
    min-width: 250px;
  }

  .homeButtons .card { padding: 8px 4px !important; }
  .amount-text { font-size: 0.95rem !important; }
  .table-container { max-height: 50vh !important; }
  .side-menu { width: 280px; }
}

/* Small tablets (under 768px) */
@media screen and (max-width: 767px) {
  .searchDiv {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .searchDiv > div:first-child { display: none !important; }

  .search_input {
    flex-basis: 100% !important;
    font-size: 16px !important;
  }

  .wholeSaleRetailsBtn,
  .overidePrice {
    flex: 1;
  }

  .total_summary_amount {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  #container2 {
    flex-direction: column !important;
  }

  /* Hide SKU column on small screens */
  #theads th:nth-child(1),
  #tableTransactions td:nth-child(1) {
    display: none !important;
  }

  .side-menu { width: 280px; }
}

/* Touch devices */
@media (pointer: coarse) {
  .homeButtons .card { padding: 12px 6px !important; min-height: 60px; }
  .homeButtons small { font-size: 14px !important; }
  .homeButtons svg { width: 26px !important; height: 26px !important; }
  .search_input { padding: 12px 14px !important; }
  #tbody-cashiering tr td { padding: 12px 14px !important; }
}
