/* Billing modals styling */

.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;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--background, #fff);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground, #000);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted-foreground, #666);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--muted, #f5f5f5);
  color: var(--foreground, #000);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid var(--border-color, #e0e0e0);
}

/* Form elements */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground, #000);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 6px;
  font-size: 14px;
  background: var(--background, #fff);
  color: var(--foreground, #000);
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-input:disabled {
  background: var(--muted, #f5f5f5);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-hint {
  font-size: 12px;
  color: var(--muted-foreground, #666);
  margin-top: 4px;
}

.input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-group .form-input {
  flex: 1;
}

.input-addon {
  font-size: 14px;
  color: var(--muted-foreground, #666);
  padding: 10px 12px;
  white-space: nowrap;
}

/* Cost breakdown */

.cost-breakdown {
  background: var(--muted, #f5f5f5);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.cost-row.cost-total {
  border-top: 1px solid var(--border-color, #e0e0e0);
  padding-top: 8px;
  margin-top: 8px;
  font-weight: 600;
}

.cost-label {
  color: var(--muted-foreground, #666);
}

.cost-value {
  color: var(--foreground, #000);
  font-weight: 500;
}

/* Message boxes */

.info-box,
.warning-box,
.error-message {
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.info-box {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #1565c0;
}

.warning-box {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  color: #e65100;
}

.warning-box.warning {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

.error-message {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
  display: none;
}

.help-text {
  font-size: 12px;
  color: var(--muted-foreground, #666);
  margin: 12px 0;
}

/* Spinner */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--muted, #f5f5f5);
  border-top-color: var(--primary, #007bff);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success/Error states */

.success-icon,
.error-icon {
  font-size: 48px;
  text-align: center;
  margin: 20px 0;
}

.success-icon {
  color: #4caf50;
}

.error-icon {
  color: #f44336;
}

#card-success-state h3,
#card-stripe-error-state h3,
#success-state h3,
#error-state h3 {
  margin: 12px 0 8px;
  text-align: center;
  font-size: 16px;
}

#card-success-state p,
#card-stripe-error-state p,
#success-state p,
#error-state p {
  text-align: center;
  color: var(--muted-foreground, #666);
  margin-bottom: 16px;
}

/* Stripe CardElement */

.card-element-container {
  padding: 12px;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 6px;
  background: var(--background, #fff);
  margin-bottom: 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Buttons */

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary, #007bff);
  color: white;
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-hover, #0056b3);
}

.btn-secondary {
  background: var(--muted, #f5f5f5);
  color: var(--foreground, #000);
  border: 1px solid var(--border-color, #e0e0e0);
}

.btn-secondary:not(:disabled):hover {
  background: var(--muted-hover, #e0e0e0);
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:not(:disabled):hover {
  background: #d32f2f;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary, #007bff);
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-weight: 500;
  text-decoration: underline;
}

.link-btn:hover {
  text-decoration: none;
}

/* Responsive */

@media (max-width: 600px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* Deduction Tracker */

.deduction-tracker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.deduction-tracker.pending {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #1565c0;
}

.deduction-tracker.success {
  background: #e8f5e9;
  border: 1px solid #81c784;
  color: #2e7d32;
}

.deduction-tracker.error {
  background: #ffebee;
  border: 1px solid #ef5350;
  color: #c62828;
}

.deduction-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.deduction-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(21, 101, 192, 0.2);
  border-top-color: #1565c0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.deduction-content {
  flex: 1;
}

.deduction-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.deduction-message {
  font-size: 12px;
  opacity: 0.8;
}
