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

:root {
    --primary-color: #00ffd5;
    --secondary-color: #00b8ff;
    --background-color: #0f1729;
    --surface-color: #1a2438;
    --text-color: #e0e7ff;
    --accent-color: #00ffd5;
    --pink-accent: #ff00a0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle, rgba(255,121,198,0.1) 2px, transparent 40px),
        radial-gradient(circle, rgba(100,255,218,0.1) 1px, transparent 30px),
        radial-gradient(circle, rgba(77,208,225,0.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
}

#game-container {
    width: 100vw;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    background-color: rgba(26, 36, 56, 0.9);
    display: flex;
    flex-direction: column;
    border: 2px solid var(--secondary-color);
    box-shadow: 0 0 20px var(--secondary-color), inset 0 0 20px var(--secondary-color);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--pink-accent);
    font-family: 'Orbitron', sans-serif;
}

#account {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

h2, h3 {
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--secondary-color);
}

#balance-container {
    display: flex;
    align-items: center;
    background: linear-gradient(45deg, rgba(0, 255, 213, 0.2), rgba(255, 0, 160, 0.2));
    border: 1px solid var(--secondary-color);
    border-radius: 20px;
    padding: 5px 15px;
    box-shadow: 0 0 10px var(--secondary-color);
}

#balance-label {
    font-size: 1em;
    color: var(--text-color);
    margin-right: 10px;
}

#balance {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--secondary-color);
}

#day-counter {
    font-size: 1.2em;
    color: var(--accent-color);
    text-shadow: 0 0 5px var(--secondary-color);
}

#trader {
    display: flex;
    align-items: center;
}

#trader-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid var(--pink-accent);
    box-shadow: 0 0 10px var(--secondary-color);
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meter {
    width: 100px;
    height: 8px;
    background-color: rgba(224, 231, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-in-out, background-color 0.5s ease;
}

#mood-fill { background-color: var(--accent-color); }
#stress-fill { background-color: var(--pink-accent); }
#satiety-fill { background-color: var(--secondary-color); }

main {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 1fr;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
    padding: 20px 0;
}

section {
    background-color: rgba(26, 36, 56, 0.8);
    padding: 15px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 0 0 15px rgba(0, 255, 213, 0.2);
    border: 1px solid var(--secondary-color);
}

#news-container {
    position: relative;
    height: 100%;
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

#journalist-portrait {
    width: 80px;
    height: 80px; /* Fixe la hauteur pour correspondre à la largeur */
    object-fit: cover; /* Assure que l'image remplit le carré sans déformation */
    margin-right: 15px;
    border: 2px solid var(--pink-accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--secondary-color);
    transition: all 0.3s ease;
    align-self: flex-start; /* Aligne le portrait en haut */
}

#news-content {
    flex: 1;
    padding: 15px;
    background-color: rgba(0, 184, 255, 0.1);
    border-radius: 12px;
    border: 1px solid var(--secondary-color);
    box-shadow: 0 0 10px rgba(0, 184, 255, 0.2);
    transition: all 0.3s ease;
    min-height: 80px; /* Assure une hauteur minimale égale à celle du portrait */
    display: flex;
    align-items: center; /* Centre verticalement le contenu */
}

#reveal-news-button {
    z-index: 11; /* Assurez-vous que le bouton est au-dessus du cover */
}

#assets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px; /* Ajoute un espace supplémentaire au-dessus des actifs */
}

.asset-item {
    background-color: rgba(0, 184, 255, 0.1);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--secondary-color);
    box-shadow: 0 0 5px var(--secondary-color);
}

.asset-item:hover {
    background-color: rgba(0, 184, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 184, 255, 0.3);
}

.asset-item h4 {
    margin: 0 0 5px 0;
    font-size: 1em;
    color: var(--accent-color);
}

.asset-item p {
    margin: 2px 0;
    font-size: 0.9em;
}

.asset-item p:last-child {
    color: var(--accent-color);
    font-weight: bold;
}

#ai-traders {
    order: -1;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-trader {
    background-color: rgba(255, 0, 160, 0.1);
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--pink-accent);
    box-shadow: 0 0 5px var(--secondary-color);
    transition: all 0.3s ease;
}

.ai-trader:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 160, 0.3);
}

.ai-trader h4 {
    margin: 0 0 5px 0;
    color: var(--pink-accent);
    font-size: 1em;
}

.ai-trader p {
    margin: 2px 0;
    font-size: 0.9em;
}

.ai-assets {
    margin-top: 5px;
    font-size: 0.8em;
}

#trading {
    display: flex;
    flex-direction: column;
}

#selected-asset {
    margin-bottom: 15px;
}

#selected-asset-name {
    font-size: 1.2em;
    color: var(--accent-color);
    margin: 0 0 5px 0;
}

#selected-asset-price {
    font-size: 1em;
    margin: 0 0 10px 0;
}

#selected-asset-chart {
    width: 100%;
    height: 200px;
    margin-bottom: 15px;
}

#trading-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.quantity-selector {
    display: flex;
    align-items: center;
}

.quantity-selector button {
    padding: 5px 10px;
    font-size: 14px;
    border: none;
    background-color: var(--primary-color);
    color: var(--background-color);
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.quantity-selector button:hover {
    background-color: var(--pink-accent);
}

#quantity-input {
    width: 60px;
    text-align: center;
    font-size: 16px;
    margin: 0 10px;
    padding: 5px;
    border: 2px solid var(--accent-color);
    background-color: rgba(0, 255, 213, 0.1);
    color: var(--text-color);
    border-radius: 25px;
    outline: none;
    transition: all 0.3s ease;
}

#quantity-input:focus {
    border-color: var(--pink-accent);
    box-shadow: 0 0 10px rgba(255, 0, 160, 0.3);
}

/* Supprimez les styles pour #quantity-display car nous ne l'utilisons plus */

.action-buttons button {
    padding: 5px 10px;
    font-size: 14px;
    border: none;
    background-color: var(--primary-color);
    color: var(--background-color);
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.action-buttons button:hover {
    background-color: var(--pink-accent);
}

#transaction-history {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: rgba(0, 255, 213, 0.1);
    border-radius: 12px;
}

.transaction-item {
    padding: 5px;
    border-bottom: 1px solid rgba(255, 105, 180, 0.2);
    font-size: 0.9em;
}

footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--secondary-color);
}

#activities {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#activities button {
    flex: 1 1 calc(25% - 10px);
    padding: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: rgba(0, 184, 255, 0.1);
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#activities button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(0, 255, 213, 0.2),
        transparent
    );
    transition: all 0.5s;
}

#activities button:hover {
    background-color: rgba(0, 255, 213, 0.2);
    color: var(--text-color);
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 255, 213, 0.3);
}

#activities button:hover::before {
    left: 100%;
}

#activities button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 255, 213, 0.3);
}

/* Stylisation globale des scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--pink-accent) rgba(0, 0, 0, 0.1);
}

*::-webkit-scrollbar {
    width: 6px;
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 10px;
}

/* Supprimez ou commentez ces lignes car elles sont maintenant redondantes */
/*
.scrollable::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.scrollable::-webkit-scrollbar-thumb {
    background-color: var(--pink-accent);
    border-radius: 3px;
}

.scrollable {
    scrollbar-width: thin;
    scrollbar-color: var(--pink-accent) rgba(0, 0, 0, 0.1);
}
*/

@keyframes glowPulse {
    0% { text-shadow: 0 0 5px var(--accent-color); }
    50% { text-shadow: 0 0 20px var(--accent-color), 0 0 30px var(--secondary-color); }
    100% { text-shadow: 0 0 5px var(--accent-color); }
}

.glow {
    animation: glowPulse 2s infinite;
}

#news, #trading {
    flex: 1;
}

#selected-asset-chart {
    width: 100%;
    height: 200px;
}

#news-container {
    position: relative;
    height: 100%;
}

#news-content {
    position: relative;
    padding: 10px;
}

#show-leaderboard {
    padding: 10px 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: rgba(0, 184, 255, 0.1);
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#show-leaderboard:hover {
    background-color: rgba(0, 255, 213, 0.2);
    color: var(--text-color);
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 255, 213, 0.3);
}

#show-leaderboard:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 255, 213, 0.3);
}
#submit-score:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.leaderboard-content {
    background-color: var(--surface-color);
    border: 2px solid var(--accent-color);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 20px var(--accent-color);
}

.leaderboard-content h2, .leaderboard-content h3 {
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.final-score {
    font-size: 1.2em;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-color);
}

#leaderboard {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(0, 255, 213, 0.1);
    border-radius: 10px;
}

#leaderboard ol {
    list-style-type: none;
    padding: 0;
}

#leaderboard li {
    padding: 10px;
    margin-bottom: 5px;
    background-color: rgba(0, 184, 255, 0.1);
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#leaderboard li:nth-child(even) {
    background-color: rgba(0, 255, 213, 0.1);
}

.submit-score-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#player-name {
    flex-grow: 1;
    padding: 10px;
    font-size: 1em;
    background-color: rgba(0, 184, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    color: var(--text-color);
}

.glow-button {
    padding: 10px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: rgba(0, 184, 255, 0.1);
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.glow-button:hover {
    background-color: rgba(0, 255, 213, 0.2);
    color: var(--text-color);
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 255, 213, 0.3);
}

.glow-button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 255, 213, 0.3);
}

#submit-score:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#close-leaderboard {
    display: block;
    margin: 0 auto;
}

@media screen and (max-width: 768px) {
    body {
        font-size: 12px;
    }

    #game-container {
        padding: 5px;
    }

    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 5px;
        padding: 5px 0;
    }

    #account {
        flex-direction: row;
        align-items: center;
        gap: 5px;
    }

    #trader {
        flex-direction: row;
        align-items: center;
        gap: 5px;
    }

    #trader-avatar {
        width: 30px;
        height: 30px;
        margin: 0;
    }

    main {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    #ai-traders {
        order: 0;
        max-width: 100%;
    }

    .ai-trader {
        margin-bottom: 10px;
        padding: 5px;
    }

    #trading-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }

    .quantity-selector {
        width: auto;
        justify-content: flex-start;
    }

    .action-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .action-buttons button {
        padding: 5px;
        font-size: 0.8em;
        margin: 0;
    }

    #activities {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }

    #activities button {
        flex: 0 1 calc(33.33% - 5px);
        padding: 5px;
        font-size: 0.8em;
    }

    .leaderboard-content {
        padding: 10px;
    }

    .submit-score-container {
        flex-direction: row;
        gap: 5px;
    }

    #player-name, #submit-score {
        width: auto;
    }

    #leaderboard {
        max-height: 150px;
    }
}

@media screen and (max-width: 480px) {
    body {
        font-size: 10px;
    }

    #balance-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    #balance-label {
        margin: 0;
    }

    .stats-container {
        width: auto;
    }

    .stat-row {
        justify-content: flex-start;
        gap: 5px;
    }

    .meter {
        width: 60px;
    }

    #selected-asset-chart {
        height: 120px;
    }

    #activities button {
        font-size: 0.7em;
        padding: 5px;
    }
}