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

/* Skip to main content link for accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #4A92EA;
    color: white;
    padding: 1rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    z-index: 10000;
    border-radius: 0 0 0.5rem 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #45B649;
    outline-offset: 2px;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background: radial-gradient(ellipse at top left, #8BD5F0 0%, #4A92EA 50%, #45B649 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c5aa0 0%, #3d7fc9 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.logo {
    max-width: 280px;
    width: 100%;
    height: auto;
    margin: 0 auto 1rem;
    display: block;
}

.lock-icon-inline {
    width: 18px;
    height: 18px;
    opacity: 0.9;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.4rem;
    margin-top: -2px;
}

.lock-icon-notice {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.3rem;
    margin-top: -2px;
}

header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
}

main {
    padding: 2rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h2 {
    font-size: 1.25rem;
    color: #2c5aa0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #444;
}

.required {
    color: #e74c3c;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
    outline: 3px solid #4A92EA;
    outline-offset: 2px;
    border-color: #4A92EA;
    box-shadow: 0 0 0 4px rgba(74, 146, 234, 0.2);
}

/* High visibility focus for keyboard navigation */
*:focus-visible {
    outline: 3px solid #4A92EA;
    outline-offset: 2px;
}

input:invalid:not(:placeholder-shown) {
    border-color: #e74c3c;
}

.input-prefix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix .prefix {
    position: absolute;
    left: 0.75rem;
    font-weight: 600;
    color: #666;
}

.input-prefix input {
    padding-left: 2rem;
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #666;
}

.security-notice {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
}

.security-notice p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    min-height: 48px; /* WCAG AAA touch target size */
    background: linear-gradient(135deg, #2c5aa0 0%, #3d7fc9 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(44, 90, 160, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    display: none;
    background: #fee;
    border-left: 4px solid #e74c3c;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    color: #c0392b;
}

.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

footer a {
    color: #2c5aa0;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
    color: #2c5aa0;
}

/* Responsive Design */

/* Tablets and below */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"] {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 48px; /* Touch target size */
    }

    .btn-primary {
        min-height: 52px; /* Larger touch target on mobile */
        font-size: 1.15rem;
    }

    .details dl {
        grid-template-columns: 120px 1fr;
        gap: 0.75rem;
    }
}

/* Mobile phones */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .container {
        border-radius: 0.5rem;
    }

    header {
        padding: 1.5rem 1rem;
    }

    .logo {
        max-width: 220px;
    }

    .lock-icon-inline {
        width: 16px;
        height: 16px;
        margin-right: 0.3rem;
    }

    header .subtitle {
        font-size: 0.85rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

    .form-section h2 {
        font-size: 1.1rem;
    }

    footer {
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Stack form elements on very small screens */
    .details dl {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .details dt {
        font-weight: 700;
        margin-bottom: -0.25rem;
    }

    /* Make iframe responsive */
    #payment-frame,
    .payment-skeleton {
        height: 500px;
    }
}

/* Very small devices */
@media (max-width: 375px) {
    body {
        padding: 0.5rem 0.25rem;
    }

    header, main, footer {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .btn-primary {
        font-size: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    input {
        border-width: 3px;
    }

    .btn-primary {
        border: 3px solid white;
    }
}

/* Print styles for payment confirmations */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .skip-link,
    .btn-primary,
    .btn-secondary,
    .btn-retry,
    .btn-contact,
    footer,
    .toastify {
        display: none !important;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
    }

    header {
        background: none;
        color: #333;
        border-bottom: 2px solid #333;
    }

    .success-icon,
    .error-icon {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .details {
        border: 2px solid #333;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    /* Add page breaks */
    h1, h2 {
        page-break-after: avoid;
    }

    .details {
        page-break-inside: avoid;
    }
}

/* Toastify custom styles */
.toastify {
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  font-size: 0.95rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.toastify.success {
  background: linear-gradient(135deg, #45B649 0%, #4A92EA 100%);
}

.toastify.error {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.toastify.info {
  background: linear-gradient(135deg, #8BD5F0 0%, #4A92EA 100%);
}

.toastify.warning {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

/* Shimmer overlay */
.shimmer {
  background: linear-gradient(
    110deg,
    rgba(69, 182, 73, 0) 0%,           /* transparent green */
    rgba(139, 213, 240, 0.12) 35%,     /* light blue shimmer */
    rgba(74, 146, 234, 0.15) 50%,      /* brand blue glow */
    rgba(69, 182, 73, 0.08) 65%,       /* subtle green accent */
    rgba(255, 255, 255, 0.05) 80%,     /* white highlight */
    rgba(69, 182, 73, 0) 100%          /* transparent */
  );
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Skeleton screen for iframe loading */
.payment-skeleton {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  position: relative;
  overflow: hidden;
  height: 600px;
}

.payment-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    rgba(69, 182, 73, 0) 0%,
    rgba(139, 213, 240, 0.12) 35%,
    rgba(74, 146, 234, 0.15) 50%,
    rgba(69, 182, 73, 0.08) 65%,
    rgba(255, 255, 255, 0.05) 80%,
    rgba(69, 182, 73, 0) 100%
  );
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

.skeleton-line {
  height: 20px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.medium {
  width: 80%;
}

.skeleton-input {
  height: 50px;
  background: #e0e0e0;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.skeleton-button {
  height: 50px;
  background: #e0e0e0;
  border-radius: 8px;
  margin-top: 2rem;
}

/* Processing overlay */
.processing-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.processing-overlay.active {
  display: flex;
}

.processing-card {
  background: white;
  padding: 3rem 4rem;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
  position: relative;
  overflow: hidden;
  max-width: 400px;
}

.processing-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    rgba(69, 182, 73, 0) 0%,
    rgba(139, 213, 240, 0.12) 35%,
    rgba(74, 146, 234, 0.15) 50%,
    rgba(69, 182, 73, 0.08) 65%,
    rgba(255, 255, 255, 0.05) 80%,
    rgba(69, 182, 73, 0) 100%
  );
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

.processing-content {
  position: relative;
  z-index: 1;
}

.processing-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4A92EA;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.processing-card h3 {
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 1.5rem;
}

.processing-card p {
  color: #666;
  margin: 0;
}
