@import url('body.css');
@import url('floatingbuttons.css');
@import url('kopf.css');
@import url('teilenbutton.css');
@import url('fuss.css');
@import url('menue.css');
@import url('rahmen.css');
@import url('base.css');
@import url('tabs.css');
@import url('buttons.css');
@import url('inputfelder.css');
@import url('registration.css');
@import url('suchfeld.css');
@import url('sharebutton.css');
@import url('ergebnisrahmen.css');

/* ergebnisrahmen.css am Ende für höchste Priorität */
a:hover,
.ergebnis-link:hover {
    background: none !important;
}

/* Profil Button Layout für Mitgliederliste */
.btn-profil {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-bottom: 1em;
    padding: 1em;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    flex-wrap: wrap;
    word-break: break-word;
    overflow: hidden;
}

.profil-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.profil-avatar-placeholder {
    color: #888;
    background: #eee;
}

.profil-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 0%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.profil-name {
    font-weight: bold;
    font-size: 1.1em;
}

.profil-firma {
    font-size: 0.9em;
    color: #888;
}

.profil-link {
    margin-top: 0.5em;
    font-size: 0.95em;
    color: #0077cc;
}

@media (prefers-color-scheme: dark) {
    .btn-profil {
        background: #1e1e1e;
        color: #e0e0e0;
    }

    .btn-profil:hover {
        background: #131313;
    }

    .profil-avatar {
        background: #444;
    }

    .profil-avatar-placeholder {
        color: #bbb;
        background: #444;
    }

    .profil-firma {
        color: #bbb;
    }

    .profil-link {
        color: #4fa3ff;
    }
}

/* ========================
   Card-basierte Nachrichtenliste (Modern & Responsive)
   ======================== */
.nachrichten-liste {
    display: flex;
    flex-direction: column;
    gap: 1em;
    width: 100%;
}

.nachricht-card {
    border: 1px solid var(--color-border-light, #ddd);
    border-radius: 8px;
    background: var(--color-btn-bg-light, #fff);
    padding: 1em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.nachricht-card:hover {
    border-color: var(--color-link, #0077cc);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.nachricht-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8em;
    border-bottom: 1px solid var(--color-border-light, #eee);
    padding-bottom: 0.8em;
    flex-wrap: wrap;
    gap: 0.5em;
}

.nachricht-datum {
    font-size: 0.95em;
    color: var(--color-text, #333);
}

.nachricht-richtung {
    font-size: 0.85em;
    font-weight: bold;
    padding: 0.3em 0.6em;
    border-radius: 4px;
    background: #f0f0f0;
    color: #666;
}

.nachricht-richtung.gesendet {
    background: #e8f4f8;
    color: #0066aa;
}

.nachricht-richtung.erhalten {
    background: #f8e8f0;
    color: #aa0066;
}

.nachricht-card-body {
    margin-bottom: 0.8em;
}

.nachricht-person {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.5em;
    font-size: 0.95em;
}

.nachricht-person .label {
    font-weight: bold;
    min-width: 40px;
    color: #666;
}

.nachricht-person a {
    color: var(--color-link, #0077cc);
    text-decoration: none;
}

.nachricht-person a:hover {
    text-decoration: underline;
}

.nachricht-card-footer {
    display: flex;
    gap: 0.5em;
}

.nachricht-card .btn {
    flex: 1;
    text-align: center;
    padding: 0.5em 1em;
}

/* ========================
   Filter-Buttons
   ======================== */
.nachricht-filter {
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
    margin-bottom: 1.5em;
}

.filter-btn {
    padding: 0.6em 1.2em;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--color-link, #0077cc);
    color: var(--color-link, #0077cc);
}

.filter-btn.active {
    background: var(--color-link, #0077cc);
    border-color: var(--color-link, #0077cc);
    color: #fff;
}

/* ========================
   Nachricht-Vorschau
   ======================== */
.nachricht-vorschau {
    margin-top: 0.8em;
    padding: 0.8em;
    background: #f9f9f9;
    border-left: 3px solid var(--color-link, #0077cc);
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.4;
    color: #555;
    max-height: 60px;
    overflow: hidden;
}

/* ========================
   Nachricht-Text (Detail-Ansicht)
   ======================== */
.nachricht-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    background: #fafafa;
    padding: 1em;
    border-radius: 6px;
    border-left: 3px solid #0077cc;
    color: #333;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 0.96em;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .nachricht-card {
        border: 1px solid #404040;
        background: #2a2a2a;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .nachricht-card:hover {
        border-color: #4fa3ff;
        box-shadow: 0 2px 6px rgba(79, 163, 255, 0.2);
    }

    .nachricht-card-header {
        border-bottom-color: #404040;
        color: #e0e0e0;
    }

    .nachricht-datum {
        color: #e0e0e0;
    }

    .nachricht-richtung {
        background: #3a3a3a;
        color: #b8b8b8;
    }

    .nachricht-richtung.gesendet {
        background: #1a3a4a;
        color: #7dd3fc;
    }

    .nachricht-richtung.erhalten {
        background: #4a1a3a;
        color: #f67af0;
    }

    .nachricht-person .label {
        color: #999;
    }

    .nachricht-person a {
        color: #4fa3ff;
    }

    .nachricht-text {
        background: #333 !important;
        border-left-color: #4fa3ff !important;
        color: #d0d0d0 !important;
    }

    .filter-btn {
        border-color: #404040;
        background: #333;
        color: #bbb;
    }

    .filter-btn:hover {
        border-color: #4fa3ff;
        color: #4fa3ff;
    }

    .filter-btn.active {
        background: #0066cc;
        border-color: #4fa3ff;
        color: #fff;
    }

    .nachricht-vorschau {
        background: #333;
        border-left-color: #4fa3ff;
        color: #aaa;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nachrichten-liste {
        gap: 0.8em;
    }

    .nachricht-card {
        padding: 0.8em;
    }

    .nachricht-card-header {
        margin-bottom: 0.6em;
        padding-bottom: 0.6em;
    }

    .nachricht-datum {
        font-size: 0.9em;
    }

    .nachricht-person {
        font-size: 0.9em;
    }

    .nachricht-card .btn {
        padding: 0.4em 0.8em;
        font-size: 0.95em;
    }
}

/* ========================
   CHAT INTERFACE STYLES
   ======================== */

.chat-profile-header {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 1em;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1em;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    background: #0077cc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    flex-shrink: 0;
}

.chat-profile-info h4 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.chat-profile-info p {
    margin: 0.2em 0 0 0;
    font-size: 0.85em;
    color: #666;
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1em;
    display: flex;
    flex-direction: column;
    gap: 1em;
    min-height: 300px;
    height: 100%;
    /* WICHTIG: Explizite Höhe für Scrolling */
}

.chat-date-divider {
    text-align: center;
    margin: 1em 0;
    font-size: 0.85em;
    color: #999;
    position: relative;
}

.chat-date-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
    z-index: 0;
}

.chat-date-divider span {
    background: white;
    padding: 0 1em;
    position: relative;
    z-index: 1;
}

.chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    padding: 0.8em 1em;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    animation: fadeIn 0.3s ease-in-out;
}

.chat-bubble.incoming {
    align-self: flex-start;
    background: #f0f0f0;
    color: #333;
    border-radius: 18px 18px 4px 18px;
}

.chat-bubble.outgoing {
    align-self: flex-end;
    background: #0077cc;
    color: white;
    border-radius: 18px 18px 18px 4px;
}

.chat-bubble-time {
    font-size: 0.75em;
    margin-top: 0.4em;
    opacity: 0.7;
}

.chat-input-area {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid #ddd;
    padding: 1em;
    display: flex;
    gap: 0.5em;
    align-items: flex-end;
    flex-wrap: wrap;
}

.chat-input-wrapper {
    flex: 1;
    display: flex;
    gap: 0.5em;
    align-items: flex-end;
    min-width: 250px;
}

.chat-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #0077cc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.chat-button:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.chat-textarea {
    flex: 1;
    padding: 0.8em;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.95em;
    resize: none;
    max-height: 100px;
    min-height: 40px;
}

.chat-textarea:focus {
    outline: none;
    border-color: #0077cc;
    box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.1);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #0077cc;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #0066aa;
    transform: scale(1.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark Mode - Chat Styles */
@media (prefers-color-scheme: dark) {
    .chat-profile-header {
        background: #2a2a2a;
        border-bottom-color: #404040;
    }

    .chat-profile-info h4 {
        color: #e0e0e0;
    }

    .chat-profile-info p {
        color: #aaa;
    }

    .chat-date-divider {
        color: #666;
    }

    .chat-date-divider::before {
        background: #404040;
    }

    .chat-date-divider span {
        background: #1e1e1e;
    }

    .chat-bubble.incoming {
        background: #333;
        color: #e0e0e0;
    }

    .chat-bubble.outgoing {
        background: #0066cc;
        color: white;
    }

    .chat-input-area {
        background: #2a2a2a;
        border-top-color: #404040;
    }

    .chat-button {
        background: #404040;
        color: #4fa3ff;
    }

    .chat-button:hover {
        background: #505050;
    }

    .chat-textarea {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #404040;
    }

    .chat-textarea::placeholder {
        color: #666;
    }

    .chat-textarea:focus {
        border-color: #4fa3ff;
        box-shadow: 0 0 0 3px rgba(79, 163, 255, 0.1);
    }

    .chat-send-btn {
        background: #0066cc;
    }

    .chat-send-btn:hover {
        background: #0052a3;
    }
}