/* Globale Resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #efeae2;
    color: #333;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── SESSIONS / AUTH SEITEN (index.php) ── */
.auth-container {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 420px;
    margin: auto;
}

.auth-container h2 {
    color: #128c7e;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #4a4a4a;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    font-size: 15px;
    background-color: #fafafa;
    transition: border-color 0.2s;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #128c7e;
    background-color: #fff;
}

.btn {
    width: 100%;
    padding: 12px;
    background-color: #128c7e;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background-color: #075e54;
}

.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.alert-error { background-color: #ffebe9; color: #b71c1c; border: 1px solid #ffcdd2; }
.alert-success { background-color: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }

.toggle-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.toggle-link a {
    color: #128c7e;
    text-decoration: none;
    font-weight: 600;
}

.toggle-link a:hover {
    text-decoration: underline;
}

/* ── CHAT INTERFACE (chat.php) ── */
.sidebar {
    width: 340px;
    min-width: 340px;
    background: #ffffff;
    border-right: 1px solid #e3e3e3;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 15px 20px;
    background: #008069;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header a {
    color: #e1f5fe;
    text-decoration: none;
    font-size: 13px;
    margin-left: 5px;
}

.sidebar-header a:hover {
    color: #ffffff;
    text-decoration: underline;
}

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

.chat-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    color: #111b21;
    transition: background 0.15s;
}

.chat-item:hover, .chat-item.active {
    background-color: #f0f2f5;
}

.chat-item img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    background: #ccc;
}

.chat-item div {
    flex: 1;
}

.chat-item .status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #fff;
    margin-left: 10px;
}

.status-Online { background-color: #25d366; }
.status-Offline { background-color: #8696a0; }
.status-Beschäftigt { background-color: #ea0038; }

/* ── CHAT WINDOW ── */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #efeae2;
    position: relative;
}

.chat-header {
    padding: 15px 20px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e3e3e3;
    color: #111b21;
    font-size: 16px;
}

/* Der mobile Zurück-Button ist auf dem PC unsichtbar */
.back-btn {
    display: none;
    text-decoration: none;
    font-size: 20px;
    margin-right: 15px;
    color: #008069;
    font-weight: bold;
}

.chat-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── NACHRICHTEN BLASEDIGN (Bubbels) ── */
.message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    font-size: 14.5px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(11,27,33,.12);
}

.msg-in {
    background: #ffffff;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.msg-out {
    background: #d9fdd3;
    align-self: flex-end;
    border-top-right-radius: 0;
}

.msg-meta {
    font-size: 10px;
    color: #667781;
    text-align: right;
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

/* ── FOOTER EINGABEBEREICH ── */
.chat-footer {
    padding: 10px 15px;
    background: #f0f2f5;
    border-top: 1px solid #e3e3e3;
}

.chat-footer form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-footer input[type="text"] {
    flex: 1;
    padding: 11px 15px;
    border: 1px solid #ffffff;
    border-radius: 8px;
    font-size: 15px;
    color: #111b21;
    background: #ffffff;
}

.chat-footer input[type="text"]:focus {
    outline: none;
}

.btn-send {
    padding: 11px 18px;
    background: #008069;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

/* ── 📱 MOBILE REAKTIVITÄT (SMARTPHONE-ANSICHT) ── */
@media (max-width: 768px) {
    body {
        position: relative;
    }

    /* 1. Wenn kein Chat offen ist, füllt die Sidebar das ganze Handy */
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: 100vh;
    }

    /* 2. Wenn ein Chat offen ist, verstecken wir die Sidebar temporär */
    body.chat-open .sidebar {
        display: none;
    }

    /* 3. Das Chatfenster füllt bei geöffnetem Chat ebenfalls das komplette Display */
    .chat-window {
        display: none;
        width: 100%;
        height: 100vh;
    }

    body.chat-open .chat-window {
        display: flex;
    }

    /* 4. Zurück-Button auf dem Handy einblenden */
    body.chat-open .back-btn {
        display: inline-block;
    }

    .message {
        max-width: 85%; /* Mehr Platz für Text auf kleinen Displays */
    }
}
