/* ========== Overlay ========== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.overlay.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ========== Base Modal Styles ========== */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: linear-gradient(145deg, #ffffff, #f8f8f8);
    border-radius: 25px;
    padding: 30px;
    z-index: 1000;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 10px 20px rgba(0, 0, 0, 0.2),
        inset 0 2px 5px rgba(255, 255, 255, 0.9);
    display: none;
}

.modal.show {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff5252, #f44336);
    color: white;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}

.modal-close:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 12px rgba(244, 67, 54, 0.4);
}

.modal h2 {
    margin-bottom: 20px;
    color: #1e3a5f;
    font-size: 2em;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========== Settings Modal ========== */
#settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(245, 245, 245, 0.9));
    backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 25px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 80px rgba(76, 175, 80, 0.2);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: none;
    overflow-y: auto;
}

#settings-modal.show {
    display: block;
    animation: settingsBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes settingsBounce {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-5deg);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(76, 175, 80, 0.2);
}

.settings-header h2 {
    color: #4CAF50;
    font-size: 2em;
    margin: 0;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.settings-close {
    font-size: 1.5em;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-weight: bold;
}

.settings-close:hover {
    color: #ff5252;
    background: rgba(255, 82, 82, 0.1);
    transform: scale(1.1);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-section {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(76, 175, 80, 0.2);
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
}

.settings-section:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    color: #1e3a5f;
    font-size: 1.3em;
    margin: 0 0 15px 0;
    font-weight: 800;
}

.placeholder-text {
    color: #666;
    font-style: italic;
    margin: 0;
    line-height: 1.4;
}

.sound-controls {
    margin-top: 10px;
}

.sound-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sound-buttons {
    display: flex;
    gap: 8px;
}

.sound-btn {
    padding: 12px 16px;
    border: 2px solid #4CAF50;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(245, 245, 245, 0.8));
    color: #1e3a5f;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.2em;
    transition: all 0.3s ease;
    min-width: 50px;
    text-align: center;
}

.sound-btn:hover {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.sound-btn.active {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border-color: #45a049;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.4);
}

.sound-btn.active:hover {
    transform: translateY(-1px) scale(1.02);
}

/* Theme selector */
.theme-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.theme-btn {
    padding: 12px;
    border: 2px solid #ddd;
    background: linear-gradient(145deg, #ffffff, #f8f8f8);
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

.theme-btn.active {
    background: linear-gradient(145deg, #2196F3, #1976D2);
    color: white;
    border-color: #2196F3;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.4);
}

/* Reset button */
.reset-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(145deg, #ff5252, #f44336);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
    margin-top: 10px;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(244, 67, 54, 0.4);
}

.reset-btn:active {
    transform: translateY(0);
}

/* ========== Confirm Modal ========== */
#confirm-modal {
    width: 400px;
    text-align: center;
}

#confirm-modal .message {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.confirm-btn.yes {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.confirm-btn.yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

.confirm-btn.no {
    background: linear-gradient(145deg, #f5f5f5, #e8e8e8);
    color: #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.confirm-btn.no:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ========== Celebration Modal ========== */
.celebration-modal {
    background: linear-gradient(145deg, #fff9c4, #ffeb3b);
    border: 3px solid #ffd700;
    animation: celebrationPulse 2s ease-in-out infinite;
}

@keyframes celebrationPulse {
    0%, 100% {
        box-shadow: 
            0 25px 50px rgba(255, 215, 0, 0.4),
            0 10px 20px rgba(255, 215, 0, 0.3),
            0 0 40px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 
            0 25px 50px rgba(255, 215, 0, 0.5),
            0 10px 20px rgba(255, 215, 0, 0.4),
            0 0 60px rgba(255, 215, 0, 0.7);
    }
}

.celebration-content {
    text-align: center;
    color: #1e3a5f;
}

.celebration-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: celebrationBounce 1s ease-in-out infinite;
}

@keyframes celebrationBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

.celebration-stats {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

.stat-value {
    font-weight: 900;
    color: #1e3a5f;
    font-size: 1.1em;
}

/* ========== Game Over Modal ========== */
.game-over-modal {
    background: linear-gradient(145deg, #ffebee, #ffcdd2);
    border: 3px solid #f44336;
    width: 450px;
}

.game-over-content {
    text-align: center;
}

.game-over-icon {
    font-size: 3.5em;
    color: #f44336;
    margin-bottom: 20px;
}

.game-over-message {
    font-size: 1.8em;
    font-weight: 900;
    color: #f44336;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.final-stats {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.play-again-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.3em;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.3);
    margin-top: 20px;
    text-transform: uppercase;
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(76, 175, 80, 0.4);
}

/* ========== Toast Notifications ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(145deg, #323232, #424242);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    max-width: 80vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(145deg, #4CAF50, #45a049);
}

.toast.error {
    background: linear-gradient(145deg, #f44336, #d32f2f);
}

.toast.warning {
    background: linear-gradient(145deg, #ff9800, #f57c00);
}

/* ========== Tutorial Tooltip ========== */
.tutorial-tooltip {
    position: absolute;
    background: linear-gradient(145deg, #2196F3, #1976D2);
    color: white;
    padding: 15px 20px;
    border-radius: 15px;
    font-weight: 600;
    box-shadow: 
        0 8px 20px rgba(33, 150, 243, 0.4),
        0 0 0 3px rgba(255, 255, 255, 0.3);
    z-index: 1002;
    max-width: 250px;
    animation: tooltipBounce 2s ease-in-out infinite;
}

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

.tutorial-tooltip::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #1976D2;
}

.tutorial-tooltip.top::before {
    bottom: auto;
    top: -10px;
    transform: translateX(-50%) rotate(180deg);
}

/* ========== Victory Message Modal ========== */
.victory-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.3),
        0 0 100px rgba(76, 175, 80, 0.2);
    text-align: center;
    z-index: 1000;
    max-width: 450px;
    width: 90%;
    display: none;
}

.victory-message.show {
    display: block;
    animation: victoryBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes victoryBounce {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(180deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

.victory-message h2 {
    color: #4CAF50;
    font-size: 2.2em;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
    font-weight: 900;
}

/* ========== Shop Modal Specific Styles ========== */
#shop-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(245, 245, 245, 0.9));
    backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 25px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 80px rgba(76, 175, 80, 0.2);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: none;
    overflow-y: auto;
}

#shop-modal.show {
    display: block;
    animation: settingsBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(249, 47, 96, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.shop-item:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(249, 47, 96, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.shop-item.premium {
    border-color: rgba(255, 193, 7, 0.4);
    background: linear-gradient(145deg, rgba(255, 248, 225, 0.9), rgba(255, 243, 205, 0.9));
}

.shop-item.premium:hover {
    border-color: rgba(255, 193, 7, 0.6);
    background: linear-gradient(145deg, rgba(255, 248, 225, 1), rgba(255, 243, 205, 1));
}

.shop-item-info {
    display: flex;
    align-items: center;
    flex: 1;
    margin-right: 20px;
}

.shop-item-icon {
    font-size: 2.5em;
    margin-right: 15px;
    min-width: 60px;
    text-align: center;
}

.shop-item-details h4 {
    color: #1e3a5f;
    font-size: 1.3em;
    margin: 0 0 8px 0;
    font-weight: 800;
}

.shop-item-details p {
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.4;
    font-size: 0.95em;
}

.shop-item-owned {
    color: #4CAF50;
    font-weight: 700;
    font-size: 0.9em;
}

.shop-item-purchase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 120px;
}

.shop-item-price {
    font-size: 1.4em;
    font-weight: 900;
    color: #4ade80;
    text-align: center;
}

.shop-item-price.premium-price {
    color: #ff9800;
    font-size: 1.6em;
}

.shop-buy-btn {
    background: linear-gradient(145deg, #4ade80, #16a34a);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(249, 47, 96, 0.3);
}

.shop-buy-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(249, 47, 96, 0.4);
}

.shop-buy-btn:disabled {
    background: linear-gradient(145deg, #ccc, #bbb);
    cursor: not-allowed;
    color: #777;
    box-shadow: none;
}

.shop-buy-btn.premium-btn {
    background: linear-gradient(145deg, #ff9800, #f57c00);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.3);
}

.shop-buy-btn.premium-btn:hover:not(:disabled) {
    box-shadow: 0 6px 12px rgba(255, 152, 0, 0.4);
}

.premium-status {
    color: #ff9800;
    font-weight: 700;
}

/* Insufficient funds styling */
.shop-buy-btn.insufficient-funds {
    background: linear-gradient(145deg, #f44336, #d32f2f);
    cursor: not-allowed;
}

.shop-buy-btn.insufficient-funds:hover {
    transform: none;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}

/* Success purchase animation */
.shop-item.purchased {
    background: linear-gradient(145deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    border-color: rgba(76, 175, 80, 0.4);
}

.shop-buy-btn.purchased {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .shop-item {
        flex-direction: column;
        text-align: center;
    }
    
    .shop-item-info {
        margin-right: 0;
        margin-bottom: 15px;
        flex-direction: column;
    }
    
    .shop-item-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .shop-item-purchase {
        min-width: auto;
        width: 100%;
    }
    
    .shop-buy-btn {
        width: 100%;
        padding: 15px;
    }
} 