/* =========================================================
   jankurtz POS — Design System
   Farben: yellow #F7E94B | black #231f20 | blue #38C2FA
   Font: News Cycle (400/700) | Kantig, kein border-radius
   ========================================================= */

:root {
  --yellow: #F7E94B;
  --black: #231f20;
  --blue: #38C2FA;
  --white: #ffffff;
  --bg: #F5F3EF;
  --border: #E2DFD9;
  --text-gray: #8A8480;
  --font: 'News Cycle', Arial, sans-serif;
  --radius: 2px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--black);
  background: var(--bg);
  min-height: 100vh;
}

/* ===================== TYPOGRAPHY ===================== */
h1, h2, h3 { font-weight: 700; line-height: 1.2; }
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-gray);
  margin-bottom: 8px;
}

/* ===================== BUTTONS ===================== */
button { font-family: var(--font); font-size: 1rem; cursor: pointer; border: none; border-radius: var(--radius); transition: opacity 0.1s, background 0.1s; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--yellow);
  color: var(--black); /* NIEMALS weiß auf gelb */
  border: 2px solid var(--black);
  padding: 10px 20px;
  font-weight: 700;
  min-height: 44px;
}
.btn-primary:hover:not(:disabled) { background: #f0e03a; }

.btn-secondary {
  background: var(--black);
  color: var(--white);
  border: 2px solid var(--black);
  padding: 10px 20px;
  font-weight: 700;
  min-height: 44px;
}
.btn-secondary:hover:not(:disabled) { opacity: 0.85; }

.btn-ghost {
  background: transparent;
  color: var(--black);
  border: 2px solid var(--border);
  padding: 10px 20px;
  min-height: 44px;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--black); }

.btn-sm { padding: 6px 12px; min-height: 36px; font-size: 0.85rem; }

.btn-logout {
  background: transparent;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  padding: 6px 14px;
  font-size: 0.85rem;
  min-height: 36px;
}
.btn-logout:hover { background: var(--yellow); color: var(--black); }

/* ===================== INPUTS ===================== */
.input-field {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--black);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  width: 100%;
  min-height: 44px;
  outline: none;
  transition: border-color 0.1s;
}
.input-field:focus { border-color: var(--black); }
.input-field::placeholder { color: var(--text-gray); }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input-field { padding-right: 32px; }
.input-suffix {
  position: absolute; right: 10px;
  color: var(--text-gray); font-size: 0.9rem; pointer-events: none;
}

/* ===================== NAVIGATION ===================== */
nav {
  background: var(--black);
  color: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo { display: flex; align-items: center; gap: 12px; color: var(--yellow); }
.nav-logo svg { height: 22px; width: auto; }
.nav-label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.nav-right { display: flex; align-items: center; gap: 12px; }
#nav-username { font-size: 0.9rem; color: rgba(247,233,75,0.8); }

/* ===================== VIEWS ===================== */
.view { min-height: calc(100vh - 52px); }
#view-login { min-height: 100vh; }

/* ===================== LOGIN ===================== */
.login-header {
  background: var(--black);
  color: var(--yellow);
  padding: 32px 24px 24px;
  text-align: center;
}
.login-logo { height: 36px; width: auto; margin: 0 auto 16px; }
.login-subtitle { font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }

.login-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}
.user-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.user-card:hover { border-color: var(--black); background: var(--bg); }
.user-card:active { background: var(--yellow); }
.user-card-id { font-size: 0.75rem; color: var(--text-gray); letter-spacing: 0.05em; }
.user-card-name { font-weight: 700; font-size: 1.1rem; }

.login-admin-link {
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
}
.login-admin-link a { color: var(--text-gray); text-decoration: none; }
.login-admin-link a:hover { color: var(--black); }

/* ===================== POS LAYOUT ===================== */
.pos-tabs {
  display: none;
  background: var(--black);
  border-bottom: 2px solid var(--border);
}
.pos-tab {
  flex: 1;
  padding: 12px;
  background: var(--black);
  color: rgba(255,255,255,0.6);
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-height: 48px;
}
.pos-tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }
.cart-badge {
  background: var(--yellow);
  color: var(--black);
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 1px 6px;
  font-weight: 700;
  vertical-align: middle;
}

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.pos-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 2px solid var(--border);
  background: var(--white);
}
.pos-panel:last-child { border-right: none; }
/* Artikel-Panel wächst nicht mehr — Warenkorb bekommt den Platz */
#panel-articles { flex: 0 0 auto; overflow-y: visible; }

.panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-section--grow { flex: 1; overflow-y: auto; min-height: 0; }

/* ===================== ARTICLE SEARCH ===================== */
.search-input {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--black);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  width: 100%;
  min-height: 44px;
  outline: none;
}
.search-input:focus { border-color: var(--black); }

.search-dropdown {
  position: absolute;
  z-index: 50;
  background: var(--white);
  border: 2px solid var(--black);
  border-top: none;
  width: calc(100% - 32px);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.panel-section { position: relative; }

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  gap: 8px;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item-info { flex: 1; min-width: 0; }
.dropdown-item-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-item-nr { font-size: 0.8rem; color: var(--text-gray); }
.dropdown-item-price { font-weight: 700; white-space: nowrap; }

/* ===================== ARTICLE LIST ===================== */
.article-list { display: flex; flex-direction: column; gap: 2px; }
.article-row {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  gap: 8px;
  transition: background 0.1s, border-color 0.1s;
  min-height: 44px;
}
.article-row:hover:not(.article-row--soldout) { background: var(--bg); border-color: var(--black); }
.article-row--soldout { opacity: 0.4; cursor: not-allowed; }
.article-row-info { flex: 1; min-width: 0; }
.article-row-name { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-row-nr { font-size: 0.78rem; color: var(--text-gray); }
.article-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.article-row-price { font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.stock-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.stock-ok { background: #e8f5e9; color: #2e7d32; }
.stock-low { background: #fff3e0; color: #e65100; }
.stock-out { background: #ffebee; color: #c62828; }

/* ===================== MANUAL FORM ===================== */
.manual-form {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
}
.manual-form .btn-secondary { grid-column: 1 / -1; }

/* ===================== CART ===================== */
.cart-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cart-empty { color: var(--text-gray); font-size: 0.9rem; padding: 16px 0; text-align: center; }
.cart-items { display: flex; flex-direction: column; gap: 4px; }

.cart-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.cart-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.cart-item-name { font-weight: 700; font-size: 0.95rem; flex: 1; }
.cart-item-name-nr { font-size: 0.78rem; color: var(--text-gray); }
.cart-item-remove { background: none; border: none; color: var(--text-gray); font-size: 1.1rem; cursor: pointer; padding: 0; min-height: auto; line-height: 1; }
.cart-item-remove:hover { color: #c62828; }
.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qty-controls { display: flex; align-items: center; gap: 0; border: 2px solid var(--border); }
.qty-btn {
  background: var(--white);
  border: none;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  min-height: auto;
  border-radius: 0;
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: var(--bg); }
.qty-input {
  width: 48px;
  height: 36px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  background: var(--white);
}
.qty-input:focus { background: #fffde7; }
.cart-item-price { font-weight: 700; font-size: 1rem; }
.cart-item-warn { font-size: 0.75rem; color: #e65100; margin-top: 4px; }

/* ===================== TOTALS ===================== */
.totals-section { background: var(--bg); }
.totals-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 1rem; }
.totals-discount { color: var(--blue); font-weight: 700; }
.totals-total { font-size: 1.4rem; font-weight: 700; border-top: 2px solid var(--black); padding-top: 8px; margin-top: 4px; }

/* ===================== DISCOUNT ===================== */
.discount-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.discount-field-wrap { display: flex; flex-direction: column; gap: 4px; }
.discount-field-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-gray); }

/* ===================== PAYMENT BUTTONS ===================== */
.payment-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-payment {
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--border);
  padding: 14px 8px;
  font-size: 1.05rem;
  font-weight: 700;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.1s, background 0.1s;
}
.btn-payment:hover { border-color: var(--black); }
.btn-payment.selected { background: var(--yellow); border-color: var(--black); color: var(--black); }
.payment-icon { font-size: 1.3rem; }

/* ===================== CHECKOUT BUTTON ===================== */
.btn-checkout {
  width: 100%;
  font-size: 1.1rem;
  padding: 14px;
  min-height: 54px;
}

/* ===================== RECEIPT ===================== */
.receipt-wrapper { max-width: 720px; margin: 0 auto; padding: 20px 16px; }
.receipt-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.receipt-action-group { display: flex; gap: 8px; flex-wrap: wrap; }

.email-form { margin-bottom: 16px; }
.email-form-inner { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.email-form-inner .input-field { flex: 1; min-width: 200px; }
.customer-form-fields { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.receipt-customer { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 0.9rem; line-height: 1.6; }
.receipt-customer .receipt-meta-label { margin-bottom: 4px; }
.receipt-customer-address { color: var(--black); }
.email-status { padding: 10px 14px; border-radius: var(--radius); font-weight: 700; margin-top: 8px; }
.email-status.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.email-status.error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* Beleg-Inhalt (druckbar) */
.receipt-content {
  background: var(--white);
  border: 2px solid var(--border);
  font-size: 0.95rem;
}
.receipt-header {
  background: var(--black);
  color: var(--yellow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.receipt-header svg { height: 26px; width: auto; }
.receipt-header-right { font-size: 0.8rem; opacity: 0.8; }
.receipt-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
  padding: 14px 20px;
  border-bottom: 2px solid var(--black);
  font-size: 0.9rem;
}
.receipt-meta-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-gray); margin-bottom: 2px; }
.receipt-meta-val { font-weight: 700; }

.receipt-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.receipt-table thead tr { background: var(--bg); }
.receipt-table th { padding: 7px 10px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--black); text-align: left; font-weight: 700; }
.receipt-table th.right, .receipt-table td.right { text-align: right; }
.receipt-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }

.receipt-totals { border-top: 2px solid var(--black); }
.receipt-totals td { padding: 5px 10px; text-align: right; }
.receipt-totals .subtotal-row { color: var(--text-gray); font-size: 0.85rem; }
.receipt-totals .discount-row-r { color: var(--blue); font-weight: 700; }
.receipt-totals .total-row { background: var(--black); color: var(--yellow); font-weight: 700; font-size: 1.2rem; }
.receipt-totals .total-row td { padding: 9px 10px; }

.receipt-footer {
  padding: 16px 20px;
  font-size: 0.78rem;
  color: var(--text-gray);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

/* ===================== ADMIN ===================== */
.admin-wrapper { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-title { font-size: 1.5rem; font-weight: 700; }
.admin-tabs { display: flex; border-bottom: 2px solid var(--black); margin-bottom: 20px; }
.admin-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-gray);
  cursor: pointer;
  min-height: 44px;
  margin-bottom: -2px;
}
.admin-tab.active { color: var(--black); border-bottom-color: var(--yellow); }
.admin-tab:hover:not(.active) { color: var(--black); }

.admin-tab-panel { display: block; }
.admin-tab-panel[hidden] { display: none; }
.admin-actions { margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.add-form {
  background: var(--white);
  border: 2px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
}
.form-title { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table thead tr { background: var(--black); color: var(--white); }
.data-table th { padding: 9px 12px; text-align: left; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr:nth-child(even) { background: #fafafa; }
.data-table tbody tr:nth-child(even):hover { background: var(--bg); }

.stock-input {
  width: 80px;
  padding: 4px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  text-align: center;
}
.stock-input:focus { border-color: var(--black); outline: none; }

/* Stern-Button (Admin) */
.btn-star {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--border);
  cursor: pointer;
  padding: 2px 4px;
  min-height: auto;
  line-height: 1;
  transition: color 0.1s, transform 0.1s;
}
.btn-star:hover { color: #f0a500; transform: scale(1.2); }
.btn-star--on { color: #f0a500; }

/* Vorschlagsleiste (POS) */
.featured-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.featured-btn {
  background: var(--yellow);
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  width: 100%;
}
.featured-btn:hover:not(:disabled) { background: #f0e03a; }
.featured-btn--soldout, .featured-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--bg); }
.featured-btn-name { font-weight: 700; font-size: 0.9rem; line-height: 1.2; }
.featured-btn-price { font-size: 0.8rem; color: var(--black); opacity: 0.7; }
.featured-btn-out { font-size: 0.72rem; color: #c62828; font-weight: 700; }

.btn-delete {
  background: none;
  border: 2px solid #ffcdd2;
  color: #c62828;
  padding: 4px 10px;
  font-size: 0.8rem;
  min-height: 32px;
  cursor: pointer;
  border-radius: var(--radius);
}
.btn-delete:hover { background: #ffebee; border-color: #c62828; }

.btn-save-inline {
  background: var(--yellow);
  color: var(--black);
  border: 2px solid var(--black);
  padding: 4px 10px;
  font-size: 0.8rem;
  min-height: 32px;
  font-weight: 700;
}

.revenue-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.summary-card {
  background: var(--white);
  border: 2px solid var(--border);
  padding: 14px 16px;
}
.summary-card-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-gray); margin-bottom: 4px; }
.summary-card-value { font-size: 1.4rem; font-weight: 700; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  z-index: 9999;
  min-width: 200px;
  text-align: center;
  pointer-events: none;
}
.toast.toast-error { background: #c62828; }
.toast.toast-success { background: #2e7d32; color: var(--white); }

/* ===================== PRINT ===================== */
@media print {
  nav, .receipt-actions, .receipt-action-group, .email-form,
  .qr-section, #btn-logout, .no-print {
    display: none !important;
  }
  body { background: white; font-size: 10pt; }
  .receipt-wrapper { padding: 0; max-width: 100%; }
  .receipt-content { border: none; }
}

/* ===================== RESPONSIVE: TABLET / MOBILE ===================== */
@media (max-width: 767px) {
  .pos-tabs { display: flex; }
  .pos-layout { grid-template-columns: 1fr; height: auto; overflow: visible; }

  .pos-panel { display: none; border-right: none; height: auto; overflow: visible; }
  .pos-panel.tab-active { display: flex; }

  .manual-form { grid-template-columns: 1fr; }
  .manual-form .btn-secondary { width: 100%; }
  .receipt-meta { grid-template-columns: 1fr; }
  .receipt-actions { flex-direction: column; align-items: stretch; }
  .receipt-action-group { justify-content: stretch; }
  .receipt-action-group button { flex: 1; }
  .admin-wrapper { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .payment-buttons { grid-template-columns: 1fr 1fr; }
  .discount-row { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) {
  #pos-tabs { display: none; }
  #panel-articles, #panel-cart { display: flex !important; }
}
