/* Loan Scenario Calculator - Styles */

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

html {
  --primary: #1e40af;
  --primary-hover: #1e3a8a;
  --secondary: #64748b;
  --secondary-hover: #475569;
  --success: #10b981;
  --success-hover: #059669;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

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

/* Main Layout */
.app-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.panel {
  background: white;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.panel h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--gray-900);
}

.panel h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--gray-800);
  font-weight: 600;
}

/* Upload Section */
.upload-section {
  margin-bottom: 20px;
}

.file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--border-radius);
  background: var(--gray-50);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  color: var(--primary);
}

.file-label:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--gray-50), rgba(30, 64, 175, 0.05));
}

.file-label:active {
  transform: scale(0.98);
}

.upload-icon {
  font-size: 1.5rem;
}

.file-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 8px;
  text-align: center;
}

/* Borrower Section */
.borrower-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--border-radius);
}

.borrower-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.borrower-summary {
  font-size: 0.9rem;
  color: var(--gray-600);
}

/* Liability Table */
.liability-section {
  margin-bottom: 16px;
}

.liability-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.liability-table thead {
  background: var(--gray-100);
  border-bottom: 2px solid var(--gray-300);
}

.liability-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
}

.liability-table tbody tr {
  border-bottom: 1px solid var(--gray-200);
}

.liability-table tbody tr:hover {
  background: var(--gray-50);
}

.liability-table td {
  padding: 12px;
}

.col-omit {
  width: 60px;
}

.col-omit input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.col-payment {
  text-align: right;
  font-weight: 500;
  color: var(--gray-900);
}

.liability-table .empty-state {
  text-align: center;
  color: var(--gray-400);
}

/* Liability Totals */
.liability-totals {
  background: var(--gray-50);
  padding: 12px;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
}

.total-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.95rem;
}

.total-line strong {
  color: var(--primary);
  font-weight: 600;
}

/* Scenario Builder */
.scenario-builder {
  margin-bottom: 24px;
}

.scenarios-list {
  margin-bottom: 16px;
}

.scenario-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 16px;
}

.scenario-header {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.scenario-label {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 500;
}

.scenario-label:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.btn-remove {
  padding: 4px 8px;
  color: var(--danger);
  font-size: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-remove:hover {
  color: #b91c1c;
}

/* Scenario Form */
.scenario-form {
  display: grid;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Calculated Payment Display */
.calculated-payment {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-weight: 600;
  color: var(--primary);
}

/* Action Section */
.action-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
}

.button-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 8px;
  text-align: center;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-900);
}

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

.btn-icon {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray-500);
  transition: color 0.2s;
}

.btn-icon:hover {
  color: var(--gray-900);
}

/* Output Section */
.output-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  padding: 16px;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.output-header h3 {
  margin: 0;
}

.output-text {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  max-height: 600px;
  overflow-y: auto;
  color: var(--gray-800);
}

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

  .app-layout {
    gap: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .liability-table {
    font-size: 0.85rem;
  }

  .liability-table th,
  .liability-table td {
    padding: 8px;
  }
}

/* Loading State */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn.loading::after {
  content: ' ⏳';
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--gray-900);
  color: white;
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

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

.toast.error {
  background: var(--danger);
}

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