/* ==========================================================================
   Component: Gift Modal
   "Книга в подарок" — gift a book overlay modal
   ========================================================================== */

/* Overlay, backdrop, popup, scrollbar, close — provided by dsb-modal-base.css */

/* --- Close button positioning --- */
.gift-modal__close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 2;
}

/* --- Form layout --- */
.gift-modal__form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* --- Title --- */
.gift-modal__title {
    font-family: var(--font-family-serif);
    font-size: 28px;
    font-weight: 500;
    line-height: 40px;
    color: var(--color-text);
    padding-right: 32px;
}

/* --- Product name --- */
.gift-modal__product-name {
    font-family: var(--font-family);
    font-size: var(--font-size-lg);
    font-weight: 400;
    line-height: 24px;
    color: var(--color-dark-600);
}

/* --- Divider --- */
.gift-modal__divider {
    border: none;
    height: 1px;
    background: var(--color-accent-200);
    margin: 0;
}

/* --- Label (section) --- */
.gift-modal__label {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 15px;
    color: var(--color-dark-600);
}

/* --- Type rows (checkbox rows) --- */
.gift-modal__types {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.gift-modal__type-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.gift-modal__type-name {
    flex: 1;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 18px;
    color: var(--color-text);
}

.gift-modal__type-price {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--color-accent-50);
    border: 1px solid var(--color-dark-300);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    color: var(--color-text);
}

.gift-modal__type-price svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- Custom checkbox --- */
.gift-modal__checkbox-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.gift-modal__checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.gift-modal__checkbox-visual {
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-dark-300);
    border-radius: 3px;
    background: var(--color-accent-50);
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.gift-modal__checkbox:checked + .gift-modal__checkbox-visual {
    background: var(--color-accent-600);
    border-color: var(--color-dark-300);
    transform: scale(1.1);
}

.gift-modal__checkbox:checked + .gift-modal__checkbox-visual::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 4px;
    width: 8px;
    height: 5px;
    border-left: 1.5px solid var(--color-text);
    border-bottom: 1.5px solid var(--color-text);
    transform: rotate(-45deg) scale(0);
    animation: gift-checkmark 0.2s ease 0.05s forwards;
}

@keyframes gift-checkmark {
    to {
        transform: rotate(-45deg) scale(1);
    }
}

/* --- Custom radio --- */
.gift-modal__radio-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.gift-modal__radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.gift-modal__radio-visual {
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-dark-300);
    border-radius: 50%;
    background: var(--color-accent-50);
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gift-modal__radio:checked + .gift-modal__radio-visual {
    background: var(--color-accent-600);
    border-color: var(--color-dark-300);
}

.gift-modal__radio:checked + .gift-modal__radio-visual::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--color-text);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* --- Hint text --- */
.gift-modal__hint {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 17px;
    color: var(--color-dark-600);
}

/* --- Field (label + input + hint) --- */
.gift-modal__field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gift-modal__field-label {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 15px;
    color: var(--color-dark-600);
}

.gift-modal__field-hint {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 15px;
    color: var(--color-dark-500);
}

/* --- Input --- */
.gift-modal__input {
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 400;
    line-height: 18px;
    color: var(--color-text);
    background: var(--color-accent-50);
    border: 1px solid var(--color-accent-200);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.gift-modal__input::placeholder {
    color: var(--color-dark-400);
    transition: opacity 0.2s ease;
}

.gift-modal__input:focus::placeholder {
    opacity: 0.5;
}

.gift-modal__input:focus {
    border-color: var(--color-accent-300);
    box-shadow: 0 0 4px var(--color-accent-600);
}

.gift-modal__input--error {
    border-color: var(--color-red);
    box-shadow: 0 0 4px rgba(220, 81, 64, 0.15);
}

/* --- Payment section --- */
.gift-modal__payment-title {
    font-family: var(--font-family-serif);
    font-size: var(--font-size-lg);
    font-weight: 500;
    line-height: 24px;
    color: var(--color-text);
}

.gift-modal__payment-methods {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.gift-modal__payment-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.gift-modal__payment-name {
    flex: 1;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 18px;
    color: var(--color-text);
}

.gift-modal__payment-price {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--color-accent-50);
    border: 1px solid var(--color-dark-300);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    color: var(--color-text);
}

.gift-modal__payment-price svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- Error message --- */
.gift-modal__error {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 17px;
    text-align: center;
    color: var(--color-red);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.gift-modal__error--visible {
    max-height: 60px;
    opacity: 1;
}

/* --- Submit button --- */
.gift-modal__submit {
    width: 100%;
    padding: 18px 26px;
    font-size: var(--font-size-lg);
    font-weight: 500;
    line-height: 20px;
    gap: 10px;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.gift-modal__submit:active:not(:disabled) {
    transform: scale(0.98);
}

.gift-modal__submit svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.gift-modal__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading spinner — provided by dsb-modal-base.css (.dsb-modal__submit--loading) */

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Mobile bottom-sheet — base provided by dsb-modal-base.css */
@media (max-width: 768px) {
    .gift-modal__title {
        font-size: 24px;
        line-height: 32px;
    }

    .gift-modal__submit {
        padding: 15px 18px;
        font-size: var(--font-size-base);
    }

    .gift-modal__close {
        top: 16px;
        right: 16px;
    }
}
