:root {
  --primary: #2e7d32; /* Karadeniz Yeşili */
  --primary-dark: #1b5e20;
  --success: #4CAF50;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg-color: #f8fafc;
  --text-color: #334155;
  --border-color: #e2e8f0;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#header-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  text-align: center;
}

/* Main Content */
#app-content {
  padding-top: 56px;
  padding-bottom: 80px; /* space for fab */
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
}

.page {
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 12px;
  display: block;
}

.card-body {
  /* container for content */
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 15px;
  transition: all 0.2s;
  min-height: 44px;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-block { width: 100%; display: flex; }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn-lg { padding: 12px 24px; min-height: 52px; font-size: 16px; }
.btn-icon { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 8px; }
.btn-group { display: flex; gap: 8px; }

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

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.form-input {
  width: 100%;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  transition: border-color 0.2s;
  background: white;
  min-height: 44px;
}

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

.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group {
  flex: 1;
}

.form-hint {
  font-size: 12px;
  color: #777;
  margin-top: 4px;
  display: block;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
}

.data-table th, .data-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background: #f5f5f5;
  font-weight: 600;
}

.data-table tr:nth-child(even) td {
  background: #fafafa;
}

/* Lists */
.list-item {
  display: flex;
  padding: 14px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  align-items: center;
  transition: background 0.2s;
}

.list-item:active {
  background: #f0f0f0;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.list-item-subtitle {
  font-size: 13px;
  color: #666;
}

.list-item-action {
  margin-left: 12px;
}

/* Status / Badges */
.badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.badge-success { background-color: var(--success); }
.badge-warning { background-color: var(--warning); color: #333; }
.badge-danger { background-color: var(--danger); }
.badge-info { background-color: var(--primary); }
.badge-secondary { background-color: #9e9e9e; }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #999; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.flex-row { display: flex; flex-direction: row; }
.flex-between { justify-content: space-between; }
.gap-1 { gap: 8px; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 50;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

.fab:active {
  transform: scale(0.95);
}

/* Search Box */
.search-box-container {
  position: relative;
  margin-bottom: 16px;
}

.search-box {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
}

.search-box-container::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #999;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  color: #ccc;
  margin-bottom: 16px;
}

.empty-state-text {
  color: #666;
  margin-bottom: 16px;
}

/* Numpad Components (in modal or inline) */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.numpad-display {
  font-size: 36px;
  text-align: right;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  min-height: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.numpad-key {
  height: 60px;
  font-size: 24px;
  background: #e8e8e8;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.numpad-key:active {
  background: #ccc;
}

/* Progress Bar */
.progress-bar {
  background-color: #e0e0e0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}

.progress-fill {
  background-color: var(--success);
  height: 100%;
  transition: width 0.3s ease;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-container {
  background: white;
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-footer {
  padding: 16px;
  border-top: 1px solid #eee;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: #333;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideUp 0.3s ease forwards;
  pointer-events: auto;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #333; }
.toast.info { background: var(--primary); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Menu Dropdown */
.menu-dropdown {
  position: absolute;
  top: 50px;
  right: 16px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: 8px;
  z-index: 200;
  min-width: 150px;
  overflow: hidden;
}

.menu-item {
  display: block;
  padding: 12px 16px;
  color: var(--text-color);
  text-decoration: none;
  border-bottom: 1px solid #eee;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:active {
  background: #f5f5f5;
}

/* Receipt / Print Styles */
.print-area {
  display: none;
}

.receipt {
  padding: 12px;
  border: 1px solid #000;
  font-family: monospace;
  font-size: 12px;
  background: white;
  color: black;
  page-break-inside: avoid;
}

.receipt-header {
  text-align: center;
  margin-bottom: 8px;
}

.receipt-divider {
  border-top: 1px dashed #000;
  margin: 6px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.receipt-total {
  font-weight: bold;
  font-size: 14px;
}

/* Responsive */
@media (min-width: 768px) {
  #app-content {
    max-width: 800px;
  }
}


/* Mobile Responsiveness for Modals */
@media (max-width: 600px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-container {
    width: 100%;
    max-width: 100%;
    max-height: 90svh; /* use svh for better mobile keyboard handling */
    border-radius: 20px 20px 0 0;
    animation: slideUp 0.3s ease-out;
  }
  .modal-body {
    padding-bottom: 24px;
  }
  .modal-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Hide UI during printing */
@media print {
  body > *:not(.print-area-wrapper) {
    display: none !important;
  }
}
