/* ============================================
   CAPYBARA GO! - UI Components Styles
   ============================================ */

/* ============================================
   TITLE SCREEN
   ============================================ */

#title-screen {
    background: linear-gradient(180deg, 
        #fef6e4 0%, 
        #f8eed6 50%,
        #e8d5b0 100%);
    justify-content: center;
    align-items: center;
}

.title-content {
    text-align: center;
    padding: var(--space-xl);
}

.game-title {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--color-primary);
    text-shadow: 
        3px 3px 0 var(--color-primary-dark),
        6px 6px 0 rgba(0,0,0,0.1);
    margin-bottom: var(--space-sm);
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
}

.title-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.meta-currency {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
}

.coin-icon {
    font-size: 1.3rem;
    margin-right: var(--space-xs);
}

/* ============================================
   UPGRADES SCREEN
   ============================================ */

#upgrades-screen {
    background: var(--color-bg-primary);
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: white;
    box-shadow: var(--shadow-sm);
}

.screen-header h2 {
    font-family: var(--font-display);
    color: var(--color-primary);
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: var(--space-md);
    overflow-y: auto;
    flex: 1;
}

.upgrade-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 3px solid transparent;
}

.upgrade-card:hover:not(.maxed) {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.upgrade-card.maxed {
    opacity: 0.7;
    cursor: default;
}

.upgrade-card.affordable {
    border-color: var(--color-tertiary);
}

.upgrade-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.upgrade-name {
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.upgrade-desc {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.upgrade-level {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.upgrade-cost {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 700;
    color: var(--color-gold-dark);
}

/* ============================================
   EVENT SCREEN
   ============================================ */

#event-screen {
    background: linear-gradient(180deg, 
        var(--color-bg-secondary) 0%, 
        var(--color-bg-primary) 100%);
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
}

.event-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.event-illustration {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-lg);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.event-title {
    font-family: var(--font-display);
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

.event-description {
    color: var(--color-text);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.event-choices {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.event-choice {
    background: var(--color-bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.event-choice:hover {
    border-color: var(--color-primary);
    transform: translateX(5px);
}

.choice-text {
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.choice-hint {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.event-result {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 2px solid var(--color-bg-secondary);
}

#event-result-text {
    font-size: 1.1rem;
    margin-bottom: var(--space-lg);
}

/* ============================================
   SHOP SCREEN
   ============================================ */

#shop-screen {
    background: linear-gradient(180deg, 
        #fff8e1 0%, 
        #ffecb3 100%);
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.shop-header h2 {
    font-family: var(--font-display);
}

.gold-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 700;
    font-size: 1.1rem;
}

.shop-content {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.shop-item {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 3px solid transparent;
}

.shop-item:hover:not(.sold):not(.unaffordable) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.shop-item.sold {
    opacity: 0.5;
    cursor: default;
}

.shop-item.unaffordable {
    opacity: 0.7;
}

.shop-item.affordable {
    border-color: var(--color-tertiary);
}

.item-icon {
    width: 60px;
    height: 60px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 3px solid;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.item-stats {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.item-price {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-gold-dark);
}

/* ============================================
   REST SCREEN
   ============================================ */

#rest-screen {
    background: linear-gradient(180deg, 
        #1a1a2e 0%, 
        #16213e 50%,
        #0f3460 100%);
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
}

.rest-container {
    text-align: center;
    color: white;
}

.rest-illustration {
    position: relative;
    width: 200px;
    height: 150px;
    margin: 0 auto var(--space-xl);
}

/* Campfire */
.campfire {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
}

.campfire::before {
    content: '🔥';
    font-size: 50px;
    animation: fireFlicker 0.5s ease-in-out infinite alternate;
}

@keyframes fireFlicker {
    0% { transform: scale(1) rotate(-2deg); }
    100% { transform: scale(1.1) rotate(2deg); }
}

.campfire::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(255,150,50,0.3) 0%, transparent 70%);
}

.rest-container h2 {
    font-family: var(--font-display);
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
}

.rest-container p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--space-xl);
}

.rest-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.rest-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    min-width: 200px;
}

.option-icon {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
}

.option-text {
    font-size: 1.1rem;
}

.option-desc {
    font-size: 0.8rem;
    opacity: 0.8;
    text-transform: none;
}

/* ============================================
   TREASURE SCREEN
   ============================================ */

#treasure-screen {
    background: linear-gradient(180deg, 
        #2d1b00 0%, 
        #4a3000 50%,
        #6b4500 100%);
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
}

.treasure-container {
    text-align: center;
    color: white;
}

.treasure-chest {
    width: 120px;
    height: 100px;
    margin: 0 auto var(--space-xl);
    font-size: 80px;
    animation: chestBounce 1s ease-in-out infinite;
}

.treasure-chest::before {
    content: '🎁';
}

@keyframes chestBounce {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

.treasure-container h2 {
    font-family: var(--font-display);
    color: var(--color-gold);
    margin-bottom: var(--space-lg);
    text-shadow: 0 0 20px var(--color-gold);
}

.treasure-contents {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.treasure-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    animation: treasurePop 0.5s ease-out backwards;
}

.treasure-item:nth-child(1) { animation-delay: 0.2s; }
.treasure-item:nth-child(2) { animation-delay: 0.4s; }
.treasure-item:nth-child(3) { animation-delay: 0.6s; }

@keyframes treasurePop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============================================
   INVENTORY MODAL
   ============================================ */

.inventory-content {
    width: 420px;
    max-height: 80vh;
}

.inventory-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.character-panel {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--color-bg-secondary);
}

.stats-display {
    flex: 1;
}

.stats-display h3 {
    margin-bottom: var(--space-sm);
    color: var(--color-primary);
}

.stat-line {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    font-size: 0.9rem;
}

.equipment-panel h3,
.artifacts-panel h3,
.companions-panel h3 {
    margin-bottom: var(--space-sm);
    color: var(--color-primary);
    font-size: 1rem;
}

.equipment-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.equip-slot {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
    min-height: 70px;
}

.equip-slot:hover {
    border-color: var(--color-primary);
}

.equip-slot.equipped {
    background: white;
    border-color: var(--color-secondary);
}

.slot-icon {
    font-size: 1.5rem;
}

.slot-name {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

.slot-item {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.artifacts-list,
.companions-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.artifact-item,
.companion-item {
    width: 50px;
    height: 50px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.artifact-item:hover,
.companion-item:hover {
    transform: scale(1.1);
    border-color: var(--color-primary);
}

/* ============================================
   GAME OVER & VICTORY SCREENS
   ============================================ */

#gameover-screen {
    background: linear-gradient(180deg, 
        #1a1a1a 0%, 
        #2d2d2d 50%,
        #1a1a1a 100%);
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
}

.gameover-content {
    text-align: center;
    color: white;
}

#gameover-title {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--color-red);
    margin-bottom: var(--space-xl);
    text-shadow: 0 0 30px var(--color-red);
}

.run-summary {
    margin-bottom: var(--space-xl);
}

.run-summary p {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    color: rgba(255, 255, 255, 0.8);
}

.coins-earned {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: var(--space-xl);
    animation: coinsGlow 1s ease-in-out infinite alternate;
}

@keyframes coinsGlow {
    from { text-shadow: 0 0 10px var(--color-gold); }
    to { text-shadow: 0 0 30px var(--color-gold); }
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Victory Screen */
#victory-screen {
    background: linear-gradient(180deg, 
        #1a237e 0%, 
        #283593 50%,
        #3949ab 100%);
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
}

.victory-content {
    text-align: center;
    color: white;
}

.victory-content h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--color-gold);
    margin-bottom: var(--space-md);
    text-shadow: 0 0 30px var(--color-gold);
    animation: victoryPulse 1s ease-in-out infinite;
}

@keyframes victoryPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.victory-content > p {
    font-size: 1.2rem;
    margin-bottom: var(--space-xl);
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   TOOLTIPS
   ============================================ */

.tooltip {
    position: absolute;
    background: var(--color-bg-dark);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    max-width: 200px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    animation: tooltipFade 0.2s ease-out;
}

@keyframes tooltipFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-bg-dark);
}

/* ============================================
   LOADING & TRANSITIONS
   ============================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-bg-secondary);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.screen-transition {
    animation: screenFade 0.3s ease-out;
}

@keyframes screenFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

