/* ===================================
   СТИЛИ ДЛЯ РАТУШИ, СКЛАДА И УЛУЧШЕНИЙ
   town_hall.css
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');

/* Оверлей модального окна */
.town-hall-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.97);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Основной контейнер ратуши */
.town-hall-container {
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    background: linear-gradient(180deg, 
        #1e1e24 0%, 
        #252530 30%,
        #1a1a20 60%,
        #15151a 100%
    );
    border-radius: 12px;
    box-shadow: 
        0 0 60px rgba(80, 20, 20, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid #3a2020;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s ease;
    position: relative;
}

@keyframes slideUp {
    from { 
        transform: translateY(50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Заголовок */
.town-hall-header {
    background: linear-gradient(180deg, #251515 0%, #1a0f0f 100%);
    padding: 24px 30px;
    border-bottom: 1px solid #3a2525;
    position: relative;
    z-index: 10;
}

.town-hall-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        #d4a84a 20%,
        #d4a84a 80%,
        transparent 100%
    );
}

.town-hall-title {
    font-family: 'Roboto', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #d4a84a;
    text-align: center;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(212, 168, 74, 0.3);
    margin: 0;
}

/* Кнопка закрытия */
.town-hall-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(30, 25, 20, 0.6);
    border: 1px solid #352525;
    border-radius: 50%;
    color: #808080;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
}

.town-hall-close-btn:hover {
    background: rgba(50, 40, 30, 0.8);
    color: #b0b0b0;
    transform: rotate(90deg);
}

/* Контент */
.town-hall-content {
    padding: 25px 30px;
    overflow-y: auto;
    flex: 1;
}

.town-hall-content::-webkit-scrollbar {
    width: 8px;
}

.town-hall-content::-webkit-scrollbar-track {
    background: rgba(20, 15, 10, 0.3);
    border-radius: 4px;
}

.town-hall-content::-webkit-scrollbar-thumb {
    background: rgba(80, 70, 30, 0.5);
    border-radius: 4px;
}

.town-hall-content::-webkit-scrollbar-thumb:hover {
    background: rgba(80, 70, 30, 0.7);
}

/* Секции */
.town-hall-section {
    margin-bottom: 30px;
}

.town-hall-section-title {
    font-family: 'Roboto', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #d0a080;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #3a2515;
}

/* ===================================
   СКЛАД
   =================================== */

.warehouse-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.warehouse-type-section {
    background: rgba(30, 20, 15, 0.5);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #2a1a10;
}

.warehouse-type-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0c060;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a1a10;
}

.warehouse-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.warehouse-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, 
        rgba(30, 20, 15, 0.8) 0%,
        rgba(40, 25, 18, 0.8) 100%
    );
    border: 1px solid #2a1a10;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.warehouse-item:hover {
    transform: translateY(-2px);
    border-color: #4a3020;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.4);
}

.warehouse-item-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.warehouse-item-info {
    flex: 1;
    min-width: 0;
}

.warehouse-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #d0a080;
    margin-bottom: 4px;
}

.warehouse-item-quantity {
    font-size: 16px;
    font-weight: 700;
    color: #d4a84a;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.empty-warehouse {
    text-align: center;
    padding: 40px 20px;
    color: #808080;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
}

/* ===================================
   УЛУЧШЕНИЯ РАТУШИ
   =================================== */

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Карточка улучшения */
.upgrade-card {
    background: linear-gradient(135deg, 
        rgba(30, 20, 15, 0.8) 0%,
        rgba(40, 25, 18, 0.8) 100%
    );
    border: 2px solid #4a3020;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.upgrade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%,
        #d4a84a 50%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upgrade-card:not(.completed):not(.disabled):hover {
    transform: translateY(-4px);
    border-color: #6a4a30;
    box-shadow: 0 8px 24px rgba(139, 69, 19, 0.4);
}

.upgrade-card:not(.completed):not(.disabled):hover::before {
    opacity: 1;
}

/* Завершенное улучшение */
.upgrade-card.completed {
    background: linear-gradient(135deg, 
        rgba(20, 40, 20, 0.9) 0%,
        rgba(25, 50, 25, 0.9) 100%
    );
    border-color: #4a7a4a;
}

.upgrade-card.completed::before {
    background: linear-gradient(90deg, 
        transparent 0%,
        #4CAF50 50%,
        transparent 100%
    );
    opacity: 1;
}

/* Недоступное улучшение */
.upgrade-card.disabled {
    opacity: 0.6;
    background: linear-gradient(135deg, 
        rgba(30, 20, 15, 0.5) 0%,
        rgba(40, 25, 18, 0.5) 100%
    );
    border-color: #3a2020;
}

/* Название улучшения */
.upgrade-name {
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #d4a84a;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.upgrade-card.completed .upgrade-name {
    color: #4CAF50;
}

/* Описание */
.upgrade-description {
    font-size: 13px;
    color: #b0b0b0;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(20, 15, 10, 0.5);
    border-radius: 6px;
    border-left: 3px solid #5a3a20;
    line-height: 1.5;
    font-family: 'Roboto', sans-serif;
}

.upgrade-card.completed .upgrade-description {
    border-left-color: #4CAF50;
}

/* Секция ресурсов */
.upgrade-resources {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(20, 15, 10, 0.6);
    border-radius: 8px;
    border: 1px solid #3a2515;
}

.resources-title {
    font-size: 12px;
    font-weight: 600;
    color: #d0a080;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resources-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(30, 20, 15, 0.5);
    border-radius: 6px;
    border: 1px solid #2a1a10;
    transition: all 0.2s ease;
}

.resource-item.sufficient {
    border-color: #4a7a4a;
    background: rgba(20, 40, 20, 0.3);
}

.resource-item.insufficient {
    border-color: #7a4a4a;
    background: rgba(60, 20, 20, 0.3);
}

.resource-icon {
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resource-name {
    flex: 1;
    font-size: 13px;
    color: #c0c0c0;
    font-weight: 500;
}

.resource-quantity {
    font-size: 13px;
    font-weight: 700;
    color: #d4a84a;
}

.resource-item.sufficient .resource-quantity {
    color: #4CAF50;
}

.resource-item.insufficient .resource-quantity {
    color: #f44336;
}

/* Прогресс бар морали */
.upgrade-progress-container {
    margin-bottom: 15px;
}

.upgrade-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #909090;
    margin-bottom: 6px;
    font-family: 'Roboto', sans-serif;
}

.upgrade-progress-bar {
    height: 12px;
    background: rgba(20, 15, 10, 0.7);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #3a2515;
    position: relative;
}

.upgrade-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #d4a84a 0%,
        #e0c060 50%,
        #d4a84a 100%
    );
    transition: width 0.5s ease;
    position: relative;
    box-shadow: 0 0 10px rgba(212, 168, 74, 0.5);
}

.upgrade-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Кнопка внесения морали */
.invest-morale-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #604030, #4a3020);
    border: 1px solid #705040;
    border-radius: 8px;
    color: #d4a84a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Roboto', sans-serif;
}

.invest-morale-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #705040, #5a4030);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 60, 30, 0.4);
}

.invest-morale-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #3a2020, #2a1515);
}

.invest-morale-btn .morale-icon {
    width: 20px;
    height: 20px;
}

/* Значок завершения */
.completed-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid #4CAF50;
    border-radius: 8px;
    color: #4CAF50;
    font-weight: 700;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 8px;
}

.completed-badge::before {
    content: '✓';
    font-size: 20px;
}

.completed-date {
    text-align: center;
    font-size: 12px;
    color: #80c080;
    font-style: italic;
}

/* Пустое состояние */
.empty-upgrades {
    text-align: center;
    padding: 40px 20px;
    color: #808080;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
}

/* ===================================
   АДАПТИВНОСТЬ
   =================================== */

@media (max-width: 768px) {
    .town-hall-container {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .town-hall-header {
        padding: 20px;
    }
    
    .town-hall-title {
        font-size: 26px;
    }
    
    .town-hall-content {
        padding: 20px;
    }
    
    .warehouse-items {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .warehouse-item {
        padding: 10px;
    }
    
    .warehouse-item-icon {
        font-size: 28px;
        width: 36px;
        height: 36px;
    }
    
    .upgrades-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .upgrade-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .town-hall-title {
        font-size: 22px;
    }
    
    .warehouse-items {
        grid-template-columns: 1fr 1fr;
    }
    
    .upgrade-name {
        font-size: 16px;
    }
    
    .upgrade-description {
        font-size: 12px;
    }
}
