/* ============================================================
 * SmartPOS Simulator Stylesheet (Organized Clean Version)
 * ============================================================ */

/* -------------------------------
  General resets
--------------------------------*/
body {
  margin: 0;
  font-family: sans-serif;
  background-color: #1e1e1e;
  color: #e0e0e0;
}

h1, h2, h3 {
  margin: 0.5em 0;
  color: #fff;
}

button {
  padding: 0.5em 0.5em;        /* tighter fit for text */
  margin: 0.25em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75em;
  font-weight: bold;
  text-align: center;
  white-space: normal;         /* allow multi-line */
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.1em;
  display: flex;
  align-items: center;
  justify-content: center;
}

button:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* -------------------------------
   Layout wrappers
--------------------------------*/
main.wrap {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 clamp(10px, 2vw, 20px);
  box-sizing: border-box;
}

.panel {
  width: 100%;
  max-width: none;
  margin: 0 0 1em 0;
  padding: 1em clamp(10px, 2vw, 20px);
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 0;
  box-sizing: border-box;
}

.hidden {
  display: none;
}

/* -------------------------------
   Top function bar
--------------------------------*/
.top-bar {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  margin-bottom: 8px;
  background: #222;
  padding: 4px clamp(5px, 1vw, 10px);
  box-sizing: border-box;
}

.top-bar button {
  width: 100%;
  height: 50px;
  font-size: 0.8em;
  font-weight: bold;
  color: #fff;
  background: #555;
  border: 1px solid #333;
  border-radius: 3px;
  cursor: pointer;
}

.top-bar .blanktop {
  background: #333;
  pointer-events: none;
}

/* -------------------------------
   Transaction history
--------------------------------*/
.history {
  background: #1c1c1c;
  border: 1px solid #444;
  margin-top: 0.5em;
  overflow-x: auto;
  border-radius: 6px;
}

.history table {
  width: 100%;
  border-collapse: collapse;
}

.history th, .history td {
  border: 1px solid #555;
  padding: 0.5em;
  text-align: left;
}

.history th {
  background: #333;
  color: #fff;
}

.history tr:nth-child(even) {
  background: #2a2a2a;
}

.history tr:nth-child(odd) {
  background: #1e1e1e;
}

/* -------------------------------
   Cart / Ready section
--------------------------------*/
.cart-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ff9800;
  color: #000;
  font-weight: bold;
  padding: 0.5em 1em;
}

.cartready {
  background: #333;
  color: #fff;
  padding: 0.5em 1em;
  border: none;
  border-radius: 4px;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr 3fr 2fr 1fr; /* Quantity | Item | Person | Price */
  background: #2a2a2a;
  color: #fff;
  padding: 0.5em;
  font-weight: bold;
}

.cart-line div {
  padding: 0.25em;
  border-right: 1px solid #444;
}

.cart-line div:last-child {
  border-right: none;
}

/* ============================= */
/* Confirmation Page Styling     */
/* ============================= */
#confirmationPage {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 1em;
  color: #fff;
}

#confirmationPage h2 {
  text-align: left;
  margin-bottom: 1em;
}

.ticket-table, .article-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
}

.ticket-table th, .article-table th,
.ticket-table td, .article-table td {
  border: 1px solid #555;
  padding: 0.5em;
  text-align: left;
}

.ticket-table th {
  background: #444;
  color: #fff;
}

.article-table th {
  background: #555;
  color: #fff;
}

.confirm-total {
  background: #ff9800;
  color: #000;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  padding: 0.75em;
  margin-top: 0.5em;
  border-radius: 4px;
  font-size: 1.1em;
}

.confirm-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 1em;
}

.cancel-btn, .ok-btn {
  flex: 1;
  font-size: 1em;
  font-weight: bold;
  padding: 0.75em;
  border: none;
  cursor: pointer;
  border-radius: 6px;
}

.cancel-btn {
  background: #c0392b;
  color: #fff;
  margin-right: 0.5em;
}

.ok-btn {
  background: #27ae60;
  color: #fff;
  margin-left: 0.5em;
}

.hidden {
  display: none;
}

/* -------------------------------
   6. Ticket keyboard
--------------------------------*/
.keyboard {
  width: 100%;
  margin-top: 0.5em;
}

.row {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 clamp(5px, 1vw, 10px);
}

.row-1 {
  height: 80px;
}
.row-2, .row-3 {
  height: 60px;
}

.row button {
  width: 100%;
  min-width: 0;
  height: 100%;
  font-size: 0.9em;
  font-weight: bold;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

button.blankticket {
  background: #555;
  border: 1px solid #333;
}

/* -------------------------------
   7. Controls / Timer
--------------------------------*/
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1em;
}

.controls button {
  background: #444;
  color: #fff;
  padding: 0.75em 1.5em;
  border-radius: 6px;
}

.controls button:hover {
  background: #555;
}

.timer {
  font-size: 1.2em;
  font-weight: bold;
  color: #FFD700;
}

/* === Overlay Modal === */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.overlay.active {
  display: flex;
}

.overlay-content {
  background: #2a2a2a;
  color: #fff;
  padding: 1.5em;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.confirm-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.confirm-table th, .confirm-table td {
  border: 1px solid #444;
  padding: 0.5em;
}

.confirm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1em;
}

.confirm-footer button {
  padding: 0.75em 1.5em;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.confirm-footer .cancel { background: #a33; color: #fff; }
.confirm-footer .ok { background: #4caf50; color: #fff; }
.confirm-footer .total { font-weight: bold; }

.confirm-table input[type="number"] {
  width: 70px;
  text-align: right;
  background: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  font-size: 0.9em;
  padding: 2px;
  color: #000;
}

.confirm-table th,
.confirm-table td {
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}

.confirm-table {
  font-size: 0.9em;
  background: #3a3a3a;
}

.confirm-footer {
  border-top: 2px solid #ff9800;
  margin-top: 0.5em;
  padding-top: 0.5em;
}

.overlay-content {
  padding: 0.75em 1em;
  background: #2b2b2b;
  border: 3px solid #ff9800;
}


/* -------------------------------
   8. Global rules
--------------------------------*/
body, html {
  overflow-x: hidden;
}

/* === SmartPOS Confirmation Layout === */
.confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  background: #3a3a3a;
}

.confirm-table th,
.confirm-table td {
  border: 1px solid #444;
  padding: 4px 6px;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.confirm-table input[type="number"] {
  width: 60px;
  background: #e0e0e0;
  border: 1px solid #666;
  text-align: right;
  color: #000;
  border-radius: 2px;
  padding: 2px;
  font-weight: bold;
}

/* Shrink padding in overlay for tighter SmartPOS look */
.overlay-content {
  padding: 0.4em 0.8em;
  background: #2b2b2b;
  border: 3px solid #ff9800;
  border-radius: 0;
  width: 95%;
  max-width: 900px;
}

.confirm-footer {
  border-top: 2px solid #ff9800;
  margin-top: 0.25em;
  padding-top: 0.25em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
