@import url('variables.css');

.ld-custom-purchase-form {
    margin: var(--th-gap-30) 0;

    @media (max-width: var(--th-breakpoint-md)) {
        padding: var(--th-gap);
    }
}

.ld-purchase-header {
    margin-bottom: var(--th-gap);
    padding-bottom: var(--th-gap);
    display: flex;
    align-items: center;
    font-weight: 700;

    .ld-course-price-text{
        padding-right: 5px;
    }

    .ld-course-price {
    font-size: 24px;
    font-weight: 700;
    margin: 0;

    @media (max-width: var(--th-breakpoint-md)) {
        font-size: 22px;
    }
}
}



.ld-purchase-type {
    display: flex;
    flex-wrap: wrap;
    gap: var(--th-gap);
    margin-bottom: var(--th-gap);

    @media (max-width: var(--th-breakpoint-md)) {
        flex-direction: column;
        gap: var(--th-gap-sm);
    }
}

.ld-radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--th-gap-sm);
    border: 2px solid var(--th-border-color);
    border-radius: var(--th-radius);
    cursor: pointer;
    transition: var(--th-transition);

    &:hover {
        border-color: var(--th-purple);
    }

    & input[type="radio"] {
        margin: 0;
        cursor: pointer;
        width: 20px;
        height: 20px;
        appearance: none;
        border: 2px solid var(--th-border-color);
        border-radius: 50%;
        position: relative;
        transition: var(--th-transition);

        &:checked {
            border-color: var(--th-purple);
            background: var(--th-white);

            &::after {
                content: '';
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                width: 10px;
                height: 10px;
                border-radius: 50%;
                background: var(--th-purple);
            }
        }

        &:focus {
            outline: none;
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--th-purple) 10%, transparent);
        }

        &:checked + span {
            color: var(--th-purple);
            font-weight: 600;
        }
    }

    & span {
        color: var(--th-text-dark);
        font-size: 16px;
    }
}

.ld-group-fields {
    padding: var(--th-gap);
    background: var(--th-white);
    border-radius: var(--th-radius);
    margin-bottom: var(--th-gap);
}

.ld-form-field {
    margin-bottom: var(--th-gap);

    &:last-child {
        margin-bottom: 0;
    }

    & label {
        display: block;
        margin-bottom: 8px;
        color: var(--th-text-dark);
        font-weight: 500;
        font-size: 14px;
    }

    & input[type="text"],
    & input[type="number"] {
        width: 100%;
        padding: var(--th-gap-sm);
        border: 1px solid var(--th-border-color);
        border-radius: var(--th-radius);
        font-size: 16px;
        transition: var(--th-transition);
        background: var(--th-white);

        &::placeholder {
            color: var(--th-text-light);
            opacity: 0.7;
        }

        &:focus {
            outline: none;
            border-color: var(--th-purple);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--th-purple) 10%, transparent);
        }

        &:focus-visible {
            outline: none;
            border-color: var(--th-purple);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--th-purple) 10%, transparent);
        }

        &:-webkit-autofill,
        &:-webkit-autofill:hover,
        &:-webkit-autofill:focus,
        &:-webkit-autofill:active {
            -webkit-box-shadow: 0 0 0 30px var(--th-white) inset !important;
            -webkit-text-fill-color: var(--th-text-dark) !important;
            border-color: var(--th-purple) !important;
            transition: background-color 5000s ease-in-out 0s;
        }
    }
}

.ld-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--th-gap);
    background: var(--th-white);
    border-radius: var(--th-radius);
    font-size: 18px;
    font-weight: 600;
}

.ld-price-value {
    color: var(--th-purple);
    font-size: 22px;
}

.ld-add-to-cart-btn {
    width: 100% !important;
    padding: 16px var(--th-gap-30);
    background: var(--th-dark);
    color: var(--th-white);
    border: none;
    border-radius: var(--th-radius);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--th-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    &:hover:not(:disabled) {
        background: var(--th-dark-hover);
        transform: translateY(-2px);
        box-shadow: var(--th-shadow-lg);
    }

    &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    @media (max-width: var(--th-breakpoint-md)) {
        font-size: 16px;
        padding: 14px var(--th-gap);
    }
}

.btn-loader {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ld-purchase-message {
    margin-top: var(--th-gap);
    padding: var(--th-gap-sm);
    border-radius: var(--th-radius);
    text-align: center;
    font-weight: 500;
    display: none;

    &.success {
        background: rgba(70, 180, 80, 0.1);
        color: var(--th-success-color);
        border: 1px solid var(--th-success-color);
    }

    &.error {
        background: rgba(220, 50, 50, 0.1);
        color: var(--th-error-color);
        border: 1px solid var(--th-error-color);
    }
}
