﻿/* ========================================= */
/* 👤 USER PROFILE & SETTINGS MODULE         */
/* ========================================= */

/* --- Сетка выбора аватара (Эмодзи) --- */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.avatar-option {
    aspect-ratio: 1/1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
    background: var(--surface);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .avatar-option:hover {
        background: var(--hover);
    }

    .avatar-option.selected {
        border-color: var(--primary);
        background: var(--hover);
        transform: scale(1.1);
        box-shadow: 0 0 10px rgba(145, 71, 255, 0.4);
    }

/* --- Настройки: Выбор цвета темы --- */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.color-option {
    aspect-ratio: 1/1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

    .color-option.selected {
        border-color: var(--text);
        transform: scale(1.1);
        box-shadow: 0 0 10px rgba(255,255,255,0.3);
    }

/* --- Настройки: Ползунки прозрачности --- */
.opacity-slider-container {
    margin: 15px 0;
}

    .opacity-slider-container label {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

.opacity-value {
    font-size: 12px;
    color: var(--text-sec);
    min-width: 40px;
    text-align: right;
}

/* --- Исправленные стили для profile.css --- */

/* Блок уведомлений */
.tg-instruction {
    font-size: 12px;
    color: var(--text-sec);
    margin-bottom: 15px;
    line-height: 1.4;
}

/* Состояние: Подключено (Зеленая рамка) */
.tg-connected {
    background: rgba(0, 230, 118, 0.04);
    border: 1px solid rgba(0, 230, 118, 0.14);
    padding: 9px 10px;
    border-radius: 10px;
    display: flex; /* Раньше был !important, теперь просто flex */
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

/* Кнопки под аватаркой */
.btn-small {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

    .btn-small:active {
        transform: scale(0.95);
    }

/* --- Обновлённый профиль: структура и UX --- */
.profile-card {
    padding-top: 25px;
    padding-bottom: 25px;
}

.profile-top-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 25px;
}

.profile-avatar-col {
    display: flex;
    flex-direction: column;
    width: 90px;
    flex-shrink: 0;
}

.profile-current-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--hover);
    background-size: cover;
    background-position: center;
    border: 2px solid var(--primary);
    margin-bottom: 12px;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-avatar-btn {
    width: 100%;
    font-size: 10px;
    min-height: var(--control-sm);
    padding: 6px 10px;
    border-radius: var(--radius-md);
}

.profile-about-wrapper {
    margin-top: 14px;
    padding: 12px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 14px;
}

.profile-about-input {
    min-height: 110px;
    margin-bottom: 0;
    resize: vertical;
    font-size: 13px;
    line-height: 1.45;
}

.profile-main-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 5px;
}

.profile-label {
    font-size: 11px;
    color: var(--text-sec);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.profile-nickname-input {
    margin-bottom: 0;
    font-weight: bold;
    font-size: 16px;
    padding: 12px;
    border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.profile-nickname-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(145, 71, 255, 0.15);
}

.profile-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    gap: 8px;
}

.profile-hint {
    font-size: 10px;
    color: var(--text-sec);
    line-height: 1.2;
}

.profile-counter {
    font-size: 10px;
    color: var(--text-sec);
    white-space: nowrap;
}

.profile-counter.warn {
    color: var(--warning);
}

.profile-input-error {
    font-size: 11px;
    color: var(--error);
    margin-top: 8px;
}

.profile-main-actions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-personalization-btn {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    position: relative;
}

.profile-plan-scope-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 800;
    color: var(--primary);
    background: rgba(145, 71, 255, 0.12);
    border: 1px solid rgba(145, 71, 255, 0.2);
    border-radius: 999px;
    padding: 4px 8px;
    line-height: 1;
}

.plan-personalization-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow-y: auto;
    padding-right: 2px;
}

.plan-personalization-option {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(145, 71, 255, 0.08) 0%, rgba(145, 71, 255, 0.02) 100%);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-personalization-option:active {
    transform: scale(0.99);
}

.plan-personalization-option.is-selected {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(145, 71, 255, 0.12);
}

.plan-personalization-option__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(145, 71, 255, 0.14);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.plan-personalization-option__content {
    min-width: 0;
    flex: 1;
}

.plan-personalization-option__eyebrow {
    font-size: 10px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 800;
    margin-bottom: 4px;
}

.plan-personalization-option__title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.plan-personalization-option__desc {
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-sec);
}

.plan-personalization-option__radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    margin-left: auto;
    flex-shrink: 0;
    position: relative;
    margin-top: 2px;
}

.plan-personalization-option.is-selected .plan-personalization-option__radio {
    border-color: var(--primary);
}

.plan-personalization-option.is-selected .plan-personalization-option__radio::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--primary);
}

.profile-records-btn {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    min-height: 40px;
}

.profile-telegram-card {
    background: var(--bg);
    padding: 15px;
    border-radius: 16px;
    border: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.profile-telegram-card-compact {
    padding: 9px 10px;
    border-radius: 12px;
}

.profile-telegram-inline {
    width: 100%;
}

.profile-telegram-title {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.profile-telegram-hint {
    margin: 0 0 6px 0;
    font-size: 10px;
    line-height: 1.25;
}

.profile-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #9146FF 0%, #d500f9 100%);
    width: 100%;
    min-height: var(--control-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    padding: var(--space-3) var(--space-4);
    font-weight: bold;
    letter-spacing: 0.5px;
    line-height: 1.2;
    box-sizing: border-box;
}

.profile-connect-btn-compact {
    min-height: 32px;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    font-size: 11px;
}

.profile-telegram-note {
    font-size: 9px;
    color: var(--text-sec);
    text-align: center;
    margin-top: 4px;
    opacity: 0.68;
    line-height: 1.15;
}

.profile-tg-actions {
    margin-top: 6px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.profile-tg-connected {
    margin-top: 0;
    width: 100%;
    box-sizing: border-box;
}

.profile-tg-connected-title {
    font-weight: 700;
    font-size: 11px;
    color: var(--text);
}

.profile-tg-connected-subtitle {
    font-size: 9px;
    color: var(--text-sec);
    line-height: 1.1;
    margin-top: 1px;
}

.profile-link-btn {
    font-size: 10px;
    text-decoration: underline;
    cursor: pointer;
    color: var(--primary);
    opacity: 0.9;
    background: none;
    border: none;
    padding: 0;
}

.profile-link-btn.danger {
    color: var(--error);
}

.profile-save-wrap {
    margin-top: 14px;
}

.profile-save-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-save-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

.profile-save-hint {
    margin-top: 7px;
    text-align: center;
    font-size: 10px;
    color: var(--text-sec);
}

/* --- Единый блок настроек на экране профиля --- */
.profile-settings-section {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.profile-settings-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.profile-settings-title {
    font-size: 16px;
    font-weight: 800;
}

.profile-settings-subtitle {
    font-size: 11px;
    color: var(--text-sec);
    margin-top: 3px;
}

.profile-sync-box {
    background: rgba(145, 71, 255, 0.06);
    border: 1px solid rgba(145, 71, 255, 0.25);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
}

.profile-sync-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-sync-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.profile-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.profile-setting-row > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.profile-setting-row > span small {
    font-size: 10px;
    color: var(--text-sec);
}

.profile-setting-block {
    margin-top: 12px;
}

.profile-setting-block-compact {
    margin-top: 8px;
}

.profile-sound-actions-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
    align-items: stretch;
}

.profile-sound-action-btn {
    width: 100%;
    min-height: var(--control-sm);
    min-width: 0;
    white-space: nowrap;
    padding: 7px 8px;
    font-size: 10px;
    gap: 4px;
    border-radius: var(--radius-md);
    line-height: 1.2;
}

.profile-setting-block label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.profile-setting-block-compact label {
    margin-bottom: 4px;
}

.profile-sliders-group {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}

#profile-settings-section input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 20px;
    margin: 2px 0 8px 0;
    background: transparent;
    border: none;
    padding: 0;
}

#profile-settings-section input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(145, 71, 255, 0.55), rgba(145, 71, 255, 0.2));
    border: 1px solid var(--border-strong);
}

#profile-settings-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

#profile-settings-section input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(145, 71, 255, 0.55), rgba(145, 71, 255, 0.2));
    border: 1px solid var(--border-strong);
}

#profile-settings-section input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.profile-inline-selects {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    margin-top: 10px;
}

.profile-inline-selects .profile-setting-block {
    margin-top: 0;
}

.profile-inline-selects select,
.profile-inline-selects .settings-select-styled {
    margin-bottom: 0;
}

.profile-color-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
    align-items: stretch;
}

.profile-color-row > div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-color-row input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

@media (max-width: 420px) {
    .profile-color-row {
        grid-template-columns: 1fr;
    }
}

.profile-theme-presets {
    margin-top: 14px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.profile-presets-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sec);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.profile-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.profile-color-row-compact {
    margin-top: 8px;
}

@media (max-width: 420px) {
    .profile-preset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-inline-selects {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .profile-sound-actions-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .profile-sound-action-btn {
        font-size: 9px;
        padding: 7px 6px;
    }
}