/* ==========================================================================
   Component: Auth Modal
   Login, Registration, Password Reset — overlay modal
   ========================================================================== */

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

/* --- Navigation (close button row) --- */
.auth-modal__nav {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

/* --- Screens container --- */
.auth-modal__screens {
    position: relative;
    overflow: hidden;
    transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Screens --- */
.auth-modal__screen {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform: translateY(12px);
    transition: opacity 0.3s ease,
                transform 0.3s ease,
                visibility 0.3s ease;
    pointer-events: none;
}

.auth-modal__screen--active {
    opacity: 1;
    visibility: visible;
    position: relative;
    transform: translateY(0);
}

.dsb-modal--open .auth-modal__screen--active {
    pointer-events: auto;
}

/* --- Body --- */
.auth-modal__body {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* --- Tabs --- */
.auth-modal__tabs {
    display: flex;
    border-bottom: 1px solid var(--color-accent-200);
    position: relative;
}

.auth-modal__tab {
    flex: 1;
    padding-bottom: 12px;
    font-family: var(--font-family);
    font-size: var(--font-size-lg);
    font-weight: 500;
    line-height: 20px;
    color: var(--color-dark-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: color 0.25s ease, border-color 0.25s ease;
    margin-bottom: -1px;
}

.auth-modal__tab:hover {
    color: var(--color-text);
}

.auth-modal__tab--active {
    color: var(--color-text);
    border-bottom-color: var(--color-text);
}

/* --- Form --- */
.auth-modal__form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Fields --- */
.auth-modal__fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-modal__field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

/* --- Input wrap --- */
.auth-modal__input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 14px 16px;
    background: var(--color-accent-50);
    border: 1px solid var(--color-accent-200);
    border-radius: var(--radius-btn);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.auth-modal__input-wrap:focus-within {
    border-color: var(--color-dark-400);
    box-shadow: 0 0 0 3px rgba(134, 135, 136, 0.1);
}

.auth-modal__input-wrap--error {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(220, 81, 64, 0.1);
}

/* --- Input --- */
.auth-modal__input {
    flex: 1;
    min-width: 0;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 400;
    line-height: 18px;
    color: var(--color-text);
    background: transparent;
    border: none;
    outline: none;
}

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

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

/* --- Password toggle --- */
.auth-modal__toggle-pw {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-dark-400);
    padding: 0;
    transition: color 0.2s ease;
}

.auth-modal__toggle-pw:hover {
    color: var(--color-text);
}

.auth-modal__eye-closed {
    display: none;
}

/* --- Hint --- */
.auth-modal__hint {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 15px;
    color: var(--color-dark-500);
}

/* --- Checkbox --- */
.auth-modal__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

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

.auth-modal__checkbox-box {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
    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;
}

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

.auth-modal__checkbox-input:checked + .auth-modal__checkbox-box::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: auth-checkmark 0.2s ease 0.05s forwards;
}

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

.auth-modal__checkbox-label {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 18px;
    color: var(--color-dark-500);
}

/* --- Actions --- */
.auth-modal__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

/* --- Submit button --- */
.auth-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;
}

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

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

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

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

/* --- Links --- */
.auth-modal__links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.auth-modal__link {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 18px;
    color: var(--color-text);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s ease;
}

.auth-modal__link:hover {
    opacity: 0.7;
}

/* --- Legal --- */
.auth-modal__legal {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 17px;
    color: var(--color-dark-400);
    text-align: center;
}

.auth-modal__legal a {
    text-decoration: underline;
    color: var(--color-dark-400);
    transition: opacity 0.2s ease;
}

.auth-modal__legal a:hover {
    opacity: 0.7;
}

/* --- Heading (reset screen) --- */
.auth-modal__heading {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-modal__title {
    font-family: var(--font-family-serif);
    font-size: 28px;
    font-weight: 500;
    line-height: 40px;
    color: var(--color-text);
}

.auth-modal__subtitle {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 20px;
    color: var(--color-dark-500);
}

/* --- Error / Success --- */
.auth-modal__error,
.auth-modal__success {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 17px;
    text-align: center;
    display: none;
}

.auth-modal__error--visible {
    display: block;
    color: var(--color-red);
}

.auth-modal__success--visible {
    display: block;
    color: var(--color-success);
}

/* --- OTP-экран --- */
.auth-modal__otp-step--hidden {
    display: none;
}

.auth-modal__input-wrap--otp {
    justify-content: center;
}

.auth-modal__input--otp {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 8px;
    padding: 4px 0;
}

.auth-modal__input--otp::placeholder {
    letter-spacing: 8px;
    color: var(--color-dark-300);
}

.auth-modal__otp-timer {
    color: var(--color-dark-400);
    font-size: var(--font-size-xs);
    margin-left: 4px;
}

#auth-otp-resend:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: none;
}

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

/* Mobile bottom-sheet — base provided by dsb-modal-base.css */
@media (max-width: 768px) {
    .auth-modal__nav {
        margin-bottom: 12px;
    }

    .auth-modal__body {
        gap: 24px;
    }

    .auth-modal__tab {
        font-size: 15px;
        padding-bottom: 10px;
    }

    .auth-modal__submit {
        padding: 15px 18px;
        font-size: 15px;
    }

    .auth-modal__title {
        font-size: 22px;
        line-height: 26px;
    }
}
