/* =================================================================
   UNDERGROUND FARMER - CITY STYLES
   ================================================================= */

/* City Section Layout */
#city-section {
    display: none;
    flex-direction: column;
    padding: 20px;
    background: linear-gradient(135deg, #2a3a4a 0%, #1e2832 100%);
    color: #e0d0c0;
    min-height: 600px;
}

#city-section.active {
    display: flex;
}

/* City Header */
.city-header {
    text-align: center;
    margin-bottom: 20px;
}

.city-header h2 {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    color: #f4d03f;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.city-header p {
    font-size: 1.2em;
    margin: 0;
    color: #bdc3c7;
}

/* City Grid */
.city-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    max-width: 600px;
    margin: 0 auto 20px auto;
    aspect-ratio: 1;
    height: 350px;
}

.city-slot {
    background: rgba(52, 73, 94, 0.7);
    border: 3px solid #34495e;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.city-slot:hover {
    border-color: #f39c12;
    background: rgba(52, 73, 94, 0.9);
    transform: scale(1.05);
}

.city-slot.empty {
    background: rgba(44, 62, 80, 0.5);
    border-style: dashed;
}

.city-slot.occupied {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border-color: #2ecc71;
}

/* Empty Slot Styling */
.empty-slot {
    text-align: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.empty-slot:hover {
    opacity: 1;
}

.empty-icon {
    font-size: 3em;
    margin-bottom: 8px;
    color: #95a5a6;
}

.empty-text {
    font-size: 1.1em;
    color: #bdc3c7;
    font-weight: bold;
}

/* Building Display */
.building {
    text-align: center;
    width: 100%;
    padding: 10px;
}

.building-icon {
    font-size: 3.5em;
    margin-bottom: 8px;
    display: block;
}

.building-name {
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 5px;
    color: #ecf0f1;
}

.building-level {
    font-size: 0.9em;
    color: #f39c12;
    background: rgba(0,0,0,0.4);
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
    font-weight: bold;
}

/* City Info Panel */
.city-info {
    background: rgba(44, 62, 80, 0.8);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.city-stats h3 {
    color: #f4d03f;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4em;
}

#city-bonuses {
    line-height: 1.6;
    color: #2ecc71;
}

#city-bonuses p {
    color: #95a5a6;
    font-style: italic;
}

/* City Dialog Styles */
.city-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.city-dialog {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    overflow: hidden;
    color: #e0d0c0;
}

.city-dialog-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.city-dialog-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.city-dialog-close {
    background: rgba(231, 76, 60, 0.8);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.city-dialog-close:hover {
    background: #e74c3c;
}

.city-dialog-content {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Building Categories */
.building-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-btn {
    background: rgba(52, 73, 94, 0.8);
    border: 2px solid #34495e;
    color: #e0d0c0;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.category-btn:hover {
    border-color: #f39c12;
    background: rgba(52, 73, 94, 1);
}

.category-btn.active {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-color: #f39c12;
    color: white;
}

/* Building List */
.building-list {
    display: grid;
    gap: 15px;
}

.building-option {
    background: rgba(44, 62, 80, 0.6);
    border: 2px solid #34495e;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 15px;
    align-items: center;
}

.building-option:hover {
    border-color: #f39c12;
    background: rgba(44, 62, 80, 0.8);
}

.building-option.affordable {
    border-color: #27ae60;
}

.building-option.affordable:hover {
    border-color: #2ecc71;
    background: rgba(39, 174, 96, 0.1);
}

.building-option.not-affordable {
    border-color: #e74c3c;
    opacity: 0.6;
    cursor: not-allowed;
}

.building-option-icon {
    font-size: 3em;
    text-align: center;
}

.building-option-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.building-option-name {
    font-weight: bold;
    font-size: 1.2em;
    color: #f4d03f;
}

.building-option-cost {
    color: #e67e22;
    font-size: 0.9em;
}

.building-option-bonus {
    color: #2ecc71;
    font-size: 0.85em;
    line-height: 1.4;
}

/* Building Info Display */
.building-info {
    background: rgba(52, 73, 94, 0.5);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.current-bonuses h4 {
    color: #f4d03f;
    margin-bottom: 10px;
}

/* Upgrades List */
.upgrades-list h4 {
    color: #f4d03f;
    margin-bottom: 15px;
}

.upgrade-item {
    background: rgba(44, 62, 80, 0.6);
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
}

.upgrade-item.owned {
    border-color: #2ecc71;
    background: rgba(39, 174, 96, 0.1);
}

.upgrade-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.upgrade-name {
    font-weight: bold;
    color: #f4d03f;
}

.upgrade-cost {
    color: #e67e22;
    font-size: 0.9em;
}

.upgrade-bonus {
    color: #2ecc71;
    font-size: 0.9em;
    line-height: 1.4;
}

.upgrade-action {
    text-align: right;
}

.upgrade-buy-btn {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.upgrade-buy-btn:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    transform: translateY(-2px);
}

.upgrade-buy-btn:disabled {
    background: rgba(149, 165, 166, 0.5);
    cursor: not-allowed;
    transform: none;
}

.owned-label {
    color: #2ecc71;
    font-weight: bold;
    background: rgba(39, 174, 96, 0.2);
    padding: 8px 15px;
    border-radius: 15px;
    border: 1px solid #2ecc71;
}

/* Responsive Design */
@media (max-width: 768px) {
    .city-grid {
        height: 280px;
        gap: 12px;
        max-width: 100%;
        margin: 0 10px 20px 10px;
    }
    
    .city-slot {
        min-height: 120px;
        border-width: 2px;
    }
    
    .empty-icon {
        font-size: 3em;
    }
    
    .empty-text {
        font-size: 1.1em;
    }
    
    .building-icon {
        font-size: 3.5em;
    }
    
    .building-name {
        font-size: 1em;
    }
    
    .building-level {
        font-size: 0.9em;
        padding: 4px 10px;
    }
    
    .city-dialog {
        width: 95%;
        max-height: 85vh;
    }
    
    .city-dialog-content {
        padding: 15px;
    }
    
    .building-option {
        grid-template-columns: 60px 1fr auto;
        padding: 10px;
    }
    
    .building-option-icon {
        font-size: 2em;
    }
    
    .building-categories {
        justify-content: center;
    }
    
    .category-btn {
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .city-header h2 {
        font-size: 2em;
    }
    
    .city-header p {
        font-size: 1em;
    }
    
    .city-grid {
        max-width: 400px;
        gap: 8px;
        height: 200px;
    }
    
    .empty-icon {
        font-size: 2.5em;
    }
    
    .empty-text {
        font-size: 1em;
    }
    
    .building-option {
        grid-template-columns: 50px 1fr auto;
        gap: 8px;
    }
    
    .upgrade-item {
        padding: 10px;
        margin-bottom: 8px;
    }
}

/* Animation Effects */
@keyframes buildingConstruct {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.building {
    animation: buildingConstruct 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.city-dialog {
    animation: slideIn 0.3s ease-out;
}

/* Scrollbar Styling */
.city-dialog-content::-webkit-scrollbar {
    width: 8px;
}

.city-dialog-content::-webkit-scrollbar-track {
    background: rgba(52, 73, 94, 0.3);
    border-radius: 4px;
}

.city-dialog-content::-webkit-scrollbar-thumb {
    background: rgba(149, 165, 166, 0.5);
    border-radius: 4px;
}

.city-dialog-content::-webkit-scrollbar-thumb:hover {
    background: rgba(149, 165, 166, 0.7);
}

/* Already Built Buildings */
.building-option.already-built {
    background: rgba(100, 100, 100, 0.3);
    border-color: #666;
    opacity: 0.6;
    cursor: not-allowed;
}

.already-built-text {
    color: #bdc3c7;
    font-size: 0.9em;
    font-style: italic;
    margin-top: 5px;
}

/* Building Actions */
.building-actions {
    margin: 15px 0;
    text-align: center;
}

.sell-building-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.sell-building-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

/* Confirmation Dialog */
.confirm-dialog {
    max-width: 400px;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.confirm-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
}

.cancel-btn {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: linear-gradient(135deg, #6c7b7d, #5a6c6d);
    transform: translateY(-1px);
} 