/* ===============================
   GLOBAL
================================= */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: #f2f4f8;
  color: #222;
  padding-bottom: 90px; /* space for bottom nav */
}

/* ===============================
   HEADER
================================= */
header {
  background: linear-gradient(135deg, #4CAF50, #2196F3);
  color: white;
  padding: 18px 15px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* HEADER */
.top-header {
    background:linear-gradient(135deg,#4CAF50,#2196F3);
    color:white;
    padding:15px;
    text-align:center;
    font-size:20px;
    font-weight:bold;
}

/* GRID */
#grid {
    padding:10px;
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:10px;
}

@media(min-width:700px){
    #grid{grid-template-columns:repeat(5,1fr);}
}

/* CARD */
.card {
    background:white;
    border-radius:14px;
    padding:10px;
    text-align:center;
    box-shadow:0 4px 10px rgba(0,0,0,0.08);
    cursor:pointer;
    transition:0.2s;
}

.card:active { transform:scale(0.95); }

.stock-icon {
    font-size:28px;
    margin-bottom:5px;
}

.name {
    font-weight:bold;
    font-size:13px;
    min-height:30px;
}

.price {
    color:#4CAF50;
    font-weight:bold;
    margin-top:4px;
}

.stock {
    font-size:11px;
    color:#777;
}

/* CART BAR */
#cartBar {
    /*position:fixed;*/
    bottom:70px;
    width:100%;
    background:white;
    padding:10px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    box-shadow:0 -3px 10px rgba(0,0,0,0.1);
}

/* ===============================
   PREMIUM BUTTONS
================================= */
button {
  background: linear-gradient(135deg, #001f4d, #001f4d10);
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

button:active {
  transform: scale(0.96);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

/* Secondary buttons (optional use class="secondary") */
button.secondary {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

/* ===============================
   PREMIUM INPUTS
================================= */
input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  outline: none;
  font-size: 14px;
  transition: all 0.25s ease;
  box-sizing: border-box;
}

input:focus {
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76,175,80,0.2);
}

/* Improve popup confirm button spacing */
.popup-box button {
  margin-top: 10px;
  width: 100%;
}

/* POPUP */
.popup {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.5);
    display:flex;
    justify-content:center;
    align-items:center;
    z-index:3000;
}

.popup-box {
    background:white;
    padding:20px;
    border-radius:12px;
    width:80%;
    margin: 20px;
    max-width:300px;
    text-align:center;
}

.popup-box input {
    width:100%;
    padding:8px;
    margin:10px 0;
}

/* ===============================
   BOTTOM NAV (Portrait Optimized)
================================= */
.bottom-nav {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 10px); /* respects device UI */
  width: 100%;
  height: 75px;
  background: #111;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
  padding-bottom: 20px; /* extra breathing room */
}

.bottom-nav button {
  background: none;
  border: none;
  color: #aaa;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  width: 60px;
  margin: 0;
  padding: 0;
}

.bottom-nav button:active {
  transform: scale(0.9);
}

.bottom-nav button.active {
  color: #4CAF50;
}

/* HAMBURGER */
.hamburger {
    width:24px;
    display:flex;
    flex-direction:column;
    gap:4px;
}
.hamburger span {
    height:3px;
    background:white;
}

/* SIDE MENU (FULLY HIDDEN) */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;           /* Completely off-screen */
    width: 250px;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);  /* semi-transparent black */
    backdrop-filter: blur(10px);     /* adds blur to content behind the menu */
    -webkit-backdrop-filter: blur(10px); /* for Safari support */
    transition: left 0.3s ease;
    padding: 20px;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2500;
}

.side-menu.active {
    left:0;
}

/* OVERLAY */
.menu-overlay {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.4);
    display:none;
    z-index:2000;
}

.menu-overlay.active {
    display:block;
}

/* RECEIPT STYLING */
.receipt-popup {
    max-width: 350px;
}

.receipt-body {
    text-align: left;
    font-size: 14px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin: 6px 0;
}

.receipt-date {
    font-size: 12px;
    color: #777;
    margin-top: 8px;
    text-align: center;
}

.search-container {
    padding: 15px;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

#searchInput {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 16px;
    outline: none;
    transition: 0.2s ease;
}

#searchInput:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* =========================
   POPUP OVERLAY
========================= */
.popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

/* =========================
   POPUP BOX
========================= */
.popup-box {
    background: #ffffff;
    width: 95%;
    max-width: 520px;
    border-radius: 18px;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

/* =========================
   CART BODY
========================= */
.cart-body {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 10px;
}

/* =========================
   CART ROW
========================= */
.cart-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7f7f7;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 8px;
}

/* Item Info */
.cart-info {
    flex: 2;
    min-width: 0;
}

.cart-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-price {
    font-size: 12px;
    color: #777;
}

/* Quantity Controls */
.cart-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-controls button {
    background: #00b894;
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.cart-controls button:hover {
    opacity: 0.9;
}

/* Total */
.cart-total {
    min-width: 70px;
    text-align: right;
    font-weight: bold;
    font-size: 14px;
}

/* Small Delete Button */
.delete-btn {
    background: transparent;
    border: none;
    color: #ff4d4d;
    font-size: 16px;
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #ffecec;
    border-radius: 6px;
}

/* Footer */
.cart-footer {
    font-size: 18px;
    margin-top: 10px;
}

/* Actions */
.cart-actions {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
}

.cart-actions button {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.cart-actions button:not(.secondary) {
    background: #00b894;
    color: white;
}

.secondary {
    background: #e0e0e0;
}

/* Animation */
@keyframes fadeIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.payment-popup input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.payment-actions {
    display: flex;
    gap: 10px;
}

.payment-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.payment-actions button:not(.secondary) {
    background: #00b894;
    color: white;
}

.secondary {
    background: #e0e0e0;
}

#serviceDescription {
    width: 100%;
    min-height: 100px;        /* decent height for multiple lines */
    max-height: 250px;        /* prevent it from being too tall */
    padding: 10px 12px;       /* inner spacing for comfort */
    font-size: 14px;          /* readable font size */
    line-height: 1.5;         /* spacing between lines */
    border: 1px solid #ccc;   /* subtle border */
    border-radius: 8px;       /* rounded corners */
    resize: vertical;         /* allow vertical resize only */
    box-sizing: border-box;   /* include padding in width */
    outline: none;            /* remove default outline */
    font-family: inherit;     /* match rest of UI font */
    background-color: #fafafa; /* soft background */
}

/* Focus effect */
#serviceDescription:focus {
    border-color: #4CAF50;   /* green border on focus */
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

/* Optional scrollbar styling for modern browsers */
#serviceDescription::-webkit-scrollbar {
    width: 6px;
}
#serviceDescription::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* Container for service description in cart */
.service-description {
    white-space: pre-wrap;      /* preserve line breaks */
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin: 4px 0;
    padding-left: 16px;         /* indent for bullets */
    text-align: left;           /* align text to left */
}

/* Each line with a bullet */
.service-description span {
    display: block;
    position: relative;
    padding-left: 12px;         /* space for bullet */
    text-align: left;           /* ensure span text is left-aligned */
}

/* Bullet symbol */
.service-description span::before {
    content: "•";               /* bullet symbol */
    position: absolute;
    left: 0;
    top: 0;
    color: #4CAF50;             /* bullet color */
    font-weight: bold;
}
.sale-item {
    display: grid;
    grid-template-columns: 1fr 60px 100px; /* name | qty | price */
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.item-name {
    text-align: left;
}

.item-qty {
    text-align: center;
    font-weight: bold;
}

.item-total {
    text-align: right;
    font-weight: bold;
}