/* =========================================
   PROFILE V2 (PREMIUM LOOK)
   ========================================= */

.profile-v2-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
}

@media (max-width: 900px) {
    .profile-v2-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Левая колонка (Скин + Соцсети) */
.profile-left-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skin-render-container {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-card-v2 {
    background: var(--card-bg);
    border: 1px solid var(--border-highlight);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 480px;
}

.skin-render-v2 {
    max-width: 200px;
    max-height: 350px;
    filter: drop_shadow(0 10px 20px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
    object-fit: contain;
}

.skin-render-v2:hover {
    transform: translateY(-5px) scale(1.05);
}

.custom-skin-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-skin-v2 {
    image-rendering: pixelated;
    transition: transform 0.3s ease;
}

.head-preview-v2 {
    position: absolute;
    bottom: 25px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid var(--border-highlight);
    background: var(--hover-bg);
    padding: 2px;
}

/* Соцсети в стиле Discord */
.social-grid-v2 {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.social-card-v2 {
    background: var(--card-bg);
    border: 1px solid var(--border-highlight);
    border-radius: 16px;
    padding: 0 20px;
    /* Убираем вертикальный padding, используем min-height */
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    overflow: visible;
    box-sizing: border-box;
}

.social-card-v2:hover {
    background: var(--hover-bg);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.social-card-v2 svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.8;
}

.social-card-v2.twitch:hover {
    border-color: #9146ff;
    color: #9146ff;
}

.social-card-v2.youtube:hover {
    border-color: #ff0000;
    color: #ff0000;
}

.social-card-v2.telegram:hover {
    border-color: #0088cc;
    color: #0088cc;
}

.social-card-v2.discord:hover {
    border-color: #5865f2;
    color: #5865f2;
}

.social-username {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

/* Удаляем старый стиль Discord */
.discord-card-v2 {
    display: none;
}

/* Кнопка настроек */
.edit-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-highlight);
    color: var(--text-muted);
    transition: all 0.2s ease;
    cursor: pointer;
}

.edit-profile-btn:hover {
    color: white;
    background: rgba(22, 23, 29, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
}

/* Правая колонка */
.profile-right-col {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.profile-header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ph-username-group h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: var(--text-main);
}

.ph-last-seen {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.ph-last-seen.is-online {
    color: #10b981;
    /* Green color */
    font-weight: 600;
}

.role-badge-v2 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a1a1aa;
}

/* Кнопки лайков / дизлайков */
.votes-group-v2 {
    display: flex;
    gap: 10px;
}

.vote-btn-v2 {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-highlight);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

.vote-btn-v2:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.vote-btn-v2.voted-like {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.vote-btn-v2 svg {
    transition: transform 0.2s;
}

.vote-btn-v2:hover svg {
    transform: scale(1.2);
}

.like-btn:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.dislike-btn:hover {
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
}

.heatmap-legend-v2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
}


/* Секция статистики */
.section-v2 {
    margin-top: 10px;
}

.section-v2-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
}

.stats-row-v2 {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.stat-item-v2 {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.stat-item-v2 span {
    color: var(--text-main);
    font-weight: 700;
}

/* Тепловая карта (Custom 3-row Style) - Статичная */
.heatmap-v2 {
    display: grid;
    grid-template-rows: repeat(3, 28px);
    grid-auto-flow: column;
    grid-auto-columns: 28px;
    gap: 10px;
    background: transparent;
    padding: 15px;
    /* Запас для масштабирования при наведении */
    overflow: visible;
    /* Разрешаем выходить за границы для наведения */
    width: fit-content;
    margin: 5px -15px;
    /* Компенсируем padding для выравнивания */
    max-width: 100%;
}

.heatmap-v2::-webkit-scrollbar {
    display: none;
}

.heatmap-cell-v2 {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--hover-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: help;
    transition: transform 0.2s ease, background 0.2s ease;
}

.heatmap-cell-v2:hover {
    transform: scale(1.3);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.heatmap-cell-v2.level-1 {
    background: #0e4429;
}

.heatmap-cell-v2.level-2 {
    background: #006d32;
}

.heatmap-cell-v2.level-3 {
    background: #26a641;
}

.heatmap-cell-v2.level-4 {
    background: #39d353;
}

/* Tooltip Styles */
.heatmap-tooltip {
    position: absolute;
    background: rgba(22, 23, 29, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    transform: translate(-50%, -100%) translateY(-10px);
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.heatmap-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.tooltip-hours {
    font-size: 13px;
    font-weight: 700;
    color: #4ade80;
}

/* Карточка города */
.town-card-v2 {
    background: var(--card-bg);
    border: 1px solid var(--border-highlight);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    text-decoration: none;
    transition: 0.2s;
}

.town-card-v2:hover {
    transform: translateY(-3px);
    border-color: rgba(59, 130, 246, 0.3);
}

.town-banner-v2 {
    width: 80px;
    height: 120px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-highlight);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.town-img-v2 {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.town-placeholder-v2 {
    font-size: 2.2rem;
    opacity: 0.5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.town-content-v2 {
    flex: 1;
}

.town-name-v2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.town-desc-v2 {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 12px;
}

.town-meta-v2 {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.town-meta-v2 li {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =========================================
   PROFILE WALL (VK-STYLE)
   ========================================= */

.wall-section {
    margin-top: 40px;
    border-top: 1px solid var(--border-highlight);
    padding-top: 40px;
}

.wall-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.wall-post-form {
    background: var(--card-bg);
    border: 1px solid var(--border-highlight);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    transition: border-color 0.3s ease;
}

.wall-post-form:focus-within {
    border-color: rgba(59, 130, 246, 0.4);
}

.wall-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    resize: none;
    min-height: 80px;
    outline: none;
    font-family: inherit;
    margin-bottom: 5px;
    /* Уменьшил отступ */
}

.wall-form-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    /* Чуть уменьшил */
    border-top: 1px solid var(--border-color);
}


.wall-submit-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 8px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
}

.wall-submit-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}


.post-item {
    background: var(--card-bg);
    border: 1px solid var(--border-highlight);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    position: relative;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-author-avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--hover-bg);
    flex-shrink: 0;
}

.post-content-container {
    flex: 1;
    min-width: 0;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.post-author-name {
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
}

.post-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 15px;
}

.post-footer {
    display: flex;
    gap: 15px;
}

.post-action {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 12px;
    border-radius: 100px;
}

.post-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.post-action.liked {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.post-action.disliked {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.post-delete-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: 0;
    transition: 0.2s;
    color: var(--text-muted);
    text-decoration: none;
    background: rgba(22, 23, 29, 0.8);
    backdrop-filter: blur(4px);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-highlight);
    z-index: 5;
}

.post-item:hover .post-delete-btn {
    opacity: 1;
}



/* Адаптация под мобильные устройства */
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    .container {
        padding: 0 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .profile-v2-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding: 15px 16px !important;
        /* Added 16px side padding for margins */
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .profile-left-col,
    .profile-right-col {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .skin-card-v2 {
        min-height: auto !important;
        padding: 25px 20px !important;
        margin: 0 !important;
        border-radius: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .profile-header-v2 {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 15px !important;
        padding: 0 !important;
    }

    .ph-username-group {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .social-grid-v2 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        margin-top: 15px !important;
    }

    .social-card-v2 {
        width: 100% !important;
        margin: 0 !important;
        min-height: 52px !important;
        padding: 0 16px !important;
        justify-content: center !important;
    }

    /* Target the parent div of h1 and settings btn */
    .ph-username-group>div {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .ph-username-group h1 {
        font-size: 1.6rem !important;
        margin: 0 !important;
        word-break: break-all !important;
        text-align: left !important;
    }

    .role-badge-v2 {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: fit-content !important;
        max-width: fit-content !important;
        margin: 10px auto !important;
        padding: 5px 14px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border-radius: 20px !important;
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        color: var(--text-muted) !important;
        white-space: nowrap !important;
        flex: none !important;
    }

    .edit-profile-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        margin: 0 !important;
    }

    .edit-profile-btn svg {
        width: 22px !important;
        height: 22px !important;
    }

    .stats-row-v2 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .heatmap-v2 {
        width: 100% !important;
        padding: 10px 0 !important;
        overflow-x: auto !important;
        display: grid !important;
        grid-template-rows: repeat(3, 22px) !important;
        grid-auto-columns: 22px !important;
        grid-auto-flow: column !important;
        gap: 10px !important;
        background: transparent !important;
        border-radius: 0 !important;
        margin: 5px 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .heatmap-v2::-webkit-scrollbar {
        height: 4px !important;
        display: block !important;
    }

    .town-card-v2 {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 16px !important;
        width: 100% !important;
        gap: 15px !important;
        box-sizing: border-box !important;
        text-align: left !important;
    }

    .town-banner-v2 {
        width: 80px !important;
        height: 110px !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    .town-content-v2 {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .town-name-v2 {
        font-size: 1.1rem !important;
    }

    .town-meta-v2 {
        justify-content: flex-start !important;
        gap: 8px !important;
        font-size: 0.8rem !important;
    }

    .social-card-v2 {
        width: 100% !important;
        min-height: 56px !important;
        justify-content: center !important;
    }

    .post-item {
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex-direction: row !important;
        gap: 12px !important;
    }

    .post-author-avatar {
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
    }

    .post-header {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
}

.post-delete-btn:hover {
    color: #ef4444;
}

/* =========================================
   COMMENTS SECTION
   ========================================= */

.comments-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--hover-bg);
    object-fit: contain;
}

.comment-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.comment-author {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    text-decoration: none;
    margin-right: 8px;
}

.comment-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.comment-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-highlight);
    border-radius: 10px;
    padding: 8px 15px;
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: 0.2s;
}

.comment-input:focus {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(0, 0, 0, 0.3);
}

.comment-submit-btn {
    background: transparent;
    border: 1px solid var(--border-highlight);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.comment-submit-btn:hover {
    color: white;
    background: #3b82f6;
    border-color: #3b82f6;
}

.comment-delete-link {
    font-size: 0.75rem;
    color: #ef4444;
    text-decoration: none;
    margin-left: 10px;
    opacity: 0;
    transition: 0.2s;
}

.comment-item:hover .comment-delete-link {
    opacity: 0.6;
}

.comment-delete-link:hover {
    opacity: 1;
}