/* CSS Variables for consistent theming */
:root {
    --color-primary: #000000;
    --color-white: #ffffff;
    --color-error: #D32F2F;
    --color-border: #D1D5DB;
    /* Gray-300 */
    --color-text-main: #111827;
    /* Gray-900 */
    --color-text-sub: #6B7280;
    /* Gray-500 */
    --color-bg: #F3F4F6;
    /* Light gray background for the page */

    --font-family: 'Inter', sans-serif;
    --border-radius: 8px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: #ffffff;
    /* White background as requested */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--spacing-md);
    color: var(--color-text-main);
}

/* Main Container */
.checkout-container {
    background-color: var(--color-white);
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Header */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-main);
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-main);
    margin-bottom: 6px;
}

.input-helper {
    font-size: 12px;
    color: var(--color-text-sub);
    margin-top: 4px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: var(--font-family);
    color: var(--color-text-main);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    /* Soft focus ring */
}

/* Formatting placeholder to match design style if needed */
.form-input::placeholder {
    color: #9CA3AF;
}

/* Error States - Logic handled via JS classes */
.form-input.error {
    border-color: var(--color-error);
}

.error-message {
    display: none;
    /* Hidden by default */
    align-items: center;
    gap: 6px;
    color: var(--color-error);
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.error-message.visible {
    display: flex;
}

.error-icon {
    font-size: 14px;
}

/* Section Divider */
.section-divider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    /* Extra space before payment section */
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
}

.card-icons {
    display: flex;
    gap: 16px;
    /* Increased space between images */
}

.card-brand-img {
    width: 38px;
    height: 24px;
    object-fit: contain;
    /* Prevents distortion/warping */
    border-radius: 4px;
    background-color: #F3F4F6;
    /* Light background for smaller logos */
}

/* Card Inputs Layout */
.form-row {
    display: flex;
    gap: 16px;
}

.half-width {
    flex: 1;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

/* Pay Button */
.pay-button {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
}

.pay-button:hover {
    background-color: #333;
}

.pay-button:active {
    transform: scale(0.99);
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Spinning animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 2s linear infinite;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .checkout-container {
        padding: 24px;
        border-radius: 0;
        /* Full screen on very small/embedded views possibly */
        max-width: 100%;
        min-height: 100vh;
    }

    body {
        padding: 0;
        align-items: flex-start;
    }
}

/* Modal and Progress Bar */
.modal-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-text {
    font-size: 14px;
    color: var(--color-text-sub);
    margin-bottom: 24px;
}

.progress-circle-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.progress-circle {
    transform: rotate(-90deg);
    /* Start from top */
}

.circle-fill {
    stroke: var(--color-primary);
    stroke-dasharray: 339.292;
    /* 2 * PI * 54 */
    stroke-dashoffset: 339.292;
    /* Start hidden */
    transition: stroke-dashoffset 0.1s linear;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-main);
}

/* Success Animation Class */
.success-icon {
    animation: scaleUp 0.5s ease-out forwards;
}

@keyframes scaleUp {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}