/* =================================================================
   UNDERGROUND FARMER - MAIN STYLESHEET
   ================================================================= */

/* =================================================================
   1. RESET & BASE STYLES
   ================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(180deg, #2c1810 0%, #1a0f0a 100%);
    color: #e0d0c0;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =================================================================
   2. UI OVERLAY & TOP BAR
   ================================================================= */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

#top-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 2px solid #8b4513;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

/* =================================================================
   3. LANGUAGE SELECTOR
   ================================================================= */
#language-selector {
    display: flex;
    gap: 5px;
}

#language-selector button {
    background: #654321;
    color: #e0d0c0;
    border: 1px solid #8b4513;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: background 0.2s;
}

#language-selector button:hover {
    background: #8b4513;
}

/* =================================================================
   4. FARM INFO SECTION
   ================================================================= */
#farm-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.farm-info.hidden {
    display: none;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

.farm-title {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #654321, #8b4513);
    border: 2px solid #8b4513;
    border-radius: 8px;
    color: #f5deb3;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.farm-icon {
    font-size: 16px;
}

.farm-subtitle {
    color: #d2b48c;
    font-size: 11px;
    text-align: center;
    opacity: 0.9;
}

/* =================================================================
   4.5. RESOURCES DISPLAY
   ================================================================= */
#resources {
    display: flex;
    gap: 20px;
}

.resources-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #654321, #8b4513);
    border: 2px solid #8b4513;
    border-radius: 8px;
    color: #f5deb3;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.resources-toggle-btn:hover {
    background: linear-gradient(135deg, #8b4513, #cd853f);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.resources-icon {
    font-size: 16px;
}

.resources-text {
    font-weight: bold;
}

.resources-quick-display {
    display: flex;
    gap: 8px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(245, 222, 179, 0.3);
}

.quick-resource {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #daa520;
    font-weight: bold;
}

/* =================================================================
   5. BOTTOM AREA & NAVIGATION
   ================================================================= */
#bottom-area {
    height: calc(100vh - 60px);
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #2c1810 0%, #1a0f0a 100%);
    overflow-y: auto;
    overflow-x: hidden;
}

#bottom-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 2px solid #8b4513;
    padding: 10px;
    gap: 10px;
    justify-content: center;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #654321;
    color: #e0d0c0;
    border: 2px solid #8b4513;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.3s;
    min-width: 120px;
    justify-content: center;
}

.nav-btn:hover {
    background: #8b4513;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: #cd853f;
    border-color: #daa520;
    box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
}

.nav-icon {
    font-size: 18px;
}

.nav-text {
    font-weight: bold;
}

.bottom-section {
    flex: 1;
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
}

.bottom-section.active {
    display: flex;
    flex-direction: column;
}

/* =================================================================
   6. FARM AREA & PLANT SLOTS
   ================================================================= */
#farm-area-bottom {
    height: 100%;
    padding: 15px;
    overflow-y: auto;
}

#plant-slots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 12px;
    max-width: 700px;
    margin: 0 auto;
    height: 100%;
}

.plant-slot {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #8b4513;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    height: auto;
}

.plant-slot:hover {
    border-color: #daa520;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.3);
}

.plant-slot.locked {
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed #555;
    cursor: pointer;
}

.plant-slot.locked:hover {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.plant-slot.occupied {
    border-color: #32cd32;
}

.slot-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.slot-info {
    font-size: 11px;
    color: #e0d0c0;
    line-height: 1.3;
    margin: 5px 0;
    min-height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.slot-progress {
    width: 100%;
    height: 10px;
    background: #333;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid #555;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #32cd32, #90ee90);
    width: 0%;
    transition: width 0.5s;
}

/* =================================================================
   7. DIALOG SYSTEM
   ================================================================= */
.dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: backdropAppear 0.3s ease-out;
}

.plant-selection-dialog {
    background: linear-gradient(145deg, #2c1810, #1a0f0a);
    border: 3px solid #8b4513;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    color: #e0d0c0;
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    animation: dialogAppear 0.3s ease-out;
}

.dialog-header {
    background: linear-gradient(90deg, #654321, #8b4513);
    padding: 15px 20px;
    border-bottom: 2px solid #8b4513;
    text-align: center;
}

.dialog-header h3 {
    margin: 0;
    font-size: 18px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

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

.plant-option {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #654321;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.plant-option:hover {
    border-color: #daa520;
    background: rgba(218, 165, 32, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.3);
}

.plant-option-icon {
    font-size: 40px;
    margin-right: 15px;
    min-width: 50px;
    text-align: center;
}

.plant-option-info {
    flex: 1;
}

.plant-option-name {
    font-size: 16px;
    font-weight: bold;
    color: #daa520;
    margin-bottom: 8px;
}

.plant-option-details {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.plant-cost {
    color: #ffd700;
    font-weight: bold;
}

.plant-time {
    color: #87ceeb;
}

.plant-value {
    color: #32cd32;
    font-weight: bold;
}

.dialog-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 20px;
    border-top: 1px solid #654321;
    text-align: center;
}

.cancel-btn {
    background: linear-gradient(145deg, #8b4513, #654321);
    color: #e0d0c0;
    border: 2px solid #654321;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: linear-gradient(145deg, #654321, #8b4513);
    border-color: #daa520;
    transform: translateY(-1px);
}

/* =================================================================
   8. ANIMATIONS
   ================================================================= */
@keyframes backdropAppear {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes dialogAppear {
    0% { 
        opacity: 0;
        transform: scale(0.8);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes clickFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(218, 165, 32, 0.5); }
    50% { box-shadow: 0 0 20px rgba(218, 165, 32, 0.8); }
    100% { box-shadow: 0 0 5px rgba(218, 165, 32, 0.5); }
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* =================================================================
   9. SPECIAL EFFECTS
   ================================================================= */
.crystal-glow {
    animation: glow 2s infinite;
}

.particle {
    position: absolute;
    pointer-events: none;
    z-index: 50;
}

.dig-particle {
    width: 4px;
    height: 4px;
    background: #8b4513;
    border-radius: 50%;
    opacity: 0.8;
}

.plant-particle {
    width: 6px;
    height: 6px;
    background: #32cd32;
    border-radius: 50%;
    opacity: 0.7;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a0f0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-text {
    color: #e0d0c0;
    font-size: 24px;
    animation: pulse 1.5s infinite;
}

/* =================================================================
   10. SCROLLBAR STYLING
   ================================================================= */

/* Main Game Scrollbar Styles */
#bottom-area::-webkit-scrollbar,
.bottom-section::-webkit-scrollbar {
    width: 12px;
}

#bottom-area::-webkit-scrollbar-track,
.bottom-section::-webkit-scrollbar-track {
    background: linear-gradient(135deg, #1a0f0a 0%, #2c1810 100%);
    border-radius: 6px;
    border: 1px solid #8b4513;
}

#bottom-area::-webkit-scrollbar-thumb,
.bottom-section::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #654321 0%, #8b4513 100%);
    border-radius: 6px;
    border: 2px solid #2c1810;
}

#bottom-area::-webkit-scrollbar-thumb:hover,
.bottom-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8b4513 0%, #cd853f 100%);
}

/* Farm Area Scrollbar */
#farm-area-bottom::-webkit-scrollbar {
    width: 10px;
}

#farm-area-bottom::-webkit-scrollbar-track {
    background: linear-gradient(135deg, #1a0f0a 0%, #2c1810 100%);
    border-radius: 5px;
}

#farm-area-bottom::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #654321 0%, #8b4513 100%);
    border-radius: 5px;
    border: 1px solid #2c1810;
}

#farm-area-bottom::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8b4513 0%, #cd853f 100%);
}

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

.dialog-content::-webkit-scrollbar-track {
    background: linear-gradient(135deg, #1a0f0a 0%, #2c1810 100%);
    border-radius: 4px;
}

.dialog-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #654321 0%, #8b4513 100%);
    border-radius: 4px;
    border: 1px solid #2c1810;
}

.dialog-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8b4513 0%, #cd853f 100%);
}

/* Legacy styles for other elements */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2c1810;
}

::-webkit-scrollbar-thumb {
    background: #8b4513;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #cd853f;
}

/* =================================================================
   11. RESPONSIVE DESIGN
   ================================================================= */
@media (max-width: 1200px) {
    #plant-slots {
        max-width: 600px;
    }
}

@media (max-width: 768px) {
    #top-ui {
        padding: 5px 10px;
        flex-wrap: wrap;
        height: auto;
    }
    
        #farm-info {
        gap: 2px;
    }

    .farm-title {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .farm-subtitle {
        font-size: 10px;
    }
    
    
    #plant-slots {
        grid-template-columns: repeat(3, 1fr);
        max-width: 500px;
        gap: 8px;
    }
    
    .plant-slot {
        min-height: 100px;
        padding: 8px;
    }
    
    .slot-icon {
        font-size: 28px;
    }
    
    .plant-selection-dialog {
        min-width: 350px;
        max-width: 90vw;
    }
}

@media (max-width: 480px) {
    #plant-slots {
        grid-template-columns: repeat(2, 1fr);
        max-width: 350px;
    }
    
    .floor-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .floor-name {
        display: none;
    }
}

.game-icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
} 