/* ===================================
   Стили для страницы провинций
   =================================== */

/* Нормализация Font Awesome иконок: чтобы не «висели» над текстом */
.provinces-header i,
.province-card i,
.buildings-list i,
.building-types-grid i {
    display: inline-block !important;
    line-height: 1 !important;
    vertical-align: middle;
    font-size: inherit !important;
    margin: 0 !important;
}

/* Родительские элементы с иконками должны быть flex-контейнерами */
.building-header h4,
.building-stats .stat-item,
.building-type-card h4,
.building-type-stats .stat-row,
.province-card-header h3,
.province-city {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Переопределяем общие правила для иконок внутри построек */
.building-stats .stat-item > i,
.building-header h4 > i,
.building-type-stats .stat-row > i {
    display: inline-block !important;
    width: auto !important;
    text-align: left !important;
}

/* Заголовок секции провинций */
.provinces-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.provinces-header h2 {
    margin: 0;
    font-size: 1.75em;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.provinces-header h2 i {
    color: var(--primary);
    font-size: 1em;
}

/* Сетка провинций */
.provinces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* Карточка провинции */
.province-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.province-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* Заголовок карточки провинции */
.province-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.province-card-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.province-card-header h3 i {
    color: var(--primary);
    font-size: 0.9em;
}

.province-city {
    margin: 0;
    font-size: 0.95em;
    color: var(--text-secondary);
    /* display: flex уже добавлен выше */
}

.province-city i {
    color: var(--info);
    font-size: 0.9em;
    flex-shrink: 0;
}

/* Действия с провинцией (админ) */
.province-actions {
    display: flex;
    gap: 8px;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Информация о провинции */
.province-info {
    margin: 16px 0;
}

/* Кнопка на всю ширину */
.btn-full {
    width: 100%;
    margin-top: 16px;
    justify-content: center;
}

/* ===================================
   Стили для построек
   =================================== */

/* Список построек в модальном окне */
.buildings-list {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

/* Карточка постройки */
.building-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
}

.building-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

/* Заголовок постройки */
.building-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.building-header h4 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    /* display: flex добавлен выше в общих правилах */
}

.building-header h4 i {
    color: var(--success) !important;
    font-size: 0.9em !important;
    flex-shrink: 0;
    display: inline-block !important;
    line-height: 1 !important;
}

.building-header .btn-icon {
    flex-shrink: 0;
}

/* Описание постройки */
.building-description {
    margin: 0 0 16px 0;
    font-size: 0.95em;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Статистика постройки */
.building-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.building-stats .stat-item {
    /* display: flex добавлен выше в общих правилах */
    font-size: 0.9em;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.building-stats .stat-item i {
    color: var(--warning) !important;
    font-size: 1.1em !important;
    flex-shrink: 0;
    display: inline-block !important;
    line-height: 1 !important;
}

/* ===================================
   Стили для меню строительства
   =================================== */

/* Сетка типов построек */
.building-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Карточка типа постройки */
.building-type-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.building-type-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.building-type-card h4 {
    margin: 0 0 12px 0;
    font-size: 1.15em;
    font-weight: 600;
    color: var(--text-primary);
    /* display: flex добавлен выше в общих правилах */
}

.building-type-card h4 i {
    color: var(--primary) !important;
    font-size: 0.95em !important;
    flex-shrink: 0;
    display: inline-block !important;
    line-height: 1 !important;
}

.building-type-card p {
    margin: 0 0 16px 0;
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.5;
    flex-grow: 1;
}

/* Статистика типа постройки */
.building-type-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.building-type-stats .stat-row {
    /* display: flex добавлен выше в общих правилах */
    font-size: 0.85em;
    color: var(--text-secondary);
}

.building-type-stats .stat-row i {
    color: var(--warning) !important;
    font-size: 1em !important;
    min-width: 16px;
    flex-shrink: 0;
    display: inline-block !important;
    line-height: 1 !important;
}

.building-type-stats .stat-row:first-child i {
    color: var(--primary) !important;
}

.building-type-stats .stat-row:last-child i {
    color: var(--success) !important;
}

/* ===================================
   Адаптивность
   =================================== */

@media (max-width: 1024px) {
    .provinces-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .building-types-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .provinces-header {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }
    
    .provinces-header h2 {
        font-size: 1.4em;
    }
    
    .provinces-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .province-card {
        padding: 20px;
    }
    
    .province-card-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .province-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .building-types-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .provinces-header {
        padding: 16px;
    }
    
    .provinces-header h2 {
        font-size: 1.2em;
    }
    
    .province-card {
        padding: 16px;
    }
    
    .province-card-header h3 {
        font-size: 1.2em;
    }
    
    .building-type-card {
        padding: 16px;
    }
}

/* ===================================
   Стили для производственного меню
   =================================== */

.building-actions {
    display: flex;
    gap: 8px;
}

.production-status {
    background: var(--success-bg) !important;
    border-left: 3px solid var(--success);
    font-weight: 500;
}

.production-status.inactive {
    background: var(--warning-bg) !important;
    border-left: 3px solid var(--warning);
}

.production-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    color: var(--success);
    font-weight: 600;
    margin-bottom: 16px;
}

.production-current i {
    font-size: 1.2em;
}

/* Информация о здании */
.building-production-info {
    display: flex;
    gap: 20px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.building-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.building-info-item i {
    color: var(--primary);
}

/* Панель управления финансированием */
.funding-control-panel {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}

.funding-header {
    margin-bottom: 10px;
}

.funding-header h4 {
    margin: 0;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.funding-header h4 i {
    color: var(--primary);
    font-size: 0.9em;
}

.funding-slider-container {
    margin: 12px 0;
}

.funding-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.75em;
    color: var(--text-secondary);
    font-weight: 500;
}

.funding-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
}

.funding-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.funding-slider::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.funding-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.funding-slider::-moz-range-thumb:hover {
    background: var(--primary-hover);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.funding-value-display {
    text-align: center;
    margin-top: 8px;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--primary);
}

.funding-stats {
    display: flex;
    gap: 12px;
    margin: 10px 0;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.funding-stat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.funding-stat i {
    color: var(--warning);
    font-size: 1em;
}

.funding-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.btn-apply-funding {
    width: 100%;
    padding: 8px;
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-apply-funding i {
    font-size: 1em;
}

/* Сетка карточек производства (4 в ряд) */
.production-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.production-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.production-card:hover:not(.disabled) {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.production-card.active {
    border-color: var(--success);
    background: var(--success-bg);
}

.production-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.production-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.production-card-header h4 {
    margin: 0;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.production-card-header .active-icon {
    color: var(--success);
    font-size: 1.1em;
    flex-shrink: 0;
}

.tech-required-badge {
    background: var(--warning);
    color: white;
    font-size: 0.7em;
    padding: 3px 8px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
}

.tech-required-badge.too-expensive {
    background: var(--danger);
}

.production-bonus {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-weight: 600;
    padding: 4px 8px;
    background: var(--success-bg);
    border-radius: 4px;
    font-size: 0.85em;
}

.production-bonus i {
    color: var(--success);
    font-size: 0.9em;
}

.production-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85em;
}

.batch-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.batch-info i {
    color: var(--primary);
    font-size: 0.9em;
}

.resources-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.resource-tag {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-select-production {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
}

.btn-select-production:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.active-label {
    background: var(--success);
    color: white;
    font-size: 0.75em;
    padding: 4px 8px;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
    margin-top: 4px;
}

/* Адаптивность сетки */
@media (max-width: 1400px) {
    .production-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .production-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .production-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
body.dark-mode .province-card:hover {
    border-color: var(--primary);
}

body.dark-mode .building-item:hover {
    border-color: var(--primary);
}

body.dark-mode .building-type-card:hover {
    border-color: var(--primary);
}
