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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.container { max-width: 600px; margin: 0 auto; padding: 16px; padding-bottom: 100px; }

header { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; }
.logo h1 { font-size: 28px; margin-bottom: 2px; }
.dark { color: #2c3e50; }
.green { color: #27ae60; }
.subtitle { color: #7f8c8d; font-size: 14px; }

.btn-logout { background: none; border: 1px solid #e74c3c; color: #e74c3c; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-logout:hover { background: #e74c3c; color: white; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; background: white; padding: 8px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.tab { flex: 1; text-align: center; padding: 12px; text-decoration: none; color: #666; border-radius: 8px; font-weight: 500; }
.tab:hover { background: #f0f0f0; }
.tab.active { background: #27ae60; color: white; }

.orders-list { display: flex; flex-direction: column; gap: 12px; }
.order-card { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); cursor: pointer; border-left: 4px solid #bdc3c7; }
.order-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.order-card.pending { border-left-color: #bdc3c7; }
.order-card.packing { border-left-color: #f39c12; }
.order-card.complete { border-left-color: #27ae60; background: #f0fff4; }

.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.order-number { font-size: 18px; font-weight: 600; color: #2c3e50; }
.order-platform { font-size: 12px; color: #7f8c8d; background: #ecf0f1; padding: 4px 8px; border-radius: 4px; }

.progress-bar { height: 8px; background: #ecf0f1; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #27ae60, #2ecc71); border-radius: 4px; }
.progress-text { font-size: 12px; color: #7f8c8d; }

.order-status { display: flex; justify-content: flex-end; }
.status-badge { font-size: 12px; padding: 4px 10px; border-radius: 12px; font-weight: 500; }
.status-badge.pending { background: #ecf0f1; color: #7f8c8d; }
.status-badge.packing { background: #fef3e2; color: #f39c12; }
.status-badge.complete { background: #d5f5e3; color: #27ae60; }

.scan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.back-btn { color: #27ae60; text-decoration: none; font-weight: 500; }
.order-info { display: flex; align-items: center; gap: 8px; }
.platform-badge { font-size: 11px; background: #ecf0f1; padding: 2px 6px; border-radius: 4px; color: #666; }

.status-banner { padding: 16px; border-radius: 12px; text-align: center; font-weight: 600; font-size: 16px; margin-bottom: 16px; }
.status-banner.pending { background: #ecf0f1; color: #7f8c8d; }
.status-banner.packing { background: #fef3e2; color: #d68910; }
.status-banner.complete { background: #27ae60; color: white; font-size: 20px; }

.items-list { background: white; border-radius: 12px; overflow: hidden; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.item { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid #ecf0f1; }
.item:last-child { border-bottom: none; }
.item.complete { background: #f0fff4; }
.item.complete .item-status { color: #27ae60; }
.item-status { width: 24px; font-size: 18px; color: #bdc3c7; }
.item-name { flex: 1; font-weight: 500; }
.item-count { font-size: 14px; color: #7f8c8d; font-weight: 500; }

.scanner-section { margin-bottom: 16px; }
.scanner-box { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; }
.camera-error { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 200px; color: #fff; text-align: center; gap: 8px; }

.scan-feedback { margin-top: 12px; padding: 16px; border-radius: 12px; text-align: center; font-weight: 600; font-size: 18px; opacity: 0; transform: translateY(-10px); transition: all 0.3s; }
.scan-feedback.show { opacity: 1; transform: translateY(0); }
.feedback-success { background: #d5f5e3; color: #27ae60; }
.feedback-error { background: #fadbd8; color: #e74c3c; }
.feedback-warning { background: #fef3e2; color: #f39c12; }
.feedback-complete { background: #27ae60; color: white; font-size: 24px; }

.manual-entry { display: flex; gap: 8px; margin-bottom: 16px; }
.manual-entry input { flex: 1; padding: 12px; border: 2px solid #ecf0f1; border-radius: 8px; font-size: 16px; text-transform: uppercase; }
.manual-entry input:focus { outline: none; border-color: #27ae60; }

.action-buttons { display: flex; gap: 12px; }

body.order-complete { background: #27ae60; }

/* Login Page */
.login-card { max-width: 400px; margin: 40px auto; }
.login-card h2 { margin-bottom: 8px; color: #2c3e50; }
.login-card .hint { color: #7f8c8d; margin-bottom: 24px; font-size: 14px; }
.login-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid #ecf0f1; text-align: center; font-size: 14px; color: #7f8c8d; }
.login-footer a { color: #27ae60; text-decoration: none; }
.error-message { color: #e74c3c; font-size: 14px; margin-bottom: 12px; min-height: 20px; }

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

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 14px; }
.form-group input, .form-group select { width: 100%; padding: 12px; border: 2px solid #ecf0f1; border-radius: 8px; font-size: 16px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #27ae60; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-section { margin: 20px 0; padding-top: 16px; border-top: 1px solid #ecf0f1; }
.form-section h3 { margin-bottom: 12px; }

.item-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row select { flex: 2; padding: 10px; border: 2px solid #ecf0f1; border-radius: 8px; font-size: 14px; }
.item-row .item-qty { width: 60px; padding: 10px; border: 2px solid #ecf0f1; border-radius: 8px; text-align: center; }
.btn-remove { width: 36px; height: 36px; border: none; background: #fadbd8; color: #e74c3c; border-radius: 8px; font-size: 20px; cursor: pointer; }

.order-summary { background: #f8f9fa; border-radius: 8px; padding: 16px; margin: 16px 0; }
.order-summary h4 { margin-bottom: 12px; color: #555; }
.summary-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #ecf0f1; }
.summary-item:last-child { border-bottom: none; }

/* Products Page */
.category-group { margin-bottom: 16px; }
.category-group h4 { font-size: 12px; text-transform: uppercase; color: #7f8c8d; margin-bottom: 8px; letter-spacing: 1px; }
.product-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #f8f9fa; border-radius: 8px; margin-bottom: 6px; }
.product-name { font-weight: 500; }
.product-meta { display: flex; align-items: center; gap: 8px; }
.product-type { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.product-type.barcode { background: #3498db; color: white; }
.product-type.qrcode { background: #9b59b6; color: white; }
.product-barcode { font-family: monospace; background: #2c3e50; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 13px; }

/* Buttons */
.btn { padding: 14px 24px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #27ae60; color: white; width: 100%; }
.btn-primary:hover:not(:disabled) { background: #219a52; }
.btn-secondary { background: #ecf0f1; color: #555; flex: 1; }
.btn-success { background: #27ae60; color: white; flex: 1; }
.btn-small { padding: 10px 16px; font-size: 14px; }
.btn-large { padding: 18px; font-size: 18px; }

footer { text-align: center; padding: 20px; color: #7f8c8d; font-size: 13px; }
footer a { color: #27ae60; text-decoration: none; }

.loading, .empty, .error { text-align: center; padding: 40px; color: #7f8c8d; }
.error { color: #e74c3c; }
.empty-state { text-align: center; padding: 40px; }
.empty-state p { color: #7f8c8d; margin-bottom: 16px; }

/* Admin Portal Styles */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { margin: 0; }

.form-select { padding: 10px; border: 2px solid #ecf0f1; border-radius: 8px; font-size: 14px; margin-top: 8px; min-width: 200px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 8px; text-align: left; border-bottom: 1px solid #ecf0f1; }
.data-table th { background: #f8f9fa; font-weight: 600; color: #555; }
.data-table tr:hover { background: #f8f9fa; }
.data-table small { color: #7f8c8d; }

.plan-badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.plan-starter { background: #ecf0f1; color: #555; }
.plan-professional { background: #3498db; color: white; }
.plan-enterprise { background: #9b59b6; color: white; }

.status-active { color: #27ae60; font-weight: 500; }
.status-inactive { color: #e74c3c; font-weight: 500; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; border-radius: 12px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #ecf0f1; }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #7f8c8d; }
.modal-content .form { padding: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

.form-group small { display: block; margin-top: 4px; color: #7f8c8d; font-size: 12px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.stat-value { font-size: 32px; font-weight: 700; color: #27ae60; }
.stat-label { font-size: 14px; color: #7f8c8d; margin-top: 4px; }

/* QR Scanner Illustration */
.phone-frame {
  width: 140px;
  height: 260px;
  background: #1a1a2e;
  border-radius: 20px;
  padding: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #0f0f1a;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.scan-window {
  width: 90px;
  height: 90px;
  border: 2px solid #00ff88;
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,255,136,0.05);
}

.scan-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff88, transparent);
  animation: scanning 2s ease-in-out infinite;
}

@keyframes scanning {
  0%, 100% { top: 5px; opacity: 1; }
  50% { top: calc(100% - 7px); opacity: 0.8; }
}

.qr-code {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.qr-row {
  display: flex;
  gap: 3px;
}

.qr-cell {
  width: 10px;
  height: 10px;
  background: #333;
  border-radius: 2px;
}

.qr-cell.filled {
  background: #00ff88;
}

.scan-result {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #00ff88;
  font-size: 11px;
  font-weight: 500;
}

.checkmark {
  width: 16px;
  height: 16px;
  background: #00ff88;
  color: #0f0f1a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
