/**
 * Amaga.Club Trading Game - Enhanced Styles
 */

/* =============================================================================
   GAME SETTINGS PANEL - CENTERED AND STYLED
   ============================================================================= */
.game-settings {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 247, 255, 0.9));
    border-radius: 16px;
    border: 1px solid rgba(58, 123, 213, 0.15);
    box-shadow: 0 4px 15px rgba(58, 123, 213, 0.08);
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.setting-group:hover {
    box-shadow: 0 4px 12px rgba(58, 123, 213, 0.12);
    transform: translateY(-1px);
}

.setting-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-select {
    padding: 10px 16px;
    border-radius: 10px;
    border: 2px solid #e8eef5;
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
}

.setting-select:hover {
    border-color: var(--primary-color);
    background: white;
}

.setting-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(58, 123, 213, 0.15);
}

.setting-btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: 2px solid #e8eef5;
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-btn:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(58, 123, 213, 0.3);
}

.setting-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
}

/* =============================================================================
   LANGUAGE SELECTOR WITH FLAGS
   ============================================================================= */
.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 20px;
}

.language-selector .setting-select {
    padding: 8px 12px;
    min-width: auto;
    font-size: 13px;
    background: white;
    border: 1px solid #ddd;
}

/* Flag icons styling */
.flag-icon {
    width: 20px;
    height: 15px;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Language buttons with flags */
.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(58, 123, 213, 0.2);
}

.lang-btn .flag {
    font-size: 16px;
    line-height: 1;
}

/* =============================================================================
   STREAK DISPLAY
   ============================================================================= */
.dashboard-item.streak .dashboard-value {
    color: var(--warning-color);
}

.streak-fire {
    display: inline-block;
    animation: flicker 0.5s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

/* =============================================================================
   ACHIEVEMENT NOTIFICATION
   ============================================================================= */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #333;
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(255, 170, 0, 0.3);
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-notification.show {
    transform: translateX(0);
}

.achievement-notification .achievement-icon {
    font-size: 32px;
    animation: bounce 0.6s infinite alternate;
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

.achievement-notification .achievement-info {
    display: flex;
    flex-direction: column;
}

.achievement-notification .achievement-title {
    font-weight: 600;
    font-size: 16px;
}

.achievement-notification .achievement-desc {
    font-size: 13px;
    opacity: 0.8;
}

/* =============================================================================
   ACHIEVEMENTS MODAL
   ============================================================================= */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
}

.achievement-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.achievement-card.unlocked {
    border-color: #ffd700;
    background: linear-gradient(135deg, #fffef0, #fff9db);
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-card .achievement-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.achievement-card .achievement-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
}

.achievement-card .achievement-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* =============================================================================
   LEADERBOARD MODAL
   ============================================================================= */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.leaderboard-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
}

.leaderboard-table tr:nth-child(1) td {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #333;
    font-weight: 600;
}

.leaderboard-table tr:nth-child(2) td {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #333;
}

.leaderboard-table tr:nth-child(3) td {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    color: white;
}

.player-best {
    padding: 20px;
    text-align: center;
    background: var(--bg-color);
    border-radius: 12px;
    margin-top: 20px;
}

.player-best-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.player-best-score {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

/* =============================================================================
   DIFFICULTY INDICATORS
   ============================================================================= */
.difficulty-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
}

.difficulty-badge.easy {
    background: #e8f5e9;
    color: #2e7d32;
}

.difficulty-badge.medium {
    background: #fff3e0;
    color: #ef6c00;
}

.difficulty-badge.hard {
    background: #ffebee;
    color: #c62828;
}

/* =============================================================================
   GAME MODE INDICATORS
   ============================================================================= */
.game-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.game-mode-badge i {
    font-size: 10px;
}

/* =============================================================================
   SOUND TOGGLE
   ============================================================================= */
.sound-toggle {
    position: relative;
}

.sound-toggle.muted i {
    opacity: 0.5;
}

/* =============================================================================
   CHART IMPROVEMENTS - SMA LINE
   ============================================================================= */
.chart-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.indicator-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}

.indicator-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

.indicator-line.price {
    background: var(--chart-line);
}

.indicator-line.sma {
    background: rgba(255, 193, 7, 0.8);
}

/* =============================================================================
   KEYBOARD SHORTCUTS IMPROVED
   ============================================================================= */
.keyboard-shortcuts {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 10;
}

.keyboard-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    min-width: 150px;
    margin-bottom: 10px;
}

.keyboard-shortcuts:hover .keyboard-tooltip {
    display: block;
}

.keyboard-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 12px;
}

.keyboard-key {
    background: #eee;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
}

/* =============================================================================
   MODAL IMPROVEMENTS
   ============================================================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

/* =============================================================================
   RESPONSIVE IMPROVEMENTS
   ============================================================================= */
@media (max-width: 768px) {
    .game-settings {
        flex-direction: column;
        gap: 10px;
    }
    
    .setting-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .setting-select,
    .setting-btn {
        flex: 1;
    }
    
    .achievement-notification {
        left: 10px;
        right: 10px;
        transform: translateY(-120%);
    }
    
    .achievement-notification.show {
        transform: translateY(0);
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .language-selector {
        display: none;
    }
}

/* =============================================================================
   EXTRA GAME BUTTONS
   ============================================================================= */
.game-extra-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.extra-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(58, 123, 213, 0.1);
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.extra-btn:hover {
    background: var(--primary-color);
    color: white;
}

.extra-btn i {
    font-size: 14px;
}

/* =============================================================================
   PRICE MARKERS IMPROVED
   ============================================================================= */
.price-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    animation: markerPulse 1s infinite;
}

.price-marker.buy {
    background: var(--success-color);
    box-shadow: 0 0 10px rgba(0, 200, 83, 0.5);
}

.price-marker.sell {
    background: var(--danger-color);
    box-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

.price-marker.result {
    background: var(--secondary-color);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

@keyframes markerPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

.marker-label {
    position: absolute;
    transform: translate(-50%, -150%);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    z-index: 101;
    white-space: nowrap;
}

.marker-label.buy {
    background: var(--success-color);
}

.marker-label.sell {
    background: var(--danger-color);
}

.marker-label.result {
    background: var(--secondary-color);
}

/* =============================================================================
   RESULT CONTAINER IMPROVED
   ============================================================================= */
.result-container {
    display: none;
    padding: 15px 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
    animation: resultSlideIn 0.3s ease;
}

@keyframes resultSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-container.win {
    background: linear-gradient(135deg, rgba(0, 200, 83, 0.1), rgba(0, 200, 83, 0.2));
    color: #2e7d32;
    border: 1px solid rgba(0, 200, 83, 0.3);
}

.result-container.loss {
    background: linear-gradient(135deg, rgba(255, 82, 82, 0.1), rgba(255, 82, 82, 0.2));
    color: #c62828;
    border: 1px solid rgba(255, 82, 82, 0.3);
}

/* =============================================================================
   TIMER OVERLAY - CENTERED ON CHART
   ============================================================================= */
.chart-timer-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
    align-items: center;
    font-size: 80px;
    font-weight: 700;
    color: rgba(58, 123, 213, 0.35);
    z-index: 50;
    text-shadow: 0 4px 20px rgba(58, 123, 213, 0.2);
    pointer-events: none;
}

.chart-timer-overlay.visible {
    display: flex;
    animation: timerPulse 1s infinite ease-in-out;
}

@keyframes timerPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* =============================================================================
   PAUSED OVERLAY IMPROVED
   ============================================================================= */
.paused-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    z-index: 60;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    cursor: pointer;
}

.paused-overlay i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.paused-overlay p {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* =============================================================================
   TRADE LOG IMPROVEMENTS
   ============================================================================= */
.trade-log {
    width: 100%;
    border-collapse: collapse;
}

.trade-log th,
.trade-log td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.trade-log th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.trade-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.trade-type.buy {
    background: rgba(0, 200, 83, 0.1);
    color: #2e7d32;
}

.trade-type.sell {
    background: rgba(255, 82, 82, 0.1);
    color: #c62828;
}

.trade-win {
    color: #2e7d32;
    font-weight: 600;
}

.trade-loss {
    color: #c62828;
    font-weight: 600;
}
