/* =========================================================
   FONUA BAKERY — Kasir Stylesheet
   ========================================================= */

:root {
  --bg: #fdf6f0;
  --surface: #ffffff;
  --primary: #d4843a;
  --primary-dark: #b56e2c;
  --primary-light: #fbe9d7;
  --success: #2d9d5a;
  --success-light: #e6f7ee;
  --danger: #d43a3a;
  --danger-light: #fde8e8;
  --text: #3d2c1e;
  --text-muted: #8a7565;
  --border: #e8d5c4;
  --shadow: 0 2px 12px rgba(61, 44, 30, 0.08);
  --shadow-lg: 0 8px 32px rgba(61, 44, 30, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------
   HEADER
   --------------------------------------------------------- */
.header {
  background: var(--primary);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-sub {
  font-size: 0.78rem;
  opacity: 0.85;
}

.header-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.clock {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.date-display {
  font-size: 0.78rem;
  opacity: 0.8;
}

/* ---------------------------------------------------------
   MAIN LAYOUT
   --------------------------------------------------------- */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.products-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-panel {
  width: 400px;
  min-width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.04);
}

/* Panel Header */
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   SEARCH & CATEGORIES
   --------------------------------------------------------- */
.search-box {
  flex: 1;
  max-width: 280px;
}

.search-box input {
  width: 100%;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  background: var(--bg);
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.category-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 20px 0;
  flex-wrap: wrap;
}

.category-tab {
  padding: 6px 16px;
  border: none;
  background: var(--bg);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.category-tab:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.category-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ---------------------------------------------------------
   PRODUCTS GRID
   --------------------------------------------------------- */
.products-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  align-content: start;
}

.product-card {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.product-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.product-card:active {
  transform: scale(0.97);
}

.product-emoji {
  font-size: 2.8rem;
  margin-bottom: 8px;
}

.product-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}

.product-category {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-price {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

/* ---------------------------------------------------------
   CART
   --------------------------------------------------------- */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.cart-item-emoji {
  font-size: 1.6rem;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--text);
}

.qty-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.qty-value {
  width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.cart-item-total {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 70px;
  text-align: right;
  color: var(--primary-dark);
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 4px;
  transition: color 0.15s;
}

.cart-item-remove:hover {
  color: var(--danger);
}

/* Cart Footer */
.cart-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: var(--bg);
}

.cart-summary {
  margin-bottom: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.summary-total {
  font-size: 1.15rem;
  font-weight: 800;
  padding-top: 8px;
  border-top: 2px dashed var(--border);
  margin-top: 8px;
}

/* ---------------------------------------------------------
   BUTTONS
   --------------------------------------------------------- */
.btn {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #247a47;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg);
}

.btn-outline-danger {
  background: var(--surface);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover:not(:disabled) {
  background: var(--danger-light);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}

/* ---------------------------------------------------------
   FORM
   --------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface);
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-lg {
  padding: 14px;
  font-size: 1.2rem;
  font-weight: 700;
}

/* ---------------------------------------------------------
   MODAL
   --------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Checkout Specific */
.checkout-total-display {
  text-align: center;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.checkout-total-display span:first-child {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.checkout-total-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.change-display {
  text-align: center;
  padding: 16px;
  background: var(--success-light);
  border-radius: var(--radius-sm);
  display: none;
}

.change-display.visible {
  display: block;
}

.change-display span:first-child {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.change-amount {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--success);
}

/* Receipt */
.modal-receipt {
  max-width: 420px;
}

.receipt-content {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 10px;
  background: #fffef9;
  border: 1px dashed var(--border);
  border-radius: 4px;
  white-space: pre-wrap;
}

/* History */
.modal-history {
  max-width: 600px;
}

.history-summary {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-weight: 600;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.history-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:hover {
  background: var(--bg);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.history-item-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------
   FOOTER TOOLBAR
   --------------------------------------------------------- */
.footer-toolbar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.footer-stats {
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------- */
@media (max-width: 860px) {
  .main-layout {
    flex-direction: column;
  }

  .cart-panel {
    width: 100%;
    min-width: 100%;
    max-height: 45vh;
    border-left: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 10px 14px;
  }

  .header-brand h1 {
    font-size: 1.15rem;
  }

  .clock {
    font-size: 1rem;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .product-emoji {
    font-size: 2rem;
  }

  .product-name {
    font-size: 0.78rem;
  }
}

/* ---------------------------------------------------------
   LANDING SCREEN
   --------------------------------------------------------- */
.landing-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #fdf6f0 0%, #f5e6d3 50%, #fbe9d7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.landing-screen.landing-exit {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.landing-container {
  text-align: center;
  max-width: 800px;
  width: 100%;
  padding: 24px;
}

.landing-logo {
  margin-bottom: 48px;
}

.landing-logo-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 16px;
  animation: landing-float 3s ease-in-out infinite;
}

@keyframes landing-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.landing-title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 6px;
  margin-bottom: 8px;
}

.landing-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.landing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.landing-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 28px 28px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  border: 2px solid transparent;
  text-align: center;
}

.landing-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(61, 44, 30, 0.18);
  border-color: var(--primary);
}

.landing-card:active {
  transform: translateY(-2px);
}

.landing-card-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.landing-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.landing-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.landing-card-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
  margin-bottom: 20px;
}

.landing-card-badge-new {
  background: var(--success-light);
  color: var(--success);
}

.landing-card-alt .landing-card-icon {
  filter: hue-rotate(-20deg);
}

.landing-card-btn {
  display: inline-block;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.landing-card-btn:hover {
  background: var(--primary-dark);
}

@media (max-width: 640px) {
  .landing-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .landing-title {
    font-size: 2.2rem;
    letter-spacing: 4px;
  }

  .landing-logo-icon {
    font-size: 3rem;
  }

  .landing-card {
    padding: 28px 20px 24px;
  }

  .landing-container {
    padding: 16px;
  }

  .landing-logo {
    margin-bottom: 32px;
  }
}

/* ---------------------------------------------------------
   LOGIN SCREEN
   --------------------------------------------------------- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(160deg, #fdf6f0 0%, #f5e6d3 40%, #fbe9d7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: block;
  animation: login-float 3s ease-in-out infinite;
}

@keyframes login-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-brand {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-input:focus {
  border-color: var(--primary);
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}

.login-btn:active {
  transform: scale(0.98);
  background: var(--primary-dark);
}

.login-error {
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 20px;
  margin-top: 4px;
}

.login-error.shake {
  animation: login-shake 0.4s ease;
}

@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.login-back-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.login-back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
