/* npc.css - Стили для персонажей (NPC) */

.npc {
    position: absolute;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
    transition: transform 0.2s;
}

.npc:active {
    transform: scale(0.95);
}

.npc-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--tg-theme-button-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
    margin-bottom: 2px;
}

.npc-info {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 8px;
    border-radius: 10px;
    padding: 2px 6px;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.npc-name {
    font-weight: 500;
}

.npc-profession {
    font-size: 7px;
    opacity: 0.8;
}

/* Стили по профессиям */
.npc[data-profession="worker"] .npc-avatar {
    background-color: #8D6E63; /* коричневый */
}

.npc[data-profession="scientist"] .npc-avatar {
    background-color: #9C27B0; /* фиолетовый */
}

.npc[data-profession="engineer"] .npc-avatar {
    background-color: #2196F3; /* синий */
}

.npc[data-profession="soldier"] .npc-avatar {
    background-color: #F44336; /* красный */
}

.npc[data-profession="medic"] .npc-avatar {
    background-color: #E91E63; /* розовый */
}

.npc[data-profession="farmer"] .npc-avatar {
    background-color: #8BC34A; /* зеленый */
}

.npc[data-profession="teacher"] .npc-avatar {
    background-color: #FF9800; /* оранжевый */
}

.npc[data-profession="builder"] .npc-avatar {
    background-color: #607D8B; /* сине-серый */
}

/* Детали NPC в модальном окне */
.npc-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.npc-details-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.npc-details-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.npc-details-info h3 {
    margin-bottom: var(--spacing-xs);
}

.npc-details-profession {
    color: var(--tg-theme-hint-color);
}

.npc-details-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

.npc-stat {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--spacing-sm);
}

.npc-stat-label {
    font-size: 0.9em;
    color: var(--tg-theme-hint-color);
}

.npc-stat-value {
    font-weight: 500;
}

.npc-stat-bar {
    height: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin-top: 4px;
    overflow: hidden;
}

.npc-stat-bar-fill {
    height: 100%;
    border-radius: 4px;
}

.npc-stat-bar-fill[data-type="happiness"] {
    background-color: #FF9800;
}

.npc-stat-bar-fill[data-type="health"] {
    background-color: #4CAF50;
}

.npc-stat-bar-fill[data-type="energy"] {
    background-color: #2196F3;
}

.npc-stat-bar-fill[data-type="hunger"] {
    background-color: #F44336;
}

.npc-stat-bar-fill[data-type="thirst"] {
    background-color: #03A9F4;
}

.npc-details-traits {
    margin-bottom: var(--spacing-md);
}

.npc-details-traits h4 {
    margin-bottom: var(--spacing-sm);
}

.npc-trait {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm);
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius-sm);
}

.npc-trait-name {
    font-weight: 500;
    margin-right: var(--spacing-sm);
}

.npc-trait-description {
    font-size: 0.9em;
    color: var(--tg-theme-hint-color);
}

.npc-details-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Список населения */
.population-container {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
}

.npc-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.npc-list-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: transform 0.2s;
}

.npc-list-item:active {
    transform: scale(0.99);
}

.npc-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: var(--spacing-md);
}

.npc-list-info {
    flex: 1;
}

.npc-list-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.npc-list-profession {
    font-size: 0.9em;
    color: var(--tg-theme-hint-color);
}

.npc-list-stats {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.npc-list-stat {
    display: flex;
    align-items: center;
    font-size: 0.8em;
}

.npc-list-stat-icon {
    margin-right: 2px;
}

/* Фильтры населения */
.population-filters {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.population-filter {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--tg-theme-hint-color);
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    background-color: transparent;
    color: var(--tg-theme-text-color);
}

.population-filter.active {
    border-color: var(--tg-theme-button-color);
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

/* Адаптивность для больших экранов */
@media (min-width: 768px) {
    .npc-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .npc-list {
        grid-template-columns: repeat(3, 1fr);
    }
}