/* ============================================
   POS SYSTEM - Hindu Temple Switzerland
   Touch-friendly, large buttons, clear layout
   ============================================ */
:root {
  --saffron: #FF6B00;
  --gold: #FFD700;
  --deep-red: #8B1A1A;
  --success: #28a745;
  --bg: #F0F2F5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); height: 100vh; overflow: hidden; }

/* ===== LAYOUT ===== */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 60px 1fr;
  height: 100vh;
}

/* ===== TOPBAR ===== */
.pos-topbar {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #1A0A00, #3D1A05);
  border-bottom: 2px solid var(--gold);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
}
.pos-brand { display: flex; align-items: center; gap: 0.5rem; color: var(--gold); font-weight: 700; font-size: 1rem; }
.pos-om { font-size: 1.6rem; }
.pos-clock { color: #FFD700; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.pos-user { color: rgba(255,248,240,0.7); font-size: 0.85rem; }
.btn-pos-admin { background: rgba(255,215,0,0.15); border: 1px solid rgba(255,215,0,0.3); color: var(--gold); padding: 0.3rem 0.8rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem; text-decoration: none; }
.btn-pos-logout { background: rgba(220,53,69,0.15); border: 1px solid rgba(220,53,69,0.3); color: #FF6B6B; padding: 0.3rem 0.8rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }

/* ===== LEFT PANEL - PRODUCTS ===== */
.pos-left {
  overflow-y: auto; padding: 1.25rem;
  background: var(--bg);
}

.pos-section-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: #888; margin-bottom: 0.75rem;
}

/* ===== ARCHANA PRODUCT GRID ===== */
.archana-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}

.archana-btn {
  background: white; border: 2px solid transparent; border-radius: 14px;
  padding: 1.25rem 1rem; text-align: center; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  position: relative;
}

.archana-btn:hover {
  border-color: var(--saffron); transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255,107,0,0.2);
}

.archana-btn.selected {
  border-color: var(--saffron); background: #FFF8F0;
  box-shadow: 0 4px 15px rgba(255,107,0,0.3);
}

.archana-btn-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.archana-btn-name { font-weight: 700; color: #333; font-size: 0.9rem; margin-bottom: 0.25rem; line-height: 1.3; }
.archana-btn-price { font-size: 1.3rem; font-weight: 800; color: var(--saffron); }

/* ===== DEVOTEE SECTION ===== */
.devotee-section {
  background: white; border-radius: 16px; padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 1rem;
}

.devotee-search-wrap { position: relative; margin-bottom: 1rem; }
.devotee-search {
  width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid #E0E0E0; border-radius: 10px; font-size: 1rem;
  outline: none; transition: border-color 0.2s;
}
.devotee-search:focus { border-color: var(--saffron); }
.devotee-search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 1rem; color: #999;
}

.devotee-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: white; border: 1px solid #E0E0E0; border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15); z-index: 100;
  max-height: 250px; overflow-y: auto; display: none;
}

.devotee-option {
  padding: 0.75rem 1rem; cursor: pointer; border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}
.devotee-option:hover { background: #FFF8F0; }
.devotee-option:last-child { border-bottom: none; }
.devotee-option-name { font-weight: 600; color: #333; }
.devotee-option-meta { font-size: 0.78rem; color: #888; }

.devotee-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.devotee-fields.full { grid-template-columns: 1fr; }

.field-group label { font-size: 0.75rem; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 0.25rem; }
.field-input {
  width: 100%; padding: 0.6rem 0.8rem; border: 1.5px solid #E8E8E8;
  border-radius: 8px; font-size: 0.9rem; color: #333;
  outline: none; transition: border-color 0.2s;
}
.field-input:focus { border-color: var(--saffron); }

.save-devotee-wrap { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.save-devotee-wrap input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--saffron); }
.save-devotee-wrap label { font-size: 0.85rem; color: #555; cursor: pointer; }

/* ===== RIGHT PANEL - ORDER ===== */
.pos-right {
  background: white; border-left: 1px solid #E8E8E8;
  display: flex; flex-direction: column; overflow: hidden;
}

.pos-right-header {
  background: linear-gradient(135deg, var(--saffron), #CC5500);
  color: white; padding: 1rem 1.25rem;
}
.pos-right-header h4 { font-weight: 700; font-size: 1rem; }

.pos-order-body { flex: 1; overflow-y: auto; padding: 1rem; }

.order-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; border-radius: 10px; background: #FFF8F0;
  border: 1.5px solid #FFE0C0; margin-bottom: 0.75rem;
}
.order-item-icon { font-size: 1.5rem; }
.order-item-info { flex: 1; }
.order-item-name { font-weight: 700; font-size: 0.9rem; }
.order-item-sub { font-size: 0.78rem; color: #888; }
.order-item-price { font-weight: 800; color: var(--saffron); font-size: 1.1rem; }
.order-item-remove { background: none; border: none; color: #dc3545; cursor: pointer; font-size: 1.1rem; padding: 0.2rem 0.4rem; border-radius: 6px; transition: background 0.2s; }
.order-item-remove:hover { background: rgba(220,53,69,0.1); }

.empty-order { text-align: center; padding: 3rem 1rem; color: #CCC; }
.empty-order i { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ===== ORDER FOOTER ===== */
.pos-order-footer { padding: 1rem 1.25rem; border-top: 1px solid #F0F0F0; }

.order-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px solid #F0F0F0;
  font-size: 0.875rem; color: #666;
}
.order-total-row.grand {
  font-size: 1.4rem; font-weight: 800; color: #333;
  border-bottom: none; padding-top: 0.75rem;
}
.order-total-row.grand .amount { color: var(--saffron); }

.btn-checkout {
  width: 100%; margin-top: 0.75rem;
  background: linear-gradient(135deg, #28a745, #1e7e34);
  color: white; border: none; border-radius: 12px;
  padding: 1.1rem; font-size: 1.2rem; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn-checkout:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(40,167,69,0.4); }
.btn-checkout:active { transform: translateY(0); }
.btn-checkout:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-clear-order { width: 100%; margin-top: 0.5rem; background: none; border: 1.5px solid #dc3545; color: #dc3545; border-radius: 10px; padding: 0.6rem; font-size: 0.875rem; cursor: pointer; transition: all 0.2s; }
.btn-clear-order:hover { background: rgba(220,53,69,0.05); }

/* ===== SUCCESS OVERLAY ===== */
.success-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; display: none;
}
.success-card {
  background: white; border-radius: 20px; padding: 2.5rem;
  max-width: 420px; width: 90%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.success-icon { font-size: 4rem; margin-bottom: 1rem; }
.success-card h2 { color: #28a745; margin-bottom: 0.5rem; }
.success-card .ticket-no { font-size: 1.5rem; font-weight: 800; color: var(--saffron); font-family: monospace; margin: 1rem 0; }
.success-card .devotee-info { background: #FFF8F0; border-radius: 10px; padding: 1rem; margin: 1rem 0; text-align: left; font-size: 0.875rem; }

.btn-print { background: linear-gradient(135deg, var(--saffron), #CC5500); color: white; border: none; border-radius: 10px; padding: 0.85rem 2rem; font-size: 1rem; font-weight: 700; cursor: pointer; margin: 0.5rem; }
.btn-next { background: linear-gradient(135deg, #28a745, #1e7e34); color: white; border: none; border-radius: 10px; padding: 0.85rem 2rem; font-size: 1rem; font-weight: 700; cursor: pointer; margin: 0.5rem; }

/* ===== PRINT RECEIPT ===== */
@media print {
  body { overflow: visible; }
  .pos-layout { display: none; }
  #receiptPrint { display: block !important; }
}

#receiptPrint {
  display: none;
  font-family: monospace; font-size: 10pt;
  width: 72mm; margin: 0;
}

/* ===== SELECT STYLES ===== */
select.field-input { appearance: auto; }

@media (max-width: 700px) {
  .pos-layout { grid-template-columns: 1fr; grid-template-rows: 60px auto auto; height: auto; overflow: auto; }
  .pos-right { max-height: 50vh; }
  body { overflow: auto; }
  .devotee-fields { grid-template-columns: 1fr; }
}
