/* Uued CSS muutujad */
:root {
    --rd-accent-blue: #1e90ff; /* Kasutaja sõnumi taust (sinine) */
    --rd-accent-blue-light: #41a0ff;
    --rd-offline-red: #cc0000; /* Punane teadete jaoks */
    --rd-primary-bg: #e1e1e1; /* Lehe peamine taust */
}

/* Üldised stiilid */
UNKNOWN {
	FONT-SIZE: 10pt; 
    COLOR: #000000; 
    FONT-FAMILY: verdana
}

TD {
	FONT-SIZE: 10px; 
    COLOR: #000000; 
    FONT-FAMILY: verdana
}

/* Lingi stiilid */
A:link {
	COLOR: #000000; 
    FONT-FAMILY: verdana; 
    TEXT-DECORATION: none
}
A:visited {
	COLOR: #000000; 
    FONT-FAMILY: verdana; 
    TEXT-DECORATION: none
}
A:active {
	FONT-FAMILY: verdana; 
    TEXT-DECORATION: none
}
A:hover {
	COLOR: #808080; 
    TEXT-DECORATION: none
}

/* ---------------------------------------------------- */
/* --- SÕNUMI IKOONI JA MODAALI STIILID (Lauaarvuti) --- */
/* ---------------------------------------------------- */
 
/* Fikseeritud Sõnumi nupp (all paremal) */
.message-icon-fixed {
    position: fixed; 
    bottom: 15px;      
    right: 15px;      
    display: block;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
background-color: #7e8285;
    color: white;
    border-radius: 50%; 
    font-size: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 2000; /* Väga kõrge, et oleks alati nähtav */
    border: none; 
    cursor: pointer;
}

.message-icon-fixed i {
    margin: 0;
    vertical-align: middle;
}

.message-icon-fixed:hover {
    background-color: var(--rd-accent-blue-light); 
    transform: scale(1.05);
}
 
/* --- SÕNUMI MODAAL (Lauaarvuti: aken) --- */
.message-modal {
    display: flex; 
    position: fixed; 
    bottom: 80px; 
    right: 20px;
    width: 320px;
    height: 450px; 
    background: #f0f0f0; 
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 1999; 
    overflow: hidden;
    flex-direction: column; 
    transform: scale(0.9); 
    opacity: 0;
    transition: all 0.3s ease-out; 
}
 
/* Peida vaikimisi */
.message-modal:not(.is-open) {
    display: none;
}

/* Modal on avatud (nähtav) */
.message-modal.is-open {
    display: flex;
    transform: scale(1);
    opacity: 1;
}

/* Modali Päis */
.modal-header {
    background: #e0e0e0;
    color: #333;
    padding: 15px 10px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; 
}

.modal-header .close-btn {
    cursor: pointer;
    font-size: 20px;
    color: #777;
    padding: 0 5px;
    line-height: 1;
}
 
/* Offline indikaator VESTLUSAKNAS */
#offlineIndicator {
    background-color: var(--rd-offline-red); 
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    text-align: center;
    display: none; 
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Modali Sisu (Tervitusvaade) */
.modal-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    background: white; 
    overflow: hidden; 
}

.start-chat-button {
    background: #ccc; 
    color: #333;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.2s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}
.start-chat-button:hover {
    background: #bbb;
}
 
/* Sõnumivaate konteiner */
#chatView {
    height: 100%; 
    flex-direction: column;
    display: flex;
    overflow: hidden; 
}
 
/* Sõnumi Logi (kus on tegelik scroll) */
#messageLog {
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 10px; 
    background: #fff; 
    display: flex; 
    flex-direction: column;
}
 
/* Sisestusvälja sees olev SAADA nupp */
#sendButton {
    background: var(--rd-accent-blue) !important; 
    color: white !important;
    border: none !important; 
    padding: 0 15px !important; 
    border-radius: 4px !important; 
    font-weight: bold !important; 
    cursor: pointer !important;
    transition: background 0.2s; 
}
 
#sendButton:hover:not(:disabled) {
    background: var(--rd-accent-blue-light) !important;
}

/* Globaalne indikaator lehe ülaosas */
#globalOfflineIndicator {
    background-color: var(--rd-offline-red); 
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    text-align: center;
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ---------------------------------------------------- */
/* --- JALUSE LIPU/IKSOONIDE STIILID (Flag Icon CSS + Font Awesome) --- */
/* ---------------------------------------------------- */

.footer-flag-icon-container {
    position: absolute;
    left: 10px; 
    top: 50%; 
    transform: translateY(-50%); 
    display: flex;
    align-items: center;
    gap: 12px; /* SUURENDAME VAHE 12 PIKSLILE, et vahe oleks selge */
    z-index: 10; 
}

/* Anname lipu linkidele marginaali, et tagada eraldatus */
.footer-flag-icon-container a {
    display: flex;
    align-items: center;
    line-height: 1; 
    transition: opacity 0.2s;
    /* margin-right: 12px; - Seda ei ole vaja, sest kasutame GAP-i, aga see oleks alternatiiv */
}

.footer-flag-icon-container a:hover {
    opacity: 0.7; 
}

/* Lipu ikoonide (flag-icon) stiil */
.flag-icon {
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); 
}

/* Sotsiaalmeedia (Facebook) ikooni stiil */
.social-icon {
    font-size: 20px; 
    color: #3b5998; 
}

/* Mobiili optimeerimine */
@media (max-width: 600px) {
    .footer-flag-icon-container {
        left: 5px; 
        gap: 8px; /* Mobiilis veidi väiksem vahe, aga ikkagi selge */
    }
    
    .social-icon {
        font-size: 24px; 
    }
}

/* ================================================= */
/* --- MOBIILI OPTIMEERIMINE (MAKS LAIUS 600px) --- */
/* ================================================= */

@media (max-width: 600px) {
    /* Modal avaneb täisekraanile, et tippimine oleks mugavam */
    .message-modal {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw; /* Kogu vaateava laius */
        height: 100vh; /* Kogu vaateava kõrgus */
        border-radius: 0; /* Eemalda ümarad nurgad */
        border: none;
        transform: scale(0.9);
    }
    
    /* Avatud modal venitatakse kohe täisekraanile */
    .message-modal.is-open {
        transform: scale(1);
    }

    /* Suurendame teksti sisendit mobiilis natuke */
    #chatInput {
        font-size: 16px !important; 
    }

    /* Mobiili jaluses nihutame lippu servale lähemale */
    .footer-flag-icon-container {
        left: 5px; 
    }
}
