/* ============================================
   Used Car Negotiation Calculator — Styles
   ============================================ */

:root {
  --color-bg: #f5f6fa;
  --color-card: #ffffff;
  --color-text: #2d3436;
  --color-text-secondary: #636e72;
  --color-border: #dfe6e9;
  --color-primary: #0984e3;
  --color-primary-hover: #0769b5;
  --color-green: #00b894;
  --color-green-bg: #e6f9f3;
  --color-yellow: #fdcb6e;
  --color-yellow-bg: #fef9e7;
  --color-orange: #e17055;
  --color-orange-bg: #fdf0ed;
  --color-red: #d63031;
  --color-red-bg: #fde8e8;
  --color-deduction: #d63031;
  --color-highlight: #0984e3;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --spacing: 20px;
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.app-header {
  text-align: center;
  padding: 32px var(--spacing) 16px;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.app-header .subtitle {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* Main Layout */
.app-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing) var(--spacing);
  align-items: start;
}

.input-column,
.output-column {
  display: flex;
  flex-direction: column;
  gap: var(--spacing);
}

/* Sticky results on desktop */
@media (min-width: 769px) {
  .output-column {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

/* Cards */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-bg);
  padding-bottom: 8px;
}

/* Form Groups */
.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text);
}

.form-group select,
.form-group input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-main);
  background: var(--color-card);
  color: var(--color-text);
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23636e72' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.12);
}

.help-text {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  margin-top: 3px;
}

.note-text {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  background: var(--color-yellow-bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  line-height: 1.5;
}

/* Feature Checkboxes */
#feature-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.feature-item:hover {
  background: #eef1f5;
}

.feature-item input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.feature-item .feature-label {
  font-size: 0.9rem;
  cursor: pointer;
  flex: 1;
}

.feature-item .feature-deduction {
  font-size: 0.75rem;
  color: var(--color-deduction);
  white-space: nowrap;
}

.feature-warning {
  font-size: 0.8rem;
  color: var(--color-orange);
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--color-orange-bg);
  border-radius: var(--radius-sm);
}

/* Result Card */
.result-card {
  border-color: var(--color-primary);
  border-width: 2px;
}

.format-toggle {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.format-toggle label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.format-toggle input[type="radio"] {
  accent-color: var(--color-primary);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.result-label {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
}

.result-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: right;
}

.result-value.deduction {
  color: var(--color-deduction);
}

.result-value.highlight {
  color: var(--color-primary);
}

.result-card hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 8px 0;
}

/* Deal Badge */
.deal-badge {
  text-align: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 12px;
}

.deal-badge.great-deal {
  background: var(--color-green-bg);
  color: #00a381;
}

.deal-badge.fair-deal {
  background: var(--color-green-bg);
  color: #00b894;
}

.deal-badge.slightly-overpriced {
  background: var(--color-yellow-bg);
  color: #d4a017;
}

.deal-badge.overpriced {
  background: var(--color-orange-bg);
  color: var(--color-orange);
}

.deal-badge.avoid {
  background: var(--color-red-bg);
  color: var(--color-red);
}

.below-strong-buy-alert {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--color-green-bg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #00a381;
  font-weight: 500;
}

/* Negotiation Summary */
#negotiation-summary {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-copy {
  background: var(--color-primary);
  color: #fff;
  margin-top: 12px;
  width: 100%;
  justify-content: center;
}

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

.btn-copy.copied {
  background: var(--color-green);
}

.btn-reset {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-reset:hover {
  background: var(--color-bg);
}

.actions-bar {
  text-align: center;
  padding: 16px var(--spacing) 24px;
}

/* Checklist */
.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist li label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.checklist li label:hover {
  background: var(--color-bg);
}

.checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 24px var(--spacing) 32px;
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.5;
}

.app-footer code {
  background: #e1e5ea;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.76rem;
}

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

  .app-main {
    grid-template-columns: 1fr;
    padding: 0 12px 12px;
  }

  .card {
    padding: 18px;
  }

  .result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .result-value {
    text-align: left;
  }

  .output-column {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Remove number input spinners for cleaner look */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}
