/* =========================
   Global
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;

  font-family: Arial, Helvetica, sans-serif;

  background: #f5f6fa;

  color: #333;
}

/* =========================
   Login Page
========================= */

.login-container {
  width: 380px;

  background: white;

  padding: 35px;

  border-radius: 12px;

  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);

  position: absolute;

  top: 50%;

  left: 50%;

  transform: translate(-50%, -50%);

  text-align: center;
}

.login-container h2 {
  margin-bottom: 25px;

  color: #222;
}

.login-container input {
  width: 100%;

  padding: 12px;

  margin-bottom: 15px;

  border: 1px solid #ddd;

  border-radius: 8px;

  font-size: 15px;
}

.login-container input:focus {
  outline: none;

  border-color: #2563eb;
}

button {
  width: 100%;

  padding: 12px;

  background: #2563eb;

  color: white;

  border: none;

  border-radius: 8px;

  font-size: 16px;

  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

#message {
  margin-top: 15px;

  text-align: center;

  color: red;
}

/* =========================
   Dashboard
========================= */

.dashboard {
  min-height: 100vh;

  padding: 40px;
}

.dashboard-header {
  margin-bottom: 40px;
}

.dashboard-header h1 {
  font-size: 32px;

  color: #1f2937;
}

/* Dashboard Cards */

.menu {
  display: flex;

  justify-content: center;

  align-items: center;

  gap: 30px;

  flex-wrap: wrap;
}

.card {
  width: 280px;

  height: 170px;

  background: white;

  padding: 30px;

  border-radius: 16px;

  cursor: pointer;

  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);

  transition: 0.3s;
}

.card:hover {
  transform: translateY(-8px);

  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.card h2 {
  margin-top: 0;

  color: #2563eb;
}

.card p {
  color: #666;
}

/* =========================
   Navigation
========================= */

nav {
  background: #111827;

  padding: 15px 25px;

  display: flex;

  position: sticky;

  top: 0;

  z-index: 1000;

  overflow-x: auto;

  gap: 25px;

  margin-bottom: 30px;
}

nav a {
  color: white;

  text-decoration: none;

  font-weight: bold;
}

nav a:hover {
  color: #60a5fa;
}

/* =========================
   Tables
========================= */

table {
  width: 100%;

  background: white;

  border-collapse: collapse;

  border-radius: 10px;

  overflow: hidden;

  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

th {
  background: #2563eb;

  color: white;

  padding: 14px;

  text-align: left;
}

td {
  padding: 12px;

  border-bottom: 1px solid #eee;
}

tr:hover {
  background: #f1f5f9;
}

/* =========================
   Action Buttons
========================= */

.action-btn {
  padding: 8px 14px;

  border-radius: 6px;

  cursor: pointer;

  border: none;
}

.edit-btn {
  background: #f59e0b;

  color: white;
}

.delete-btn {
  background: #dc2626;

  color: white;
}

/* =========================
   Responsive
========================= */

@media (max-width: 600px) {
  .login-container {
    width: 90%;
  }

  .dashboard {
    padding: 20px;
  }

  .menu {
    flex-direction: column;
  }

  .card {
    width: 100%;
  }

  nav {
    flex-direction: column;
  }
}
select {
  width: 100%;

  padding: 12px;

  margin-bottom: 15px;

  border: 1px solid #ddd;

  border-radius: 8px;

  background: white;

  font-size: 15px;
}

label {
  display: block;

  text-align: left;

  margin-bottom: 5px;

  font-weight: bold;
}
/* =====================================
   POS
===================================== */

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

.pos-container {
  display: grid;
  grid-template-columns: 60% 40%;
  min-height: 600px;
  gap: 20px;
  padding: 20px;
}

.pos-items,
.pos-receipt {
  background: white;
  padding: 20px;
  border-radius: 8px;
}

.pos-customer-select { margin: 0 0 16px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 9px; background: #fafbff; }
.pos-customer-select label { display: block; margin: 0 0 7px; font-weight: 700; }
.pos-customer-select label span, .pos-customer-select small { color: #6b7280; font-weight: 400; }
.pos-customer-select select { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; }
.pos-customer-select small { display: block; margin-top: 6px; font-size: 11px; }

#searchItem {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
}

#itemsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.pos-special-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.pos-special-actions button {
  flex: 1;
  padding: 10px;
  cursor: pointer;
}

.pos-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 15px;
}

.pos-modal-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  border: 1px solid #ddd;
  background: #f8f8f8;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.pos-modal-item:hover:not(:disabled) {
  background: #eeeeee;
}

.pos-modal-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.modifier-group {
  border-bottom: 1px solid #ddd;
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.receipt-row.selected {
  outline: 2px solid #222;
  border-radius: 4px;
  padding-left: 8px;
  padding-right: 8px;
}

.receipt-line-type {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.65;
}

.receipt-modifiers {
  display: flex;
  flex-direction: column;
  margin-top: 5px;
}

.pos-item-button {
  padding: 20px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
}

.pos-item-button:hover {
  background: #eeeeee;
}

.pos-item-button strong {
  font-size: 16px;
}

.pos-item-button span {
  display: inline-block;
  margin-top: 8px;
}

/* Receipt */

#receiptItems {
  max-height: 450px;
  overflow-y: auto;
}

.receipt-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.quantity {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quantity button {
  width: 28px;
  height: 28px;
  cursor: pointer;
}

/* Totals */

.pos-totals {
  margin-top: 20px;
  border-top: 1px solid #ddd;
  padding-top: 15px;
}

.pos-totals > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.grand-total {
  font-size: 22px;
  border-top: 2px solid #222;
  padding-top: 10px;
  margin-top: 10px;
}

/* Actions */

.pos-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.pos-actions button {
  flex: 1;
  padding: 15px;
  cursor: pointer;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 25px;
  width: 400px;
  max-width: 90%;
  border-radius: 8px;
  box-sizing: border-box;
  margin: auto 0;
}

.modal-content input {
  width: 100%;
  padding: 12px;
}

.saved-order {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #ddd;
}

/* Mobile */

@media (max-width: 900px) {
  .pos-container {
    grid-template-columns: 1fr;
  }

  .receipt-row {
    grid-template-columns: 1fr;
  }
}
/* =====================================
PURCHASE INVOICE
===================================== */

.purchase-invoice-page {
  min-height: 100vh;
  background: #f5f6fa;
  padding-bottom: 40px;
}

.purchase-invoice-container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 25px;
}

/* =====================================
Page Header
===================================== */

.purchase-invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.purchase-invoice-header h1 {
  margin: 0;
  font-size: 30px;
  color: #1f2937;
}

.purchase-invoice-header p {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 14px;
}

/* =====================================
Cards
===================================== */

.purchase-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.purchase-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.purchase-card h2 {
  margin: 0;
  font-size: 19px;
  color: #1f2937;
}

.purchase-card-subtitle {
  margin-top: 5px;
  color: #6b7280;
  font-size: 14px;
}

/* =====================================
Purchase Invoice Information
===================================== */

.purchase-invoice-info {
  display: none;

  background: linear-gradient(135deg, #eff6ff, #f8fbff);

  border: 1px solid #bfdbfe;
  border-radius: 12px;

  padding: 18px 20px;

  margin-bottom: 20px;
}

.purchase-invoice-info-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.purchase-invoice-number {
  color: #1e40af;
}

.purchase-invoice-number span {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.purchase-invoice-number strong {
  font-size: 21px;
  color: #1d4ed8;
}

/* =====================================
Status Badge
===================================== */

.purchase-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  padding: 7px 13px;

  border-radius: 999px;

  font-size: 13px;
  font-weight: bold;

  background: #fef3c7;
  color: #92400e;
}

.purchase-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* =====================================
Form Grid
===================================== */

.purchase-form-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 20px;
}

.purchase-form-group {
  display: flex;
  flex-direction: column;
}

.purchase-form-group label {
  margin-bottom: 7px;

  font-size: 13px;
  font-weight: 700;

  color: #374151;
}

.purchase-form-group input,
.purchase-form-group select {
  width: 100%;

  padding: 12px 13px;

  margin: 0;

  border: 1px solid #d1d5db;
  border-radius: 8px;

  background: #ffffff;

  color: #111827;

  font-size: 14px;

  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
}

.purchase-form-group input:hover,
.purchase-form-group select:hover {
  border-color: #9ca3af;
}

.purchase-form-group input:focus,
.purchase-form-group select:focus {
  outline: none;

  border-color: #2563eb;

  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.purchase-form-group input:disabled,
.purchase-form-group select:disabled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

/* =====================================
Main Action Button
===================================== */

.purchase-create-btn {
  width: auto;

  min-width: 190px;

  margin-top: 22px;

  padding: 12px 20px;

  background: #2563eb;

  border-radius: 8px;

  font-size: 14px;

  transition:
    transform 0.15s,
    background 0.2s,
    box-shadow 0.2s;
}

.purchase-create-btn:hover {
  background: #1d4ed8;

  transform: translateY(-1px);

  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.25);
}

.purchase-create-btn:disabled {
  background: #9ca3af;

  transform: none;

  box-shadow: none;
}

/* =====================================
Add Item Section
===================================== */

.purchase-add-item {
  display: none;
}

.purchase-add-item .purchase-form-grid {
  grid-template-columns:
    2fr
    1fr
    1fr;
}

.purchase-add-item-btn {
  width: auto;

  margin-top: 20px;

  padding: 11px 18px;

  background: #111827;

  font-size: 14px;
}

.purchase-add-item-btn:hover {
  background: #1f2937;
}

/* =====================================
Invoice Items
===================================== */

.purchase-items-card {
  display: none;
}

.purchase-items-table-wrapper {
  width: 100%;

  overflow-x: auto;

  border: 1px solid #e5e7eb;

  border-radius: 10px;
}

.purchase-items-table {
  width: 100%;

  border-collapse: collapse;

  box-shadow: none;

  border-radius: 0;
}

.purchase-items-table th {
  background: #f8fafc;

  color: #374151;

  border-bottom: 1px solid #e5e7eb;

  padding: 13px 15px;

  font-size: 12px;

  text-transform: uppercase;

  letter-spacing: 0.04em;
}

.purchase-items-table td {
  padding: 14px 15px;

  border-bottom: 1px solid #f1f5f9;

  color: #374151;

  font-size: 14px;
}

.purchase-items-table tbody tr {
  transition: background 0.15s;
}

.purchase-items-table tbody tr:hover {
  background: #f8fafc;
}

.purchase-items-table tbody tr:last-child td {
  border-bottom: none;
}

/* =====================================
Item Name
===================================== */

.purchase-item-name {
  font-weight: 600;

  color: #111827;
}

/* =====================================
Remove Button
===================================== */

.purchase-remove-btn {
  width: auto;

  padding: 7px 12px;

  background: #fee2e2;

  color: #b91c1c;

  font-size: 12px;

  font-weight: 700;

  border: 1px solid #fecaca;

  border-radius: 6px;
}

.purchase-remove-btn:hover {
  background: #fecaca;

  color: #991b1b;
}

/* =====================================
Empty State
===================================== */

.purchase-empty {
  text-align: center;

  padding: 45px 20px !important;

  color: #9ca3af !important;

  font-size: 14px !important;
}

.purchase-empty-icon {
  font-size: 30px;

  margin-bottom: 8px;

  opacity: 0.6;
}

/* =====================================
Invoice Total
===================================== */

.purchase-total-section {
  display: flex;

  justify-content: flex-end;

  margin-top: 20px;
}

.purchase-total-box {
  min-width: 280px;

  padding: 18px 20px;

  background: #f8fafc;

  border: 1px solid #e5e7eb;

  border-radius: 10px;
}

.purchase-total-row {
  display: flex;

  justify-content: space-between;

  align-items: center;

  color: #6b7280;

  font-size: 14px;
}

.purchase-total-row strong {
  color: #111827;
}

.purchase-grand-total {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-top: 10px;

  padding-top: 12px;

  border-top: 1px solid #d1d5db;

  font-size: 20px;

  font-weight: 800;

  color: #111827;
}

.purchase-grand-total span {
  color: #2563eb;
}

/* =====================================
Receive Button
===================================== */

.purchase-receive-section {
  display: flex;

  justify-content: flex-end;

  margin-top: 20px;
}

.purchase-receive-btn {
  width: auto;

  min-width: 230px;

  padding: 13px 20px;

  background: #198754;

  font-size: 14px;

  box-shadow: 0 4px 10px rgba(25, 135, 84, 0.15);
}

.purchase-receive-btn:hover {
  background: #157347;

  transform: translateY(-1px);

  box-shadow: 0 6px 14px rgba(25, 135, 84, 0.2);
}

.purchase-receive-btn:disabled {
  background: #9ca3af;

  box-shadow: none;

  transform: none;
}

/* =====================================
Messages
===================================== */

.purchase-message {
  display: none;

  padding: 13px 16px;

  margin-bottom: 20px;

  border-radius: 9px;

  font-size: 14px;

  font-weight: 600;

  border: 1px solid transparent;
}

.purchase-message.success-message {
  display: block;

  background: #ecfdf5;

  color: #065f46;

  border-color: #a7f3d0;
}

.purchase-message.error-message {
  display: block;

  background: #fef2f2;

  color: #991b1b;

  border-color: #fecaca;
}

/* =====================================
Loading / Disabled State
===================================== */

.purchase-loading {
  opacity: 0.65;

  pointer-events: none;
}

/* =====================================
Responsive
===================================== */

@media (max-width: 850px) {
  .purchase-form-grid {
    grid-template-columns: 1fr;
  }
}

.purchase-add-item .purchase-form-grid {
  grid-template-columns: 1fr;
}

.purchase-invoice-info-content {
  flex-direction: column;

  align-items: flex-start;
}

.purchase-total-section {
  justify-content: stretch;
}

.purchase-total-box {
  width: 100%;
}

.purchase-receive-section {
  justify-content: stretch;
}

.purchase-receive-btn {
  width: 100%;
}

@media (max-width: 600px) {
  .purchase-invoice-container {
    padding: 0 15px;
  }

  .purchase-invoice-header h1 {
    font-size: 24px;
  }

  .purchase-card {
    padding: 18px;
  }

  .purchase-create-btn,
  .purchase-add-item-btn {
    width: 100%;
  }

  .purchase-items-table {
    min-width: 650px;
  }

  .purchase-items-table-wrapper {
    overflow-x: auto;
  }
}
/* =======================================
   Daily Report
======================================= */

.daily-report-modal {
  width: 420px;
  max-width: 90%;
}

.daily-report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 12px 0;

  font-size: 16px;
}

.daily-report-row span {
  color: #555;
}

.daily-report-row strong {
  font-size: 17px;
}

.daily-report-grand-total {
  font-size: 20px;
}

.daily-report-grand-total strong {
  font-size: 24px;
}
/* =======================================
   Refund & Payment Modals
======================================= */

.refund-modal,
.payment-modal {
  width: 480px;
  max-width: 92%;
}

/* =====================================
   Refund Details Card
===================================== */

#refundDetails {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

#refundSaleTitle {
  margin: 0 0 12px;
  font-size: 18px;
  color: #1f2937;
}

/* Summary rows reuse .daily-report-row already defined,
   this just gives them a light card background to set the
   refund summary apart from the form fields below it. */

.refund-summary-box {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 5px 16px;
  margin-bottom: 15px;
}

#refundDetails .daily-report-grand-total strong {
  color: #2563eb;
}

/* =====================================
   Payment Total / Change Rows
===================================== */

.payment-total,
.payment-change {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 16px;
  color: #555;
}

.payment-total strong,
.payment-change strong {
  font-size: 22px;
  color: #2563eb;
}

.payment-choice { border: 1px solid #e5e7eb; border-radius: 9px; padding: 10px 12px; margin: 0 0 14px; }
.payment-choice legend { padding: 0 5px; font-size: 13px; font-weight: 700; }
.payment-choice label { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 13px; }
.payment-choice input[type="radio"] { width: auto; margin: 0; }
.payment-choice small { color: #6b7280; font-size: 11px; }

/* =====================================
   Form Fields inside these modals
===================================== */
.refund-modal {
  width: 480px;
  max-width: 92%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.refund-modal label,
.payment-modal label {
  margin-top: 10px;
}

.refund-modal input,
.payment-modal input,
.payment-modal select {
  margin-bottom: 10px;
}

/* =====================================
   Error Text
===================================== */

#refundError,
#paymentError {
  min-height: 18px;
  margin: 6px 0 0;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
}

/* =====================================
   Action Buttons
   (Process / Finish = primary, Back = secondary)
===================================== */

.payment-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.payment-actions button {
  width: auto;
  flex: 1;
}

.payment-actions button:first-child {
  background: #2563eb;
}

.payment-actions button:first-child:hover {
  background: #1d4ed8;
}

.payment-actions button:last-child {
  background: #f3f4f6;
  color: #374151;
}

.payment-actions button:last-child:hover {
  background: #e5e7eb;
}

/* =====================================
   Mobile
===================================== */

@media (max-width: 600px) {
  .refund-modal,
  .payment-modal {
    width: 92%;
  }

  .payment-actions {
    flex-direction: column;
  }
}
.hidden {
  display: none !important;
}
