/* ========================================
   DEVDRAFT PAYMENT STYLES
   ======================================== */

/* Form Validation Error Styles */
.checkout-input.error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px #dc2626 !important;
}

.field-error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

/* Transaction Status Styles */
.devdraft-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-awaiting {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
}

.status-review {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

.status-received {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.status-submitted {
  background-color: #e0e7ff;
  color: #3730a3;
  border: 1px solid #6366f1;
}

.status-processed {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.status-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.status-returned {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.status-refunded {
  background-color: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #8b5cf6;
}

.status-canceled {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #9ca3af;
}

.status-disputed {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #f87171;
}

.status-unknown {
  background-color: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

/* CSS Variables - Design System */
:root {
  /* DevDraft Brand Colors */
  --color-devdraft-teal: 25, 167, 169; /* RGB for #19a7a9 */
  --color-devdraft-teal-hover: 25, 167, 169, 0.4; /* RGB with opacity */
  --color-devdraft-tertiary: 25, 167, 169; /* RGB for #d9f3df */

  /* Light mode background matching console */
  --background: 180 40% 97%;
  --foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;

  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;

  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;

  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;

  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;

  --secondary: 0 0% 100%;
  --secondary-foreground: 240 5.9% 10%;

  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;

  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;

  --ring: 240 5.9% 10%;

  --radius: 0.5rem;

  /* Custom Colors */
  --devdraft-teal: rgb(var(--color-devdraft-teal));
  --devdraft-teal-hover: rgb(var(--color-devdraft-teal-hover));
  --border-default: rgba(39, 42, 46, 0.1);
  --icons-default: #616161;
  --success-green: #32b370;
  --error-red: #eb5b57;
  --primary-green: #19a7a9;
  --text-body-description: #9e9e9e;
  --menu-items-light: #f2f2f2;
  --background-bg-table-header: #f2f2f2;
  --table-heading: #7c7c82;
  --stroke-inside-section-light: #e6e6e6;
  --primary-teal: #17a7a9;
  --text-status-error: #f63c36;
  --teal-hover: #128587;
  --red-hover: #eb5b57;
  --background-bg-section-highlight: #f7f7f7;
  --button-hover: #f7f7f7;
  --stepper-green: #00833f;
  --stepper-green-bg: #ebfaf2;
  --stepper-gray: #f2f2f2;
  --stepper-gray-icon: #9e9e9e;
  --close-button-bg: #d9d9d9;
  --usdc-blue: #2775ca;
  --polygon-purple: #8247e5;
  --warning-bg: #fef7eb;
  --warning-text: #a26300;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "rlig" 1, "calt" 1;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.6;
}

/* Checkout Container */
.devdraft-payment-container {
  min-height: 100vh;
  background-color: white;
  display: flex;
  flex-direction: column;
}

/* Main Layout */
.checkout-main {
  display: flex;
  flex: 1;
  background-color: white;
}

.checkout-layout {
  display: flex;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  gap: 48px;
}

/* Left Side - Payment Form */
.checkout-left {
  flex: 1;
  display: block;
}

.checkout-content {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

/* DevDraft Logo Section */
/* Logo Section - Spans across both panes */
.devdraft-logo-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--stroke-inside-section-light);
}

.devdraft-logo img {
  display: block;
  width: 200px;
  height: 45px;
  object-fit: contain;
}

/* Ensure the logo colors are correct */
.devdraft-logo .cls-1 {
  fill: #19232c;
}

.devdraft-logo .cls-2 {
  fill: #19a7a9;
}

/* Right Side - Payment Summary */
.checkout-right {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding-top: 24px; /* Align with left side */
}

/* Divider */
.checkout-divider {
  width: 1px;
  background-color: var(--stroke-inside-section-light);
  height: auto;
}

/* Card Components */
.checkout-card {
  background-color: white;
  border: 1px solid var(--stroke-inside-section-light);
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}

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

.checkout-card-header {
  padding: 24px 24px 0;
}

.checkout-card-content {
  padding: 24px;
}

.checkout-card-footer {
  padding: 0 24px 24px;
  border-top: 1px solid var(--stroke-inside-section-light);
  margin-top: 24px;
  padding-top: 24px;
}

.checkout-card-title {
  font-size: 18px;
  font-weight: 600;
  color: black;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.3;
}

/* Typography */
.checkout-h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: black;
}

.checkout-h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: black;
}

.checkout-h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: black;
}

.checkout-h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: black;
}

.checkout-body {
  font-size: 16px;
  line-height: 1.5;
  color: black;
}

.checkout-body-sm {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body-description);
}

.checkout-caption {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-body-description);
}

/* Button Components */
.checkout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  min-height: 44px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  font-family: inherit;
}

.checkout-btn-primary {
  background-color: var(--devdraft-teal);
  color: white;
}

.checkout-btn-primary:hover {
  background-color: var(--teal-hover);
  transform: translateY(-1px);
}

.checkout-btn-primary:active {
  transform: translateY(0);
}

.checkout-btn-secondary {
  background-color: white;
  color: black;
  border: 1px solid var(--stroke-inside-section-light);
}

.checkout-btn-secondary:hover {
  background-color: var(--button-hover);
}

.checkout-btn-ghost {
  background-color: transparent;
  color: black;
}

.checkout-btn-ghost:hover {
  background-color: var(--button-hover);
}

.checkout-btn-sm {
  padding: 8px 12px;
  min-height: 36px;
  font-size: 12px;
}

.checkout-btn-lg {
  padding: 16px 24px;
  min-height: 52px;
  font-size: 16px;
}

.checkout-btn-full {
  width: 100%;
}

/* Form Components */
.checkout-input-group {
  display: flex;
  flex-direction: column;
  min-width: 300px;
  gap: 8px;
  margin-bottom: 16px;
}

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

.checkout-input {
  display: flex;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--stroke-inside-section-light);
  background-color: white;
  padding: 12px 16px;
  font-size: 14px;
  transition: all 0.2s ease-in-out;
  color: black;
  font-family: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.checkout-input-arrow {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

.checkout-input:focus {
  outline: none;
  border-color: var(--devdraft-teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 169, 0.1);
}

.checkout-input::placeholder {
  color: var(--text-body-description);
}

/* Readonly field styling */
.checkout-input[readonly] {
  background-color: var(--background-bg-section-highlight);
  border-color: var(--stroke-inside-section-light);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.checkout-input[readonly]:focus {
  border-color: var(--stroke-inside-section-light);
  box-shadow: none;
}

/* Disabled select styling */
.checkout-input:disabled {
  background-color: var(--background-bg-section-highlight);
  border-color: var(--stroke-inside-section-light);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.checkout-input:disabled:focus {
  border-color: var(--stroke-inside-section-light);
  box-shadow: none;
}

.checkout-label {
  font-size: 14px;
  font-weight: 500;
  color: black;
}

.checkout-input-error {
  border-color: var(--error-red);
}

.checkout-error-text {
  font-size: 12px;
  color: var(--error-red);
  margin-top: 4px;
}

/* Form Layout */
.checkout-section {
  margin-bottom: 24px;
}

.checkout-section:last-child {
  margin-bottom: 0;
}

.checkout-form-content {
  margin: 0 auto;
  width: 100%;
  padding: 24px;
}

/* Summary Items */
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--stroke-inside-section-light);
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  font-size: 14px;
  color: var(--text-body-description);
}

.summary-value {
  font-size: 14px;
  font-weight: 500;
  color: black;
}

/* Radio Groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--stroke-inside-section-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: white;
}

.radio-option:hover {
  background-color: var(--button-hover);
}

.radio-option.selected {
  border-color: var(--devdraft-teal);
  background-color: rgba(25, 167, 169, 0.05);
}

.radio-option input[type="radio"] {
  width: 16px;
  height: 16px;
  color: var(--devdraft-teal);
  border: 1px solid var(--stroke-inside-section-light);
  border-radius: 50%;
  cursor: pointer;
}

.radio-option input[type="radio"]:focus {
  outline: none;
  ring: 2px;
  ring-color: var(--devdraft-teal);
}

.flex-1 {
  flex: 1;
}

.font-medium {
  font-weight: 500;
}

.text-sm {
  font-size: 14px;
}

.text-text-body-description {
  color: var(--text-body-description);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.w-full {
  width: 100%;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-4 {
  gap: 16px;
}

.gap-6 {
  gap: 24px;
}

.space-y-6 > * + * {
  margin-top: 24px;
}

.space-y-5 > * + * {
  margin-top: 15px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-6 {
  margin-top: 24px;
}

/* Additional utility classes for success views */
.p-3 {
  padding: 12px;
}

.bg-gray-100 {
  background-color: #f3f4f6;
}

.rounded-lg {
  border-radius: 8px;
}

.font-mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
}

.break-all {
  word-break: break-all;
}

/* Network selector with logo */
.network-select-container {
  position: relative;
  display: flex;
  align-items: center;
}

.network-select {
  padding-right: 80px; /* Make room for logo + caret */
}

.network-logo {
  position: absolute;
  right: 40px; /* Move logo to the left of the caret */
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.network-logo img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

/* Copy button styling */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.copy-btn:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #d1d5db;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn svg {
  display: block;
  transition: all 0.2s ease;
}

/* QR code container */
#qr-code {
  display: inline-block;
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#qr-code canvas {
  display: block;
  margin: 0 auto;
}

/* Small copy button for summary items */
.copy-btn-small {
  position: absolute;
  top: 50%;
  right: -30px;
  transform: translateY(-50%);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  opacity: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.summary-value:hover .copy-btn-small {
  opacity: 1;
}

.copy-btn-small:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.copy-btn-small:active {
  transform: translateY(-50%) scale(0.95);
}

.copy-btn-small svg {
  display: block;
  transition: all 0.2s ease;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.left-4 {
  left: 16px;
}

.top-1\/2 {
  top: 50%;
}

.transform {
  transform: translateY(-50%);
}

.pl-8 {
  padding-left: 32px;
}

/* Result Message */
#resultMessage {
  position: fixed;
  top: 16px;
  right: 16px;
  max-width: 384px;
  background-color: white;
  border: 1px solid var(--stroke-inside-section-light);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 16px;
  z-index: 50;
}

#resultMessage .flex {
  display: flex;
}

#resultMessage .items-start {
  align-items: flex-start;
}

#resultMessage .flex-shrink-0 {
  flex-shrink: 0;
}

#resultMessage .ml-3 {
  margin-left: 12px;
}

#resultMessage .ml-auto {
  margin-left: auto;
}

#resultMessage .pl-3 {
  padding-left: 12px;
}

#resultMessage .w-5 {
  width: 20px;
}

#resultMessage .h-5 {
  height: 20px;
}

#resultMessage .w-4 {
  width: 16px;
}

#resultMessage .h-4 {
  height: 16px;
}

#resultMessage .text-sm {
  font-size: 14px;
}

#resultMessage .font-medium {
  font-weight: 500;
}

#resultMessage .mt-1 {
  margin-top: 4px;
}

#resultMessage .text-success-green {
  color: var(--success-green);
}

#resultMessage .text-error-red {
  color: var(--error-red);
}

#resultMessage .text-text-body-description {
  color: var(--text-body-description);
}

#resultMessage .hover\:text-black:hover {
  color: black;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

/* Modern Conic Gradient Spinner */
.loader {
  width: 20px;
  padding: 2px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #25b09b;
  --_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;
  -webkit-mask: var(--_m);
  mask: var(--_m);
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  animation: l3 1s infinite linear;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

/* White version for buttons */
.loader-white {
  width: 18px;
  padding: 2px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  --_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;
  -webkit-mask: var(--_m);
  mask: var(--_m);
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  animation: l3 1s infinite linear;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

/* QR Code loading version */
.loader-qr {
  width: 40px;
  padding: 4px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #25b09b;
  --_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;
  -webkit-mask: var(--_m);
  mask: var(--_m);
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  animation: l3 1s infinite linear;
}

/* Legacy spinner classes for compatibility */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
}

.spinner-border {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: l3 1s infinite linear;
}

.spinner-ripple {
  position: relative;
  width: 16px;
  height: 16px;
}

.spinner-ripple::before,
.spinner-ripple::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 1;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  animation: spinner-ripple 1.6s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.spinner-ripple::after {
  animation-delay: -0.8s;
}

/* Button Loading State */
.checkout-btn.loading {
  position: relative;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  transform: scale(0.98);
  transition: all 0.2s ease;
}

.checkout-btn.loading .btn-text {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

/* Enhanced Button Transitions */
.checkout-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1);
}

.checkout-btn:hover:not(.loading) {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(25, 167, 169, 0.2);
}

.checkout-btn:active:not(.loading) {
  transform: scale(0.98);
}

/* Smooth Spinner Container */
.spinner {
  transition: all 0.2s ease;
}

.spinner.spinner-border {
  border-width: 2px;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Keyframe Animations */
@keyframes l3 {
  to {
    transform: rotate(1turn);
  }
}

@keyframes spinner-ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Legacy support */
.animate-spin {
  animation: l3 1s infinite linear;
}

/* Responsive Design */
@media (max-width: 959px) {
  .checkout-left {
    display: none;
  }

  .checkout-divider {
    display: none;
  }

  .checkout-right {
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .checkout-form-content {
    max-width: none;
  }

  .checkout-layout {
    max-width: 100%;
    gap: 0;
  }
}

@media (max-width: 1024px) and (min-width: 960px) {
  .checkout-left {
    flex: 0 0 400px;
  }

  .checkout-right {
    flex: 1;
  }
}

/* Accessibility */
@media (prefers-contrast: high) {
  .checkout-input,
  .checkout-btn {
    border-width: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ========================================
   ESSENTIAL TWENTY TWENTY-FOUR THEME FIXES
   ======================================== */

/* Override Twenty Twenty-Four theme container constraints */
.wp-site-blocks .devdraft-payment-container,
.wp-block-group .devdraft-payment-container {
  max-width: 1200px !important;
  margin: 0 auto !important;
  width: 100% !important;
  padding: 20px !important;
}

/* Ensure form elements work properly in Twenty Twenty-Four */
.devdraft-payment-container input,
.devdraft-payment-container select,
.devdraft-payment-container textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* High z-index for result messages to appear above theme elements */
#resultMessage {
  z-index: 999999 !important;
}
