/* Receipt Processing System v3 - Custom Styles */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ==========================================
   TAB BAR
   ========================================== */
.tab-bar {
  display: flex;
  background: white;
  border-radius: 1rem;
  padding: 0.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  gap: 0.25rem;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.625rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn i {
  font-size: 1rem;
}

.tab-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.tab-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ==========================================
   UPLOAD AREA
   ========================================== */
.upload-area {
  border: 3px dashed #cbd5e1;
  border-radius: 1rem;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  transform: scale(1.01);
}

.upload-area.drag-over {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* ==========================================
   RECEIPT CARD
   ========================================== */
.receipt-card {
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.receipt-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

/* ==========================================
   PROGRESS & ANIMATION
   ========================================== */
.progress-bar {
  transition: width 0.5s ease;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); }
}

.processing-glow {
  animation: pulse-glow 2s infinite;
}

/* ==========================================
   STEP INDICATOR
   ========================================== */
.step-dot {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.step-dot.active { background: #3b82f6; color: white; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2); }
.step-dot.completed { background: #22c55e; color: white; }
.step-dot.pending { background: #e2e8f0; color: #94a3b8; }

.step-line { height: 3px; flex: 1; transition: background 0.3s ease; }
.step-line.active { background: #3b82f6; }
.step-line.completed { background: #22c55e; }
.step-line.pending { background: #e2e8f0; }

/* ==========================================
   TOAST NOTIFICATION
   ========================================== */
.toast { animation: slideInRight 0.4s ease; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

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

/* ==========================================
   THUMBNAIL
   ========================================== */
.receipt-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 0.5rem;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  font-size: 1rem;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  font-size: 1rem;
}

.btn-success:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  min-height: 40px;
}

/* ==========================================
   SPINNER
   ========================================== */
.spinner {
  border: 3px solid #e2e8f0;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner-lg { width: 48px; height: 48px; border-width: 4px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   BADGES
   ========================================== */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-processing { background: #fef3c7; color: #92400e; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-error { background: #fee2e2; color: #991b1b; }

/* ==========================================
   RESULT TABLE
   ========================================== */
.result-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.result-table th {
  background: #f8fafc;
  padding: 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.result-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

.result-table tr:hover td { background: #f8fafc; }

/* ==========================================
   EDIT INPUT
   ========================================== */
.edit-input {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  width: 100%;
  transition: border-color 0.2s;
}

.edit-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==========================================
   MOBILE SAFE AREA
   ========================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
}

/* Responsive image preview */
.preview-modal img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* ==========================================
   PWA INSTALL BANNER
   ========================================== */
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
