/* ========== CVT GIFTING UI STYLES ========== */
/* Follows existing design system: 8px grid, semantic colors, no transitions */

/* Modal Base */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.modal-body {
  padding: 24px;
}

/* Gift Steps */
.gift-step {
  display: none;
}

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

/* Step 1: Eligibility */
.gift-intro p {
  margin: 0 0 16px 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.gift-eligibility-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.eligibility-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-base);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.eligibility-summary {
  text-align: center;
}

.available-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.credit-amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.credit-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.credit-details {
  color: var(--text-tertiary);
  font-size: 12px;
}

.eligibility-error .error-message {
  color: var(--danger);
  text-align: center;
  font-weight: 500;
}

/* Step Navigation */
.gift-actions,
.step-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.gift-actions button,
.step-actions button {
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
}

.gift-actions button.primary,
.step-actions button.primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.gift-actions button.primary:disabled,
.step-actions button.primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.gift-actions button.primary.danger {
  background: var(--danger);
}

.gift-actions button.secondary,
.step-actions button.secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-base);
}

/* Step 2: Recipient Selection */
.step-header {
  margin-bottom: 24px;
}

.step-header h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-header p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.4;
}

.recipient-form {
  margin-bottom: 24px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-base);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-primary);
}

.form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-field input:invalid {
  border-color: var(--danger);
}

.field-feedback {
  margin-top: 8px;
  font-size: 12px;
  display: block;
}

.field-feedback.error {
  color: var(--danger);
}

.field-feedback.success {
  color: var(--success);
}

.recipient-preview {
  margin-top: 16px;
}

.recipient-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

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

.recipient-info strong {
  font-weight: 600;
  color: var(--text-primary);
}

.recipient-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

.recipient-status {
  color: var(--success);
  font-size: 12px;
  font-weight: 500;
}

/* Step 3: Amount Selection */
.amount-form {
  margin-bottom: 24px;
}

.amount-input-container {
  position: relative;
  margin-bottom: 16px;
}

.amount-input-container input {
  width: 100%;
  padding: 16px 60px 16px 16px;
  border: 1px solid var(--border-base);
  border-radius: 6px;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
}

.amount-suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 500;
}

.amount-suggestions {
  margin-bottom: 16px;
}

.suggestion-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.suggestion-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.amount-suggestion {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.amount-suggestion:hover {
  background: var(--bg-secondary);
  border-color: var(--border-base);
}

.no-suggestions {
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: center;
  margin: 16px 0;
}

.amount-summary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.summary-row:last-child {
  margin-bottom: 0;
  font-weight: 600;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.summary-row span:first-child {
  color: var(--text-secondary);
  font-size: 14px;
}

.summary-row span:last-child {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

/* Step 4: Validation Results */
.validation-success,
.validation-error {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.validation-success {
  border-left: 4px solid var(--success);
}

.validation-error {
  border-left: 4px solid var(--danger);
}

.validation-success h4 {
  margin: 0 0 16px 0;
  color: var(--success);
  font-size: 16px;
}

.validation-error h4 {
  margin: 0 0 16px 0;
  color: var(--danger);
  font-size: 16px;
}

.gift-summary {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 16px;
}

.status-approved {
  color: var(--success);
  font-weight: 500;
}

.rule-details {
  margin-top: 16px;
}

.rule-details h5 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.rule-details ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-details li {
  padding: 4px 0;
  font-size: 12px;
}

.rule-details li.passed {
  color: var(--success);
}

.rule-details li.failed {
  color: var(--danger);
}

.rule-details li::before {
  content: "• ";
  margin-right: 8px;
}

/* Confirmation Warning */
.confirmation-warning {
  margin-bottom: 24px;
}

.warning-box {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 16px;
  color: #92400e;
}

.warning-box strong {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.warning-box p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

/* Step 5: Results */
.execution-success,
.execution-error {
  text-align: center;
  padding: 32px 16px;
}

.success-icon,
.error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.execution-success h3,
.execution-error h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
}

.execution-success h3 {
  color: var(--success);
}

.execution-error h3 {
  color: var(--danger);
}

.execution-success p,
.execution-error p {
  margin: 0 0 16px 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.success-details,
.error-details {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 16px;
  margin-top: 16px;
}

.success-details p,
.error-details p {
  margin: 0 0 8px 0;
  font-size: 12px;
}

.success-details p:last-child,
.error-details p:last-child {
  margin-bottom: 0;
}

.reminder {
  font-style: italic;
  color: var(--text-tertiary);
}

/* Add Gifting Button to Quota Bar */
.quota-bar-container {
  position: relative;
}

.quota-bar-container .quota-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.share-credits-btn {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}

.share-credits-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-base);
  color: var(--text-primary);
}

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

.share-credits-btn:disabled:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .modal-content {
    margin: 8px;
    max-width: none;
  }

  .modal-header,
  .modal-body {
    padding: 16px;
  }

  .suggestion-buttons {
    justify-content: center;
  }

  .amount-input-container input {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .gift-actions,
  .step-actions {
    flex-direction: column;
  }

  .gift-actions button,
  .step-actions button {
    width: 100%;
  }
}