/* ===========================
   Hex-Rays Shop Checkout
   Matches my.hex-rays.com/shop
   =========================== */

/* CSS Variables */
:root {
  --color-bg: #f8f9fa;
  --color-white: #ffffff;
  --color-text-primary: #222222;
  --color-text-secondary: #6c6c6c;
  --color-text-muted: #9d9d9d;
  --color-border: #e0e0e0;
  --color-border-light: #eeeeee;
  --color-green: #10b981;
  --color-green-light: #d1fae5;
  --color-blue: #3b82f6;
  --header-height: 72px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg);
  min-height: 100vh;
}

/* ===========================
   Header with Stepper
   =========================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 32px;
  max-width: 1440px;
  margin: 0 auto;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 180px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

.logo-text {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.step.completed .step-indicator.done {
  background: var(--color-green);
  border-color: var(--color-green);
  color: white;
}

.step.active .step-indicator {
  background: var(--color-blue);
  border-color: var(--color-blue);
  color: white;
}

.step-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
}

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

.step-connector {
  width: 48px;
  height: 2px;
  background: var(--color-border);
  margin: 0 8px;
}

/* User Info */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  justify-content: flex-end;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.user-email {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ===========================
   Main Content
   =========================== */

.main {
  padding-top: calc(var(--header-height) + 24px);
  padding-bottom: 48px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Quote Banner */
.quote-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  color: #92400e;
}

.quote-banner svg {
  flex-shrink: 0;
}

.quote-banner strong {
  font-weight: 600;
}

.quote-banner-note {
  margin-left: auto;
  font-size: 13px;
  color: #b45309;
}

/* Two Column Layout */
.two-column {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .two-column {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Cards
   =========================== */

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.card:last-child {
  margin-bottom: 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 20px;
}

/* ===========================
   Form Elements
   =========================== */

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

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

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.info-icon {
  color: var(--color-text-muted);
  cursor: help;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper select {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-white);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  appearance: none;
  cursor: pointer;
}

.select-wrapper.has-prefix select {
  padding-left: 40px;
}

.select-wrapper.locked select {
  background: #f5f5f5;
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.select-arrow {
  position: absolute;
  right: 14px;
  pointer-events: none;
  color: var(--color-text-muted);
}

.currency-icon {
  position: absolute;
  left: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-border-light);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-icon {
  position: absolute;
  right: 36px;
  color: var(--color-text-muted);
}

/* ===========================
   Line Items (Product Plans)
   =========================== */

.line-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.line-item {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--color-white);
}

.line-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.date-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* Stripe pattern background */
.stripe-pattern {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: repeating-linear-gradient(
    -55deg,
    transparent,
    transparent 6px,
    #f5f5f5 6px,
    #f5f5f5 7px
  );
  border-radius: 0 8px 8px 0;
  pointer-events: none;
  opacity: 0.5;
}

.line-item-form {
  display: grid;
  grid-template-columns: 1fr 140px 80px auto;
  gap: 12px;
  align-items: end;
  position: relative;
  z-index: 1;
  padding-bottom: 20px;
}

.line-item-form .field:first-child {
  position: relative;
}

.field-description {
  position: absolute;
  bottom: -18px;
  left: 0;
  font-size: 11px;
  color: var(--color-text-muted);
}

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

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-label .required {
  color: #ef4444;
}

.field select,
.field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-white);
}

.field select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239d9d9d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.field select:disabled,
.field input:disabled {
  background: #f9f9f9;
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.field input[type="number"] {
  text-align: center;
  -moz-appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.line-item-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-bottom: 4px;
}

.total-label {
  font-size: 12px;
  color: var(--color-text-muted);
}

.total-amount {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Add-ons */
.addons {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

.addons-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.addon-options {
  display: flex;
  gap: 24px;
}

.addon-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.addon-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
}

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

.addon-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #e0e7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #4f46e5;
}

.addon-name {
  font-size: 14px;
  color: var(--color-text-primary);
}

.addon-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-left: auto;
}

/* Add Item Button */
.add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  margin-top: 8px;
}

.add-item-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.add-item-btn:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* ===========================
   Summary Card
   =========================== */

.summary-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  position: sticky;
  top: calc(var(--header-height) + 24px);
}

.summary-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 20px;
}

.summary-content {
  margin-bottom: 20px;
}

.summary-section {
  margin-bottom: 16px;
}

.summary-section-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.summary-item-name {
  font-size: 14px;
  color: var(--color-text-primary);
}

.summary-item-qty {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-left: 8px;
}

.summary-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 16px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
}

.summary-row.total {
  font-size: 18px;
  font-weight: 600;
  padding-top: 12px;
}

.summary-empty {
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Continue Button */
.continue-button {
  width: 100%;
  height: 52px;
  background: #1a1a1a;
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.continue-button:hover:not(:disabled) {
  background: #333;
}

.continue-button:disabled {
  background: #e5e5e5;
  color: #999;
  cursor: not-allowed;
}

.btn-text,
.btn-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  animation: spin 1s linear infinite;
}

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

/* ===========================
   Responsive
   =========================== */

@media (max-width: 1100px) {
  .stepper {
    display: none;
  }

  .logo, .user-info {
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

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

  .line-item-total {
    grid-column: span 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
  }
}
