/**
 * src/css/chat.css
 * Steuert die Chat-Übersicht und das aktive Nachrichten-Fenster.
 * REFACTORED: Nutzt Variablen und das goldene Scoring-System.
 * Fokus: Intuitive Sprechblasen, geschlechtsspezifische Farben und mobile Optimierung.
 */

/* ==========================================================================
   1. CHAT ÜBERSICHT (PARTNER-LISTE)
   ========================================================================== */

.chat-overview-container {
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

.chat-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-main);
    text-align: center;
}

.chat-partners-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-partner-card {
    display: flex;
    align-items: center;
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 15px;
}

.chat-partner-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
    border-color: var(--primary-green);
}

/* Avatar & Status */
.chat-avatar-container {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.match-heart-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 14px;
    background: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: 1px solid var(--gold);
}

/* Info Bereich */
.chat-info {
    flex-grow: 1;
    min-width: 0;
}

.chat-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-name {
    font-weight: 800;
    color: var(--text-main);
    font-size: 16px;
}

.chat-date {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-last-message {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-last-message.unread {
    color: var(--text-main);
    font-weight: 700;
}

/* Goldener Score Badge in der Liste */
.chat-score-badge {
    width: 45px;
    height: 45px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: var(--gold);
    font-size: 16px;
    background: var(--white);
    flex-shrink: 0;
}


/* ==========================================================================
   2. AKTIVES CHAT FENSTER
   ========================================================================== */

.active-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 700px;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    gap: 15px;
}

.chat-back-btn {
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
}

.chat-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-header-name {
    font-weight: 800;
    font-size: 16px;
}

.chat-header-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nachrichten Bereich */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #fcfcfc;
}

/* ==========================================================================
   3. SPRECHBLASEN (GENDER STYLES)
   ========================================================================== */

.message-wrapper {
    display: flex;
    width: 100%;
}

.message-wrapper.me { justify-content: flex-end; }
.message-wrapper.other { justify-content: flex-start; }

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 15px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* MEINE NACHRICHTEN (Rechts) */
.message.me {
    border-bottom-right-radius: 4px;
    color: var(--white);
}

/* Gender Colors für MICH */
.message.me.male { background-color: var(--faires-blue) !important; }
.message.me.female { background-color: var(--dating-pink) !important; }

/* PARTNER NACHRICHTEN (Links) */
.message.other {
    border-bottom-left-radius: 4px;
    background-color: var(--gray-100);
    color: var(--text-main);
}

/* Gender Colors für den ANDEREN (dezenter) */
.message.other.male { background-color: #e3f2fd !important; border: 1px solid #bbdefb; }
.message.other.female { background-color: #fdf2f8 !important; border: 1px solid #fce4ec; }

.message-time {
    font-size: 10px;
    margin-top: 5px;
    opacity: 0.7;
    text-align: right;
}

.message.me .message-time { color: rgba(255,255,255,0.8); }


/* ==========================================================================
   4. CHAT EINGABE (CONTROLS)
   ========================================================================== */

.chat-controls {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    gap: 12px;
}

#chat-message-input {
    flex-grow: 1;
    padding: 14px 20px;
    border-radius: 30px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    outline: none;
    font-size: 15px;
    transition: all 0.2s;
}

#chat-message-input:focus {
    background: var(--white);
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    background: var(--primary-green);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
    transition: transform 0.2s;
}

.chat-send-btn:active {
    transform: scale(0.9);
}

/* Block Notice */
.block-notice {
    width: 100%;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.block-notice.error {
    background: #fef2f2;
    color: var(--error);
}

/* ==========================================================================
   5. MOBILE OPTIMIERUNG
   ========================================================================== */

@media (max-width: 768px) {
    .active-chat-container {
        height: calc(100vh - 150px);
        max-height: none;
        border-radius: 0;
    }
    
    .message { max-width: 85%; }
    
    .chat-controls {
        padding: 10px 15px 25px 15px; /* Extra Padding für Home-Bar auf Mobile */
    }
}