/* CSS Variables for Theme */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --secondary-hover: #475569;
  --success: #16a34a;
  --success-hover: #15803d;
  --background: #ffffff;
  --foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --input: #ffffff;
  --destructive: #dc2626;
  --destructive-hover: #b91c1c;
  --accent: #8b5cf6;
  --accent-foreground: #ffffff;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #64748b;
    --secondary-hover: #94a3b8;
    --success: #22c55e;
    --success-hover: #16a34a;
    --background: #0f172a;
    --foreground: #f8fafc;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #334155;
    --input: #1e293b;
    --destructive: #ef4444;
    --destructive-hover: #dc2626;
    --accent: #a855f7;
    --accent-foreground: #ffffff;
  }
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

/* App Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.header-subtitle {
  color: var(--muted-foreground);
  font-size: 1.1rem;
}

/* Progress Bar */
.progress-container {
  margin-bottom: 2rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--muted);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

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

.step-indicators {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.step {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  transition: all 0.3s ease;
}

.step span {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--muted);
  color: var(--muted-foreground);
  line-height: 32px;
  font-weight: 600;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

.step.active span {
  background-color: var(--primary);
  color: white;
}

.step.completed span {
  background-color: var(--success);
  color: white;
}

.step label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.step.active label {
  color: var(--primary);
}

.step.completed label {
  color: var(--success);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-bottom: 2rem;
}

.step-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.step-content.active {
  display: block;
}

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

.step-header {
  text-align: center;
  margin-bottom: 2rem;
}

.step-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.step-header p {
  color: var(--muted-foreground);
  font-size: 1.1rem;
}

/* Form Styling */
.form-section {
  display: grid;
  gap: 1.5rem;
  max-width: 500px;
  margin: 0 auto;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-weight: 500;
  color: var(--foreground);
  font-size: 0.875rem;
}

.input-group input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background-color: var(--input);
  color: var(--foreground);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group input.error {
  border-color: var(--destructive);
}

.help-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.error-message {
  font-size: 0.75rem;
  color: var(--destructive);
  display: none;
}

.error-message.visible {
  display: block;
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
  flex: 1;
}

.radio-label:hover {
  border-color: var(--primary);
}

.radio-label input[type="radio"] {
  margin: 0;
}

.radio-label input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}

/* Toggle Switch */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--muted);
  border-radius: 12px;
  transition: background-color 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="checkbox"]:checked + .toggle-slider {
  background-color: var(--primary);
}

input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(20px);
}

input[type="checkbox"] {
  display: none;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--primary);
  color: white;
}

.copy-btn {
  padding: 4px 8px;
  font-size: 0.75rem;
  background-color: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background-color: var(--primary);
  color: white;
}

/* Navigation */
.navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.navigation .btn {
  min-width: 120px;
}

/* Cards and Previews */
.preview-card, .line-item-preview {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.preview-card h3, .line-item-preview h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.discount-breakdown {
  background-color: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
}

.discount-breakdown h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Results Container */
.results-container {
  display: grid;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.result-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--muted);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.result-field-with-calc {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-field label {
  font-weight: 500;
  color: var(--foreground);
}

.result-value {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 600;
  color: var(--foreground);
  font-size: 1.1rem;
}

/* Breakdown Items */
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.breakdown-item-with-calc {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.breakdown-item.total {
  font-weight: 600;
  font-size: 1.1rem;
  border-top: 2px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.breakdown-item .value {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 600;
}

.breakdown-item .value.savings {
  color: var(--success);
}

.calculation-detail {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-left: 1rem;
  font-style: italic;
}

/* Export Actions */
.export-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto 2rem auto;
}

.completion-message {
  text-align: center;
  padding: 2rem;
  background-color: var(--muted);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.completion-message h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--success);
}

.completion-message p {
  color: var(--muted-foreground);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background-color: var(--foreground);
  color: var(--background);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
}

.toast.success {
  background-color: var(--success);
  color: white;
}

.toast.error {
  background-color: var(--destructive);
  color: white;
}

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

/* Utility Classes */
.recalculate-btn {
  width: 100%;
  margin-top: 1rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-container {
    padding: 16px;
  }
  
  .header-title {
    font-size: 2rem;
  }
  
  .header-subtitle {
    font-size: 1rem;
  }
  
  .step-indicators {
    gap: 0.5rem;
  }
  
  .step span {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 0.875rem;
  }
  
  .step label {
    font-size: 0.75rem;
  }
  
  .radio-group {
    flex-direction: column;
  }
  
  .navigation {
    flex-direction: column;
  }
  
  .export-actions {
    max-width: none;
  }
  
  .result-field {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 0.5rem;
  }
  
  .breakdown-item {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .step-indicators {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  
  .step {
    min-width: 80px;
    flex: none;
  }
  
  .form-section {
    max-width: none;
  }
}

/* Print Styles */
@media print {
  .navigation,
  .copy-btn,
  .btn {
    display: none !important;
  }
  
  .app-container {
    max-width: none;
    padding: 0;
  }
  
  .step-content:not(.active) {
    display: none !important;
  }
}