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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #2d3436, #636e72);
    color: #ddd;
    overflow: hidden;
    user-select: none;
}

.header-bar {
    background: linear-gradient(135deg, #8b4513, #a0522d);
    border: 2px solid #654321;
    border-bottom: 3px solid #5d4037;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.game-title {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    font-weight: 600;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.header-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.2);
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #8b4513;
}

.stat-item img {
    width: 16px;
    height: 16px;
}

.main-container {
    display: flex;
    height: calc(100vh - 120px);
}

.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #4a4a4a, #5a5a5a);
    border: 2px solid #654321;
    border-top: none;
    padding: 15px;
    overflow-y: auto;
}

.sidebar h3 {
    font-family: 'Cinzel', serif;
    color: #ffd700;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.left-sidebar {
    border-right: 3px solid #5d4037;
}

.right-sidebar {
    border-left: 3px solid #5d4037;
}

.building-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #666;
}

.category h4 {
    padding: 10px;
    background: linear-gradient(135deg, #8b4513, #a0522d);
    margin: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid #654321;
}

.category h4:hover {
    background: linear-gradient(135deg, #a0522d, #b8621a);
}

.category.active h4 {
    background: linear-gradient(135deg, #228b22, #32cd32);
}

.building-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category.active .building-list {
    max-height: 300px;
}

.building-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin: 5px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.building-card:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.building-card.selected {
    border-color: #ffd700;
    background: rgba(255,215,0,0.2);
}

.building-card.unaffordable {
    opacity: 0.5;
    pointer-events: none;
}

.building-card img {
    width: 32px;
    height: 32px;
    border-radius: 3px;
}

.building-info {
    flex: 1;
}

.building-name {
    font-weight: 500;
    color: #fff;
}

.building-cost {
    font-size: 12px;
    color: #ffd700;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: #2d3436;
    border: 2px solid #654321;
    border-top: none;
    border-left: none;
    border-right: none;
}

#canvas {
    display: block;
    cursor: crosshair;
    background: #87ceeb;
}

.canvas-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.canvas-controls button {
    padding: 8px 12px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid #666;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.canvas-controls button:hover {
    background: rgba(0,0,0,0.9);
}

.canvas-controls button.active {
    background: #228b22;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

#zoom-level {
    color: white;
    font-size: 12px;
    min-width: 40px;
    text-align: center;
}

.city-stats {
    margin-bottom: 20px;
}

.stat-bar {
    margin-bottom: 10px;
}

.stat-bar label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ccc;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid #666;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #32cd32, #228b22);
    transition: width 0.3s ease;
}

.selected-building {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #666;
}

.selected-building h4 {
    color: #ffd700;
    margin-bottom: 10px;
}

.resources {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #666;
}

.resources h4 {
    color: #ffd700;
    margin-bottom: 10px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.resource-item img {
    width: 16px;
    height: 16px;
}

.status-bar {
    height: 50px;
    background: linear-gradient(135deg, #4a4a4a, #5a5a5a);
    border: 2px solid #654321;
    border-top: 3px solid #5d4037;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications {
    flex: 1;
    padding: 5px 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 5px;
    font-size: 14px;
    color: #ddd;
    border: 1px solid #666;
}

.game-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.game-controls button {
    padding: 5px 10px;
    background: rgba(0,0,0,0.3);
    color: white;
    border: 1px solid #666;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.game-controls button:hover {
    background: rgba(0,0,0,0.5);
}

.game-controls button.active {
    background: #228b22;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #8b4513;
    border-radius: 4px;
    border: 1px solid #654321;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0522d;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
    }
    
    .header-stats {
        gap: 10px;
    }
    
    .stat-item {
        padding: 3px 6px;
        font-size: 12px;
    }
    
    .game-title {
        font-size: 18px;
    }
}

/* Animation effects */
@keyframes buildingPlaced {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.building-placed {
    animation: buildingPlaced 0.5s ease-in-out;
}

@keyframes goldGain {
    0% { transform: translateY(0); color: #ffd700; }
    100% { transform: translateY(-20px); color: transparent; }
}

.gold-gain {
    animation: goldGain 1s ease-out;
}