/* ========================================
   CHECKOUT FORM MODAL - Pixel Perfect UI
   ======================================== */

.udc-checkout-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.udc-checkout-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.udc-checkout-container {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.udc-checkout-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    color: #666;
}

.udc-checkout-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.udc-checkout-header {
    padding: 32px 40px 24px;
    border-bottom: 1px solid #eaeaea;
}

.udc-checkout-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.udc-checkout-header p {
    font-size: 15px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Two-Column Layout */
.udc-checkout-body {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0;
    max-height: calc(90vh - 120px);
    overflow: hidden;
}

.udc-checkout-main {
    padding: 32px 40px;
    overflow-y: auto;
    border-right: 1px solid #eaeaea;
}

.udc-checkout-form {
    padding: 0;
}

/* Sidebar - Sticky Order Summary */
.udc-checkout-sidebar {
    background: #fafafa;
    padding: 32px 24px;
    position: sticky;
    top: 0;
    height: 100%;
    overflow-y: auto;
}

.udc-checkout-summary-sticky {
    position: sticky;
    top: 0;
}

.udc-form-section {
    margin-bottom: 32px;
}

.udc-form-section:last-of-type {
    margin-bottom: 0;
}

.udc-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eaeaea;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.udc-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.udc-form-row:last-child {
    margin-bottom: 0;
}

.udc-form-group {
    display: flex;
    flex-direction: column;
}

.udc-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.optional {
    font-weight: 400;
    color: #999;
    font-size: 12px;
}

.udc-form-group input[type="text"],
.udc-form-group input[type="email"],
.udc-form-group input[type="tel"] {
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.15s ease;
    background: #fff;
    color: #1a1a1a;
}

.udc-form-group input:hover {
    border-color: #c0c0c0;
}

.udc-form-group input:focus {
    outline: none;
    border-color: #2d5f5d;
    box-shadow: 0 0 0 3px rgba(45, 95, 93, 0.08);
}

.udc-form-group small {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    line-height: 1.4;
}

/* Payment Methods */
.udc-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.udc-payment-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
}

.udc-payment-option:hover {
    border-color: #2d5f5d;
    background: rgba(45, 95, 93, 0.02);
}

.udc-payment-option.active {
    border-color: #2d5f5d;
    background: rgba(45, 95, 93, 0.04);
    box-shadow: 0 0 0 3px rgba(45, 95, 93, 0.06);
}

.udc-payment-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2d5f5d;
}

.payment-icon {
    font-size: 22px;
    line-height: 1;
}

.payment-label {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.payment-powered {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Stripe Elements */
#udc-stripe-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eaeaea;
}

.stripe-card-element {
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    transition: all 0.15s ease;
}

.stripe-card-element.StripeElement--focus {
    border-color: #2d5f5d;
    box-shadow: 0 0 0 3px rgba(45, 95, 93, 0.08);
}

.stripe-errors {
    color: #d32f2f;
    font-size: 13px;
    margin-top: 8px;
    min-height: 18px;
}

/* Checkout Summary */
.udc-checkout-summary {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.udc-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    color: #555;
}

.udc-summary-row:first-child {
    padding-top: 0;
}

.udc-summary-total {
    border-top: 1px solid #e0e0e0;
    margin-top: 8px;
    padding-top: 14px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.udc-summary-total span:last-child {
    color: #2d5f5d;
}

.udc-summary-note {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin: 16px 0 0;
    line-height: 1.5;
}

/* Trust Badges */
.udc-trust-badges {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.udc-trust-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #555;
}

.udc-trust-item svg {
    color: #2d5f5d;
    flex-shrink: 0;
}

/* Checkbox */
.udc-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    line-height: 1.5;
}

.udc-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2d5f5d;
}

.udc-checkbox-label a {
    color: #2d5f5d;
    text-decoration: none;
    font-weight: 500;
}

.udc-checkbox-label a:hover {
    text-decoration: underline;
}

/* Form Actions */
.udc-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.udc-btn-submit {
    flex: 1;
    padding: 14px 24px;
    background: #2d5f5d;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    letter-spacing: -0.01em;
}

.udc-btn-submit:hover {
    background: #234847;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(45, 95, 93, 0.25);
}

.udc-btn-submit:active {
    transform: translateY(0);
}

.udc-btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.udc-btn-submit .btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.udc-btn-cancel {
    padding: 14px 24px;
    background: #fff;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.udc-btn-cancel:hover {
    border-color: #c0c0c0;
    background: #f5f5f5;
    color: #333;
}

/* Security Notice */
.udc-security-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

.udc-security-notice svg {
    color: #46b450;
    flex-shrink: 0;
}

/* Scrollbar Styling */
.udc-checkout-main::-webkit-scrollbar,
.udc-checkout-sidebar::-webkit-scrollbar {
    width: 6px;
}

.udc-checkout-main::-webkit-scrollbar-track,
.udc-checkout-sidebar::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.udc-checkout-main::-webkit-scrollbar-thumb,
.udc-checkout-sidebar::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.udc-checkout-main::-webkit-scrollbar-thumb:hover,
.udc-checkout-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ========================================
   RESPONSIVE - Mobile Bottom Sheet
   ======================================== */
@media (max-width: 900px) {
    .udc-checkout-modal {
        padding: 16px;
    }

    .udc-checkout-container {
        max-width: 560px;
        border-radius: 16px;
        max-height: 95vh;
    }

    .udc-checkout-body {
        grid-template-columns: 1fr;
        gap: 0;
        max-height: none;
        overflow: visible;
    }

    .udc-checkout-main {
        padding: 24px 20px;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
    }

    .udc-checkout-sidebar {
        position: static;
        padding: 20px;
        background: #f5f5f5;
    }

    .udc-checkout-summary-sticky {
        position: static;
    }

    .udc-checkout-header {
        padding: 24px 20px 20px;
    }

    .udc-checkout-header h2 {
        font-size: 22px;
    }

    .udc-checkout-header p {
        font-size: 14px;
    }

    .udc-form-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .udc-section-title {
        font-size: 13px;
    }

    .udc-form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .udc-btn-submit,
    .udc-btn-cancel {
        width: 100%;
    }

    .udc-checkout-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
}

/* Mobile Bottom Sheet Style */
@media (max-width: 768px) {
    .udc-checkout-modal {
        padding: 0;
        align-items: flex-end;
    }

    .udc-checkout-container {
        max-width: none;
        width: 100%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        animation: slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .udc-checkout-main {
        padding: 24px 16px;
    }

    .udc-checkout-sidebar {
        padding: 16px;
        background: #fafafa;
    }

    .udc-form-group input[type="text"],
    .udc-form-group input[type="email"],
    .udc-form-group input[type="tel"] {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .udc-payment-option {
        padding: 14px;
    }

    .stripe-card-element {
        padding: 14px;
    }

    .udc-trust-badges {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .udc-trust-item {
        flex: 1;
        min-width: 140px;
        justify-content: center;
        padding: 10px;
        background: #fff;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
    }
}

@media (max-width: 480px) {
    .udc-checkout-header h2 {
        font-size: 20px;
    }

    .udc-section-title {
        font-size: 12px;
    }

    .payment-icon {
        font-size: 20px;
    }

    .payment-label {
        font-size: 13px;
    }

    .payment-powered {
        display: none;
    }

    .udc-trust-item {
        min-width: 100%;
    }
}