/* /dart/public/assets/css/comm_chat.css (v3.0 - Modern UI) */

:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-header: rgba(30, 41, 59, 0.85); /* Transparenz für Glass-Effekt */
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #0ea5e9;           /* Helles Blau */
    --primary-gradient: linear-gradient(135deg, #0ea5e9, #2563eb);
    --bubble-me: #0ea5e9;
    --bubble-other: #334155;
    --accent-red: #f43f5e;
    --border: #334155;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --radius-bubble: 18px;
}

/* Update für /dart/public/assets/css/comm_chat.css */

/* Toggle-Button: Kompakt, unten rechts */
.comm-chat-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto !important; /* Verhindert volle Breite */
    max-width: 200px;       /* Sicherstellen, dass er nicht riesig wird */
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    background: var(--primary); /* Oder dein Verlauf von vorhin */
    color: white;
    border: none;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9998;
    cursor: pointer;
    transition: transform 0.2s, right 0.25s ease;
}

.comm-chat-toggle:hover {
    transform: scale(1.05);
}

/* Wenn Drawer offen ist, Button verschieben */
.comm-chat-toggle.drawer-open {
    right: calc(400px + 24px); 
    background: var(--bg-light);
    color: var(--text-muted);
}

.comm-chat-badge {
    display: none;
    background: var(--accent-red);
    color: white;
    border-radius: 99px;
    font-size: 0.75rem;
    padding: 0 6px;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.comm-chat-toggle.has-unseen .comm-chat-badge {
    display: inline-block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-3px);}
    60% {transform: translateY(-1.5px);}
}

/* --- Drawer Container --- */
.comm-chat-drawer {
    position: fixed;
    right: 0; top: 0; height: 100%;
    width: 400px; /* Etwas breiter für mehr Platz */
    max-width: 100vw;
    z-index: 9999;
    background: var(--bg-dark);
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 40px rgba(0,0,0,0.6);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.comm-chat-drawer.open { transform: translateX(0); }

/* --- Header (Glassmorphism) --- */
.comm-chat-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-header);
    backdrop-filter: blur(10px); /* Milchglas-Effekt */
    border-bottom: 1px solid var(--border);
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
    height: 60px;
    box-sizing: border-box;
}
.comm-chat-head .ttl { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.5px; }
.comm-chat-head-btn {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1.2rem; padding: 4px 8px;
    border-radius: 6px; transition: 0.2s;
}
.comm-chat-head-btn:hover { background: rgba(255,255,255,0.1); color: white; }

/* --- Chat Body --- */
.comm-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 80px 16px 20px 16px; /* Oben Platz für Header */
    display: flex; flex-direction: column; gap: 16px;
    background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 60%);
}

/* Custom Scrollbar */
.comm-chat-body::-webkit-scrollbar { width: 6px; }
.comm-chat-body::-webkit-scrollbar-track { background: transparent; }
.comm-chat-body::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
.comm-chat-body::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* --- Messages --- */
.comm-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0; transform: translateY(10px);
}
@keyframes slideIn { to { opacity: 1; transform: translateY(0); } }

/* Avatar Styles */
.comm-chat-avatar-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    margin-top: auto; /* Avatar unten am Nachrichtenblock */
}

.comm-chat-msg .bubble {
    padding: 10px 14px;
    border-radius: var(--radius-bubble);
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* My Messages */
.comm-chat-msg.me {
    align-self: flex-end;
    flex-direction: row-reverse; /* Avatar rechts */
}
.comm-chat-msg.me .bubble {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 2px;
}
.comm-chat-msg.me .comm-chat-meta { justify-content: flex-end; color: rgba(255,255,255,0.8); }
.comm-chat-msg.me a { color: white; text-decoration: underline; }

/* Other Messages */
.comm-chat-msg.other { align-self: flex-start; }
.comm-chat-msg.other .bubble {
    background: var(--bubble-other);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}
.comm-chat-msg.other a { color: var(--primary); }

/* Meta Info (Name/Time) */
.comm-chat-meta {
    font-size: 0.75rem; margin-bottom: 4px;
    display: flex; gap: 8px; opacity: 0.9;
}
.comm-chat-meta .author { font-weight: 700; }
.comm-chat-meta .timestamp { font-size: 0.7rem; opacity: 0.7; }

/* Actions (Delete) */
.comm-chat-actions { position: absolute; top: -10px; right: -10px; opacity: 0; transition: 0.2s; }
.comm-chat-msg:hover .comm-chat-actions { opacity: 1; }
.comm-chat-delete-btn {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 50%; width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; cursor: pointer; color: var(--accent-red);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* --- Footer --- */
.comm-chat-foot {
    padding: 16px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    display: flex; gap: 10px;
    align-items: center;
}
.comm-chat-foot input {
    flex-grow: 1;
    background: var(--bg-dark);
    color: white;
    border: 1px solid var(--border);
    border-radius: 24px; /* Pill Shape */
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.comm-chat-foot input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}
.comm-chat-foot .btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%; /* Runder Senden-Button */
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    padding-left: 4px; /* Optische Korrektur für das Icon */
}
.comm-chat-foot .btn:hover { filter: brightness(1.1); transform: scale(1.05); }
.comm-chat-foot .btn:disabled { background: var(--border); cursor: not-allowed; transform: none; }

.comm-chat-empty {
    margin: auto; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.comm-chat-empty::before { content: "💬"; font-size: 2rem; opacity: 0.5; }