:root {
    --primary: #2980b9;
    --secondary: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #c0152f;
    --bg: #1a1a1a;
    --surface: #2a2a2a;
    --text: #ecf0f1;
    --text-secondary: #95a5a6;
    --border: #34495e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 70px; /* Space for footer menu */
}

/* FOOTER MENU */
.footer-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--surface) 0%, #1f1f1f 100%);
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.footer-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.footer-link:hover,
.footer-link:active {
    color: var(--primary);
    background: rgba(41, 128, 185, 0.1);
    transform: translateY(-2px);
}

.footer-link .icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.footer-link span:last-child {
    font-size: 0.75rem;
    font-weight: 600;
}

/* CONTAINERS */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* FORMS */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(41, 128, 185, 0.3);
}

.form-group.checkbox {
    display: flex;
    align-items: center;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 0.5rem;
}

.error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: block;
}

/* BUTTONS */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: #1e5f8f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(41, 128, 185, 0.4);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #c0152f;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-full {
    width: 100%;
}

/* AUTH PAGE */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
}

.auth-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.auth-card h1 {
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* HOME PAGE */
.home-container {
    text-align: center;
}

.hero-section {
    padding: 4rem 2rem;
}

.hero-title {
    font-size: 3.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.features-section {
    margin-top: 4rem;
}

.features-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(41, 128, 185, 0.3);
}

.feature-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* LOBBY */
.lobby-container {
    padding: 2rem;
}

.lobby-container h1 {
    margin-bottom: 2rem;
    color: var(--primary);
}

.lobby-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.game-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* GAME LAYOUT */
.game-container {
    padding: 0;
}

.game-layout {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    background: var(--bg);
}

.game-sidebar {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

.game-sidebar h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 1.1rem;
}

.game-sidebar h3:first-child {
    margin-top: 0;
}

.game-board {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    overflow: auto;
    max-height: calc(100vh - 100px);
}

.board-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.board-controls #turn-info {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
}

.game-map {
    display: grid;
    grid-template-columns: repeat(12, 1fr);  /* Обновлено с 4 на 12 для карты 12x12 */
    gap: 0.25rem;  /* Уменьшили gap для компактности */
    padding: 0.5rem;
    max-height: 80vh;
    overflow: auto;
}

.sector {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem;  /* Уменьшили padding для компактности */
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;  /* Уменьшили высоту */
    font-size: 0.75rem;  /* Уменьшили шрифт */
}

.sector:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

.sector.player {
    border-color: var(--success);
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.sector.enemy {
    border-color: var(--danger);
    background: linear-gradient(135deg, #e74c3c 0%, #c0152f 100%);
}

.sector.neutral {
    border-color: var(--text-secondary);
}

.sector-info h4 {
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.sector-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* RESOURCES */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
    max-height: 400px;
    overflow-y: auto;
}

.resource {
    background: rgba(41, 128, 185, 0.1);
    padding: 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.resource:hover {
    background: rgba(41, 128, 185, 0.2);
    border-color: var(--primary);
}

.resource-common {
    border-left: 3px solid #95a5a6;
}

.resource-uncommon {
    border-left: 3px solid #27ae60;
}

.resource-rare {
    border-left: 3px solid #3498db;
}

.resource-epic {
    border-left: 3px solid #9b59b6;
}

.resource-legendary {
    border-left: 3px solid #f39c12;
}

.resource-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.resource-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.resource-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resource-amount {
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary);
}

/* LEADERBOARD */
.leaderboard-container {
    padding: 2rem;
}

.leaderboard-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.leaderboard-table th {
    background: var(--primary);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.leaderboard-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table tr:hover {
    background: rgba(41, 128, 185, 0.1);
}

/* PROFILE */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.profile-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.profile-info {
    margin-bottom: 2rem;
}

.info-group {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.info-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-group span {
    color: var(--text);
    font-weight: 500;
}

.profile-preferences h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    background: none;
    border: none;
}

.close:hover {
    color: var(--text);
}

/* EVENTS LIST */
.events-list {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    padding: 0.8rem;
    background: rgba(41, 128, 185, 0.1);
    border-left: 3px solid var(--primary);
    margin-bottom: 0.5rem;
    border-radius: 2px;
    animation: slideIn 0.3s ease-out;
}

/* ANIMATIONS */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* RESPONSIVENESS */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 200px 1fr 200px;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }

    .container {
        padding: 1rem;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .game-sidebar {
        display: none;
    }

    .game-map {
        grid-template-columns: repeat(6, 1fr);  /* 6 колонок для планшетов */
        gap: 0.2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-link span:last-child {
        font-size: 0.7rem;
    }

    .footer-link .icon {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }

    .btn-large {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .game-map {
        grid-template-columns: repeat(4, 1fr);  /* 4 колонки для мобильных */
        gap: 0.15rem;
    }

    .leaderboard-table {
        font-size: 0.9rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem;
    }
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ATTACK PREVIEW MODAL */
.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.attack-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.attack-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.target-owner, .distance {
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

.army-comparison {
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.comparison-column {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 4px;
}

.comparison-column h5 {
    margin: 0 0 0.8rem 0;
    text-align: center;
    color: var(--primary);
}

.army-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.army-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.army-type {
    color: var(--text-secondary);
}

.army-count {
    color: var(--warning);
    font-weight: bold;
}

.no-units {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.vs-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--danger);
    font-size: 1.2rem;
}

.battle-simulator {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.battle-simulator h5 {
    margin: 0 0 1rem 0;
    color: var(--primary);
}

.sim-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.probability-bar {
    flex: 1;
    height: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.probability-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger) 0%, var(--success) 100%);
    transition: width 0.3s;
}

.probability-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.battle-scenarios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.scenario {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid var(--border);
}

.scenario.scenario-win {
    border-left-color: var(--success);
}

.scenario.scenario-loss {
    border-left-color: var(--danger);
}

.scenario h6 {
    margin: 0 0 0.8rem 0;
    font-size: 0.95rem;
}

.scenario-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.loss-count {
    color: var(--danger);
    font-weight: bold;
}

.gain-count {
    color: var(--success);
    font-weight: bold;
}

.recommendation {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.recommendation.recommendation-go {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid var(--success);
}

.recommendation.recommendation-caution {
    background: rgba(243, 156, 18, 0.2);
    border: 1px solid var(--warning);
}

.recommendation.recommendation-no {
    background: rgba(192, 21, 47, 0.2);
    border: 1px solid var(--danger);
}

.rec-icon {
    font-size: 1.5rem;
}

.rec-text {
    flex: 1;
    font-weight: 600;
}

/* UNIT SELECTOR */
.units-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.unit-card {
    background: rgba(41, 128, 185, 0.1);
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.unit-card:hover {
    border-color: var(--primary);
    background: rgba(41, 128, 185, 0.2);
}

.unit-card.selected {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.15);
}

.unit-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.unit-name {
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.selected-unit-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.quantity-selector {
    margin-bottom: 1.5rem;
}

.quantity-selector label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.quantity-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.qty-btn, .qty-decrease, .qty-increase {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover, .qty-decrease:hover, .qty-increase:hover {
    background: #3498db;
}

#recruit-quantity {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 4px;
    font-size: 1rem;
    text-align: center;
}

.qty-buttons {
    display: flex;
    gap: 0.5rem;
}

.qty-preset {
    flex: 1;
    padding: 0.6rem;
    background: rgba(41, 128, 185, 0.2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-preset:hover {
    background: rgba(41, 128, 185, 0.3);
}

.cost-estimate {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.cost-estimate h5 {
    margin-top: 0;
    color: var(--primary);
}

.cost-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.cost-row span:first-child {
    min-width: 120px;
    color: var(--text-secondary);
}

.cost-value {
    min-width: 40px;
    color: var(--warning);
    font-weight: bold;
}

.cost-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.cost-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
    transition: width 0.3s;
}

.cost-available {
    min-width: 100px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.cost-available.enough {
    color: var(--success);
}

.cost-available.not-enough {
    color: var(--danger);
}

.total-estimate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 0.8rem;
    font-weight: bold;
}

#resource-warning {
    color: var(--danger);
    font-size: 0.9rem;
}

/* BUILDINGS SELECTOR */
.buildings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.building-card {
    background: rgba(39, 174, 96, 0.1);
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.building-card:hover {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.2);
}

.building-card.selected {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.25);
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.3);
}

.building-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.building-name {
    font-weight: bold;
    color: var(--success);
    text-align: center;
    margin-bottom: 0.5rem;
}

.selected-building-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.building-bonuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bonus-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(39, 174, 96, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.bonus-type {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.bonus-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--success);
}

/* TECH SELECTOR */
.techs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tech-card {
    display: flex;
    gap: 1rem;
    background: rgba(155, 89, 182, 0.1);
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tech-card:hover {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.2);
}

.tech-card.selected {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.25);
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.3);
}

.tech-icon {
    font-size: 2.5rem;
    text-align: center;
    flex-shrink: 0;
    width: 50px;
}

.tech-info {
    flex: 1;
}

.tech-name {
    font-weight: bold;
    color: #9b59b6;
    margin-bottom: 0.25rem;
}

.tech-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.selected-tech-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.prerequisite-warning {
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid var(--danger);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.prerequisite-item {
    background: rgba(241, 196, 15, 0.1);
    border-left: 3px solid var(--warning);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.benefit-section {
    background: rgba(52, 152, 219, 0.05);
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.benefit-section strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.benefit-list {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.benefit-bonuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.no-benefits {
    color: var(--text-secondary);
    font-style: italic;
}
/* TRADE MODAL */
.trade-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.trade-tab {
    flex: 1;
    padding: 0.8rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    font-weight: 600;
}

.trade-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.trade-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.trade-tab-content {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.trade-resource {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-bottom: 0.8rem;
}

.trade-resource label {
    min-width: 150px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.trade-input {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
}

.trade-resource .available {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.trade-offer {
    background: rgba(52, 152, 219, 0.1);
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid var(--primary);
    margin-bottom: 1rem;
}

.trade-from {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.trade-time {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.trade-items {
    color: var(--warning);
    font-weight: 600;
    font-size: 1rem;
}

.trade-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.trade-actions .btn {
    flex: 1;
}

/* PRODUCTION MODAL */
.population-summary {
    background: rgba(52, 152, 219, 0.1);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--primary);
}

.population-summary h5 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.production-assignment {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.assignment-header label {
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assignment-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.assignment-input {
    width: 70px;
    padding: 0.4rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 4px;
    text-align: center;
    font-size: 0.95rem;
}

.assignment-slider {
    width: 100%;
    margin-bottom: 0.8rem;
    cursor: pointer;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.assignment-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.assignment-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.assignment-production {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.prod-amount {
    font-weight: 600;
    color: var(--success);
    font-size: 1.1rem;
}

.prod-label {
    color: var(--text-secondary);
}

.production-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.prod-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.8rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prod-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prod-count {
    color: var(--success);
    font-weight: bold;
    font-size: 1.1rem;
}