/*
* Filename: chat.css
* Directory: /www/css/
* Description: Stiler for meldingssystemet.
*/

.chat-layout {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Liste 1 del, Chat 2 deler */
    gap: 20px;
    height: 70vh; /* Høyde på vinduet */
    min-height: 500px;
}

/* --- Venstre side: Kontaktliste --- */
.contact-sidebar {
    border-right: 1px solid #eee;
    padding-right: 20px;
    display: flex;
    flex-direction: column;
}

.add-contact-box {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.contact-list {
    overflow-y: auto;
    flex-grow: 1;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.contact-card:hover {
    background: #f9f9f9;
    border-color: #eee;
}

.contact-card.active {
    background: #e3f2fd; /* Lys blå for aktiv */
    border-color: #bbdefb;
}

.mini-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.contact-info {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    display: inline-block;
    width: fit-content;
    margin-top: 2px;
}
.badge.warning { background: #f39c12; }
.badge.success { background: #27ae60; }

/* Knapper i listen */
.action-btn-group {
    margin-left: auto; /* Skyv til høyre */
    display: flex;
    gap: 5px;
}
.btn-xs {
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
}
.btn-accept { background: #27ae60; color: white; }
.btn-delete { background: #e74c3c; color: white; }


/* --- Høyre side: Chatvindu --- */
.chat-window {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.chat-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    color: #2c3e50;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #fdfdfd;
}

.msg-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 70%;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.msg-mine {
    align-self: flex-end;
    background: #003300; /* WEBoracle grønn */
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-theirs {
    align-self: flex-start;
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 25px;
    outline: none;
}
.chat-input-area input:focus {
    border-color: #003300;
}

/* Mobil-tilpasning */
@media (max-width: 768px) {
    .chat-layout { grid-template-columns: 1fr; }
    .contact-sidebar { border-right: none; border-bottom: 1px solid #eee; height: 200px; }
}