/* ========================================
   MAIN SCREEN STYLES
   ======================================== */

/* Header */
.main-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 16px 20px 20px;
  position: relative;
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.header-title { font-size: 20px; font-weight: 700; }

.day-summary {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px;
}
.summary-item {
  flex: 1;
  text-align: center;
  cursor: pointer;
}
.summary-item.highlight { background: rgba(255,255,255,0.1); border-radius: 8px; margin: -8px; padding: 8px; }
.summary-label { font-size: 12px; opacity: 0.8; display: block; margin-bottom: 4px; }
.summary-value { font-size: 20px; font-weight: 700; }
.summary-divider { width: 1px; background: rgba(255,255,255,0.2); margin: 0 12px; }

/* Tip Bubble */
.tip-bubble {
  position: absolute;
  bottom: -80px;
  left: 20px;
  right: 20px;
  background: white;
  color: var(--gray-700);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-size: 14px;
  line-height: 1.5;
  z-index: 100;
}
.tip-bubble::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: white;
}
.tip-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-400);
  cursor: pointer;
}

/* Navigation */
.main-nav {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}
.nav-icon { font-size: 20px; }
.nav-label { font-size: 12px; font-weight: 600; }

/* Main Content */
.main-content {
  padding-bottom: 160px;
}
.tab-content {
  padding: 16px;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.search-icon { font-size: 18px; }
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
}

/* First Sale Tip */
.first-sale-tip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #dbeafe;
  color: #1e40af;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}
.tip-icon { font-size: 24px; }

/* Products List */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}
.product-row:active {
  transform: scale(0.98);
  border-color: var(--primary);
  background: #f0f4ff;
}
.product-row.low-stock {
  border-color: #fef3c7;
  background: #fffbeb;
}
.product-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.product-emoji { font-size: 32px; }
.product-details { display: flex; flex-direction: column; gap: 2px; }
.product-name { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.product-stock { font-size: 12px; color: var(--gray-500); }
.product-stock.warning { color: var(--warning); font-weight: 600; }
.product-price-box { text-align: right; }
.product-price { font-size: 18px; font-weight: 700; color: var(--primary); display: block; }
.product-add { font-size: 11px; color: var(--gray-400); }

/* Stock Tab */
.alert-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.alert-box.warning { background: #fef3c7; }
.alert-box.success { background: #d1fae5; }
.alert-icon { font-size: 24px; }
.alert-content { display: flex; flex-direction: column; gap: 2px; }
.alert-content strong { font-size: 14px; color: var(--gray-800); }
.alert-content span { font-size: 13px; color: var(--gray-600); }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
}

.stock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.stock-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
}
.stock-info { display: flex; align-items: center; gap: 12px; }
.stock-emoji { font-size: 24px; }
.stock-details { display: flex; flex-direction: column; gap: 2px; }
.stock-name { font-size: 14px; font-weight: 600; }
.stock-prices { font-size: 11px; color: var(--gray-500); }
.stock-qty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 50px;
}
.stock-qty-box.ok { background: #d1fae5; color: #065f46; }
.stock-qty-box.attention { background: #fef3c7; color: #92400e; }
.stock-qty-box.warning { background: #fee2e2; color: #991b1b; }
.stock-qty-value { font-size: 18px; font-weight: 700; }
.stock-qty-label { font-size: 10px; }

/* Resumo Tab */
.resumo-header {
  margin-bottom: 16px;
}
.resumo-date {
  font-size: 14px;
  color: var(--gray-600);
}
.resumo-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.resumo-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.resumo-card.main {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}
.resumo-card.success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
}
.resumo-row {
  display: flex;
  gap: 12px;
}
.resumo-card.half { flex: 1; }
.resumo-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.resumo-card-icon { font-size: 20px; }
.resumo-card-title { font-size: 13px; opacity: 0.9; }
.resumo-card-value { font-size: 24px; font-weight: 700; }
.resumo-card-value.large { font-size: 32px; }
.resumo-card-detail { font-size: 13px; opacity: 0.8; margin-top: 4px; }

.margin-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}
.margin-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s;
}

.resumo-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #dbeafe;
  color: #1e40af;
  padding: 14px 16px;
  border-radius: 12px;
  margin-top: 16px;
  font-size: 13px;
}

/* Cart Float */
.cart-float {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  z-index: 100;
}
.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cart-info { display: flex; flex-direction: column; gap: 2px; }
.cart-qty { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.cart-items-list { font-size: 12px; color: var(--gray-500); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-total { font-size: 24px; font-weight: 700; color: var(--primary); }
.cart-actions { display: flex; gap: 12px; }
.btn-cart-clear {
  background: var(--gray-100);
  color: var(--gray-600);
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-cart-finish {
  flex: 1;
  background: var(--success);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn-cart-finish:active { transform: scale(0.98); }

/* 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: 20px;
}
.modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 360px;
  width: 100%;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
}

/* Success Modal */
.success-modal { text-align: center; }
.success-icon { font-size: 64px; margin-bottom: 16px; }
.success-title { font-size: 24px; font-weight: 700; color: var(--success); margin-bottom: 8px; }
.success-value { font-size: 32px; font-weight: 800; color: var(--gray-800); }
.success-detail { font-size: 14px; color: var(--gray-500); margin-bottom: 20px; }
.success-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.success-stat {
  flex: 1;
  background: var(--gray-50);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.success-stat.highlight { background: #d1fae5; }
.success-stat .stat-label { font-size: 11px; color: var(--gray-500); display: block; margin-bottom: 4px; }
.success-stat .stat-value { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.success-stat.highlight .stat-value { color: #065f46; }

/* Help Modal */
.help-modal { text-align: left; }
.help-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; text-align: center; }
.help-section { margin-bottom: 20px; }
.help-section h4 { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; }
.help-section p { font-size: 13px; color: var(--gray-600); line-height: 1.5; }


/* Payment Modal */
.payment-modal { text-align: center; }
.payment-title { font-size: 18px; font-weight: 700; color: var(--gray-800); margin-bottom: 8px; }
.payment-total { font-size: 32px; font-weight: 800; color: var(--primary); }
.payment-detail { font-size: 14px; color: var(--gray-500); margin-bottom: 24px; }

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.payment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.payment-btn:active {
  transform: scale(0.95);
  border-color: var(--primary);
  background: #f0f4ff;
}
.payment-icon { font-size: 28px; }
.payment-label { font-size: 12px; font-weight: 600; color: var(--gray-700); }


/* Payment Breakdown in Resumo */
.payment-breakdown {
  margin-top: 12px;
}
.payment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.payment-row:last-child {
  border-bottom: none;
}
.payment-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.payment-row-icon {
  font-size: 20px;
}
.payment-row-label {
  font-size: 14px;
  color: var(--gray-700);
}
.payment-row-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
}


/* Form styles for modals */
.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 20px;
  text-align: center;
}

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

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
}

.form-group input::placeholder {
  color: var(--gray-400);
}
