/*
 * Доступ по оплатам: кнопка «Почта» в блоке с именем, экран почты при первом
 * входе и окно «Почта». Логика — assets/js/payment-access.js.
 * Кнопка — в стиле переключателя темы в шапке, окна — как окно аватара.
 */

/* ========== КНОПКА «ПОЧТА» В БЛОКЕ С ИМЕНЕМ ========== */
.email-settings-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    background: rgba(139, 92, 246, 0.1);
    border: none;
    color: #8b5cf6;
    border-radius: 20px;
    padding: 0 14px;
    height: 32px;
    font-family: inherit;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.email-settings-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: scale(1.05);
}

.email-settings-btn:active {
    transform: scale(0.95);
}

.email-settings-btn[hidden] {
    display: none;
}

.dark-theme .email-settings-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #a78bfa;
}

/* ========== ОКНО ========== */
.pa-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px;
    animation: modalFadeIn 0.3s ease;
}

.pa-modal-content {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 24px;
    width: 400px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    color: #1e293b;
}

.dark-theme .pa-modal-content {
    background: rgba(30, 30, 46, 0.97);
    border-color: rgba(139, 92, 246, 0.2);
    color: #f1f5f9;
}

.pa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pa-title {
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 14px;
}

.pa-head .pa-title {
    margin-bottom: 8px;
}

.pa-x {
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 8px 8px;
}

.pa-text {
    font-size: 0.92em;
    line-height: 1.45;
    color: #475569;
    margin-bottom: 14px;
}

.dark-theme .pa-text {
    color: #cbd5e1;
}

.pa-email {
    font-size: 1.05em;
    font-weight: 600;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.08);
    margin-bottom: 12px;
    word-break: break-all;
}

.pa-label {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: #64748b;
    margin: 8px 0 4px;
}

.pa-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px; /* меньше 16px — iOS приближает экран при вводе */
    background: #fff;
    color: inherit;
    outline: none;
}

.pa-input:focus {
    border-color: #8b5cf6;
}

.pa-input[readonly] {
    background: rgba(139, 92, 246, 0.05);
    border-color: transparent;
}

.dark-theme .pa-input {
    background: rgba(255, 255, 255, 0.06);
}

.pa-msg {
    font-size: 0.88em;
    line-height: 1.4;
    min-height: 1.2em;
    margin: 10px 0 4px;
    color: #7c3aed;
}

.pa-msg a,
.pa-text a {
    color: #8b5cf6;
    font-weight: 600;
}

.pa-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.pa-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.08);
    color: #7c3aed;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
}

.pa-btn-main {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: transparent;
    color: #fff;
}

.pa-btn-quiet {
    background: none;
    border-color: transparent;
    color: #94a3b8;
}

.pa-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.dark-theme .pa-btn:not(.pa-btn-main):not(.pa-btn-quiet) {
    color: #c4b5fd;
}

.pa-note {
    font-size: 0.75em;
    line-height: 1.4;
    color: #94a3b8;
    text-align: center;
    margin-top: 14px;
}

/* ========== ВСПЛЫВАЮЩЕЕ СООБЩЕНИЕ ========== */
.pa-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1100;
    background: #1e293b;
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.9em;
    max-width: calc(100% - 32px);
    text-align: center;
    animation: modalFadeIn 0.3s ease;
}

/* Длинное имя не должно уезжать под кнопку */
.user-card:has(.email-settings-btn:not([hidden])) .user-info {
    padding-right: 64px;
}
