/* Entity Detail Page - Премиальный дизайн */
.entity-page {
    padding: var(--spacing-xl) 0;
    min-height: calc(100vh - 200px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.entity-page .container {
    width: 100%;
    max-width: 100%;
    padding: 0 var(--spacing-md);
    box-sizing: border-box;
}

.entity-profile {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 720px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

.entity-profile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover), #7c3aed);
    background-size: 200% 100%;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.entity-profile-header {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.entity-menu-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 20;
}

.entity-menu-toggle {
    background: var(--bg-elevated);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    position: relative;
    z-index: 10;
}

.entity-menu-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: scale(1.1);
}

.menu-dots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.menu-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    display: block;
    transition: all 0.3s ease;
}

[data-theme="dark"] .menu-dots span {
    background: var(--accent);
}

.entity-menu-toggle:hover .menu-dots span {
    background: var(--accent-hover);
    transform: scale(1.2);
}

.entity-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-elevated);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    overflow: hidden;
}

[data-theme="dark"] .entity-menu-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.entity-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    width: 100%;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-light);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.menu-item.report-trigger[data-reason="spam"]:hover {
    background: #fef3c7;
    color: #92400e;
}

.menu-item.report-trigger[data-reason="scam"]:hover {
    background: #fee2e2;
    color: #991b1b;
}

.menu-item.report-trigger[data-reason="inappropriate"]:hover {
    background: #fecaca;
    color: #7f1d1d;
}

.menu-item.report-trigger[data-reason="copyright"]:hover {
    background: #ede9fe;
    color: #5b21b6;
}

.menu-item.report-trigger[data-reason="other"]:hover {
    background: var(--accent-light);
    color: var(--accent);
}

[data-theme="dark"] .menu-item.report-trigger[data-reason="spam"]:hover {
    background: #1c2128;
    color: #fbbf24;
}

[data-theme="dark"] .menu-item.report-trigger[data-reason="scam"]:hover {
    background: #1c2128;
    color: #f87171;
}

[data-theme="dark"] .menu-item.report-trigger[data-reason="inappropriate"]:hover {
    background: #1c2128;
    color: #fca5a5;
}

[data-theme="dark"] .menu-item.report-trigger[data-reason="copyright"]:hover {
    background: #1c2128;
    color: #a78bfa;
}

[data-theme="dark"] .menu-item.report-trigger[data-reason="other"]:hover {
    background: var(--type-bot-light);
    color: var(--accent);
}

.menu-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.entity-avatar-large {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent);
    box-shadow: 0 4px 12px rgba(9, 105, 218, 0.15);
    position: relative;
    transition: all 0.2s ease;
}

[data-theme="dark"] .entity-avatar-large {
    box-shadow: 0 8px 24px rgba(167, 139, 250, 0.3);
}

.entity-profile-header:hover .entity-avatar-large {
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(9, 105, 218, 0.3);
}

.entity-profile-header:hover .entity-avatar-large {
    transform: scale(1.05) rotate(2deg);
}

[data-theme="dark"] .entity-profile-header:hover .entity-avatar-large {
    box-shadow: 0 12px 32px rgba(167, 139, 250, 0.4);
}

.entity-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.entity-avatar-fallback {
    font-size: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.entity-profile-info {
    flex: 1;
    min-width: 0;
}

.entity-profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.entity-profile-meta {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.entity-type-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entity-username {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.entity-rating-display {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.rating-stars-large {
    display: flex;
    gap: 0.25rem;
    font-size: 1.5rem;
}

.star {
    display: inline-block;
    filter: grayscale(1) opacity(0.3);
    transition: filter 0.2s;
}

.star-full {
    filter: none;
}

.star-half {
    filter: grayscale(0.5) opacity(0.7);
}

.rating-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.rating-count {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.entity-description-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.entity-description-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.entity-description-text {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.entity-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.0625rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: all 0.3s ease;
}

.btn-large:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.entity-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.stat-item {
    text-align: center;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    min-width: 0;
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(9, 105, 218, 0.15);
    border-color: var(--accent);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    display: block;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entity-categories-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border-light);
}

.entity-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.entity-category-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.entity-category-tag:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(9, 105, 218, 0.15);
}

[data-theme="dark"] .entity-category-tag:hover {
    background: var(--type-bot-light);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(167, 139, 250, 0.2);
}


.rating-section {
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.rating-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.rating-stars-selector {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-bottom: var(--spacing-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.rating-star-btn {
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    min-width: 48px;
    touch-action: manipulation;
}

.rating-star-btn:hover,
.rating-star-btn.hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
    transform: scale(1.1);
}

.rating-star-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.star-icon {
    font-size: 1.75rem;
    line-height: 1;
    color: inherit;
    display: block;
}

.rating-hint {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: var(--spacing-sm);
}

.error-message {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--danger);
    font-size: 1.125rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #cf222e;
    border-color: #cf222e;
}

@media (max-width: 768px) {
    /* Троеточие строго внутри карточки, не на границе */
    .entity-profile {
        padding: 3.25rem 1rem var(--spacing-lg) 1rem;
        margin: 0;
    }
    
    .entity-menu-container {
        top: 1rem;
        right: 1rem;
    }
    
    .entity-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .entity-avatar-large {
        margin: 0 auto;
        width: 100px;
        height: 100px;
    }
    
    .entity-avatar-fallback {
        font-size: 2.75rem;
    }
    
    .entity-profile-name {
        font-size: 1.35rem;
    }
    
    .entity-actions {
        flex-direction: column;
    }
    
    .btn-large {
        width: 100%;
        justify-content: center;
    }
    
    /* Статистика: три колонки влезают, не уезжают вправо */
    .entity-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--spacing-sm);
        padding: var(--spacing-md);
        margin: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .stat-item {
        padding: var(--spacing-xs);
        min-width: 0;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    /* Звездочки ★ — всегда видны, работают на тач */
    .rating-stars-selector {
        gap: 0.5rem;
        flex-wrap: nowrap;
        justify-content: center;
        padding: var(--spacing-sm) 0;
        width: 100%;
    }
    
    .rating-star-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        padding: 0.5rem;
    }
    
    .rating-star-btn .star-icon {
        font-size: 1.5rem;
    }
    
    .rating-section {
        padding-top: var(--spacing-lg);
    }
    
    .rating-section h2 {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .rating-hint {
        font-size: 0.8125rem;
        text-align: center;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .entity-page .container {
        padding: 0 var(--spacing-sm);
    }
    
    .entity-profile {
        padding: 3rem 0.75rem var(--spacing-md) 0.75rem;
    }
    
    .entity-menu-container {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .entity-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--spacing-xs);
        padding: var(--spacing-sm);
        width: 100%;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .rating-star-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
    
    .rating-star-btn .star-icon {
        font-size: 1.35rem;
    }
    
    .rating-stars-selector {
        gap: 0.35rem;
    }
}
