/* Annual Fee Worth It Calculator — CreditStud.io */

/* Card Search */
.card-search-wrapper {
  position: relative;
  margin: 16px 0;
}

#cardSearch {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#cardSearch:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.card-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: none;
}

.card-list.active {
  display: block;
}

.card-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--bg);
  transition: background 0.15s;
}

.card-list-item:hover {
  background: var(--primary-light);
}

.card-list-item-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.card-list-item-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-list-item-af {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-left: 12px;
}

/* Selected Card */
.selected-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
}

.selected-card-name {
  font-size: 1rem;
}

#selectedCardName {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.selected-card-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Subheadings */
.subheading {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 10px;
}

/* Spending Grid */
.spending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 8px 0 24px;
}

.spending-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spending-item label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.spending-item .spending-rate {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 600;
}

.spending-item input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
}

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

/* Perks */
.perk-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.would-spend-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.would-spend-toggle input {
  accent-color: var(--primary);
}

.perks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}

.perk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.perk-item:hover {
  border-color: var(--primary);
}

.perk-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.perk-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.perk-item-name {
  font-size: 0.85rem;
  font-weight: 500;
  flex: 1;
}

.perk-item-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

/* Verdict */
.verdict-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin: 20px 0;
  transition: border-color 0.3s;
}

.verdict-amount {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
}

.verdict-amount.positive {
  color: var(--success);
}

.verdict-amount.negative {
  color: var(--danger);
}

.verdict-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.verdict-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.verdict-badge.worth-it {
  background: var(--success-light);
  color: var(--success);
}

.verdict-badge.marginal {
  background: var(--warning-light);
  color: var(--warning);
}

.verdict-badge.skip-it {
  background: var(--danger-light);
  color: var(--danger);
}

/* Breakdown */
.breakdown-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 20px 0;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--bg);
  font-size: 0.95rem;
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-row.total {
  background: var(--bg);
  font-weight: 700;
  font-size: 1rem;
  border-top: 2px solid var(--border);
}

.breakdown-row.positive .breakdown-value {
  color: var(--success);
}

.breakdown-row.negative .breakdown-value {
  color: var(--danger);
}

.breakdown-label {
  color: var(--text-secondary);
}

.breakdown-value {
  font-weight: 600;
}

/* Verdict Explanation */
.verdict-explanation {
  margin: 16px 0 24px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.verdict-explanation strong {
  color: var(--text);
}

/* CTA */
.cta-section {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

.cta-btn {
  text-decoration: none;
  font-weight: 600;
}

/* Share */
.share-bar {
  margin: 16px 0;
  display: flex;
  gap: 8px;
}

/* FAQ */
.faq-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  padding: 12px 16px;
}

.faq-section summary {
  font-weight: 600;
  cursor: pointer;
}

.faq-section summary:hover {
  color: var(--primary);
}

.faq-section details[open] summary {
  margin-bottom: 8px;
}

.faq-section details p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 640px) {
  .spending-grid {
    grid-template-columns: 1fr;
  }

  .perks-grid {
    grid-template-columns: 1fr;
  }

  .verdict-amount {
    font-size: 2.2rem;
  }

  .cta-section {
    flex-direction: column;
  }

  .cta-btn {
    text-align: center;
  }

  .perk-toggle-header {
    flex-direction: column;
    align-items: flex-start;
  }
}