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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 20px 0;
  color: white;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

header .subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Capture Button */
.capture-section {
  display: flex;
  justify-content: center;
}

.capture-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 50px;
  background: white;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.capture-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.capture-btn:active {
  transform: translateY(0);
}

.capture-btn svg {
  color: #2563eb;
}

.capture-btn span {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2563eb;
}

/* Preview Section */
.preview-section {
  background: white;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.preview {
  width: 100%;
  border-radius: 12px;
  display: block;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.loading p {
  color: #6b7280;
  font-size: 1rem;
}

/* Results */
.result {
  /* Empty by default, populated by JS */
}

.result-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.result-card.success {
  border-left: 4px solid #10b981;
}

.result-card.error {
  border-left: 4px solid #ef4444;
}

.result-card h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: #1f2937;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.data-row:last-of-type {
  border-bottom: none;
}

.data-row .label {
  color: #6b7280;
  font-size: 0.95rem;
}

.data-row .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1f2937;
  font-family: 'SF Mono', 'Menlo', monospace;
}

.confidence {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: #9ca3af;
  text-align: right;
}

.error-message {
  color: #ef4444;
  font-size: 1rem;
}

/* Instructions */
.instructions {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 20px;
  color: white;
}

.instructions h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  opacity: 0.95;
}

.instructions ul {
  list-style: none;
  padding: 0;
}

.instructions li {
  padding: 6px 0;
  padding-left: 24px;
  position: relative;
  font-size: 0.9rem;
  opacity: 0.9;
}

.instructions li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #a7f3d0;
}

/* Settings Section */
.settings-section {
  margin-top: 10px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  justify-content: center;
}

.settings-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.settings-panel {
  margin-top: 12px;
}

.settings-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.settings-card h3 {
  font-size: 1.1rem;
  color: #1f2937;
  margin-bottom: 8px;
}

.settings-description {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 16px;
}

.credentials-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.8rem;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s;
}

.credentials-input:focus {
  outline: none;
  border-color: #2563eb;
}

.credentials-input::placeholder {
  color: #9ca3af;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.btn-primary {
  padding: 12px 24px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.status-indicator {
  font-size: 0.9rem;
}

.status-indicator.success {
  color: #10b981;
}

.status-indicator.error {
  color: #ef4444;
}

.status-indicator.loading {
  color: #6b7280;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px 0;
  color: white;
  opacity: 0.7;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 360px) {
  header h1 {
    font-size: 1.5rem;
  }

  .capture-btn {
    padding: 24px 40px;
  }
}
