/* --- FONTS & RESET --- */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --ink-color: #2c241b;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Courier Prime', monospace;
    color: var(--ink-color);
    background: url('assets/BG_PaperTexture.jpeg') center/cover no-repeat;
    overflow: hidden;
}

/* --- MAIN CONTAINER --- */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 95%;
    max-width: 800px; 
    height: 95vh; 
    padding: 20px 0;
}

/* --- RADIO SECTION (TOP) --- */
.radio-section {
    position: relative;
    width: 100%;
    flex: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.radio-image {
    width: 150%; 
    height: 150%; 
    background-image: url('assets/Radio_State_Default.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    margin-top: 50px; /* Espace entre le haut de la fenêtre et la radio */
}

.radio-image.active { 
    background-image: url('assets/Radio_State_Active.png'); 
}

/* --- TERMINAL SECTION (CADRE GLOBAL RÉTABLI) --- */
.terminal-section {
    position: relative;
    flex: 2; 
    min-height: 0; 
    display: flex;
    flex-direction: column;
    background-image: url('assets/Container_MainFrame.png');
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    background-position: center;
    /* Positionnement du texte à l'intérieur du cadre graphique */
    padding: 12% 8% 26% 10%; 
}

#chat-display {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    font-size: 1.1rem; 
    line-height: 1.5;
    padding-right: 10px;
    
    /* Scrollbar styling for Firefox */
    scrollbar-width: thin;
    scrollbar-color: #492f11 transparent;
}

/* Scrollbar styling for WebKit (Chrome, Safari, Edge) */
#chat-display::-webkit-scrollbar {
    width: 8px;
}

#chat-display::-webkit-scrollbar-track {
    background: transparent;
}

#chat-display::-webkit-scrollbar-thumb {
    background-color: #2c241b; /* Dark brown ink color */
    border-radius: 4px;
    border: 1px solid transparent; /* Optional: adds a bit of separation if needed */
}

.message { 
    white-space: pre-wrap; 
    margin-bottom: 15px; 
}

/* Rendu du GRAS */
.message strong {
    font-weight: 700;
    color: #000;
}

.timestamp {
    font-weight: bold;
    margin-right: 8px;
    opacity: 0.8;
}

/* --- ZONE DE SAISIE (RETOUR AU POSITIONNEMENT ABSOLU "AS BEFORE") --- */
#controls-area {
    position: absolute; 
    bottom: 9%; 
    left: 6%; 
    width: 92%; 
    height: 12%; 
    z-index: 10;
}

#message-form { 
    position: relative;
    width: 100%; 
    height: 100%; 
}

#message-input {
    position: absolute; 
    left: 0; 
    top: 5%; 
    width: 68%; 
    height: 90%; 
    background: transparent; 
    border: none; 
    padding: 0 15px; 
    font-family: inherit;
    font-size: 1.2rem; 
    color: #000;
    outline: none; /* Pas de cadre de focus bleu */
    box-shadow: none;
}

#message-input:focus {
    background: transparent;
    outline: none;
    box-shadow: none;
}

button {
    position: absolute; 
    right: 0; 
    top: 0; 
    width: 25%; 
    height: 115%; 
    background: url('assets/Button_State_Default.png') center/contain no-repeat;
    border: none !important;
    cursor: pointer;
    text-indent: -9999px;
}

button:active, button.pressed {
    background-image: url('assets/Button_State_Pressed.png');
    transform: scale(0.95);
}

button:disabled {
    filter: grayscale(100%);
    opacity: 0.5;
}

/* --- ANIMATIONS & UTILS --- */
.pulsing { animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.4; } }