/* =========================================================
   GLOBAL – Mobile-Fix + Vollbreite
   ========================================================= */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0f172a;
    color: #e5e7eb;
    font-family: system-ui, sans-serif;

    /* Wichtig: verhindert abgeschnittene Inhalte */
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Root Layout */
.layout {
    display: flex;
    height: auto;
    min-height: 100%; /* Fallback */




    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
}

/* =========================================================
   SIDEBAR (Desktop normal sichtbar)
   ========================================================= */
.sidebar {
    width: 260px;
    background: #0f172a;
    border-right: 1px solid #334155;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
}

.new-chat-btn {
    background: #22c55e;
    border: none;
    color: #0f172a;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

.new-chat-btn:hover {
    background: #16a34a;
}

/* Chatliste */
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.chat-item {
    padding: 8px 10px;
    background: #1e293b;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    border: 1px solid transparent;
    margin-bottom: 6px;
}

.chat-item:hover {
    background: #334155;
}

.chat-item.active {
    background: #475569;
    border-color: #64748b;
}

.chat-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.chat-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.chat-item-actions {
    display: flex;
    gap: 4px;
}

.chat-item-btn {
    background: transparent;
    border: none;
    color: #cbd5f5;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
}

.chat-item-btn:hover {
    color: #f97316;
}

/* =========================================================
   MAIN AREA
   ========================================================= */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100%;


    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 50px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    position: relative;
}

.title {
    font-size: 1rem;
    font-weight: 600;
}

.model-switch {
    display: flex;
    gap: 6px;
}

.model-btn {
    border: 1px solid #475569;
    background: #0f172a;
    color: #e5e7eb;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
}

.model-btn.active {
    background: #22c55e;
    border-color: #22c55e;
    color: #0f172a;
    font-weight: 600;
}

/* Chatbereich */
.center-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    overflow-y: auto;
}

.chat {
    width: 100%;
    max-width: 900px;
    padding: 16px;
    box-sizing: border-box;
}

/* Nachrichten */
.message {
    max-width: 80%;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.message.user {
    background: #2563eb;
    color: white;
}

.message.assistant {
    background: #1e293b;
    border: 1px solid #334155;
}

/* Eingabeleiste */
.input-bar {
    background: #1e293b;
    border-top: 1px solid #334155;
    padding: 12px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.input-wrapper {
    width: 100%;
    max-width: 900px;
    display: flex;
    gap: 10px;
}

#input {
    flex: 1;
    resize: none;
    min-height: 45px;
    max-height: 150px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #e5e7eb;
    font-size: 0.95rem;
}

#input:focus {
    outline: none;
    border-color: #22c55e;
}

#send {
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    background: #22c55e;
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}

#send:disabled {
    opacity: 0.5;
    cursor: default;
}

/* =========================================================
   MOBILE LAYOUT – Sidebar ausblenden, Button einblenden
   ========================================================= */

/* Toggle Button (nur Mobile sichtbar) */
.sidebar-toggle {
    display: none;
}

@media (max-width: 768px) {

    /* Sidebar komplett ausblenden */
    .sidebar {
        display: none;
    }

    /* Sidebar als Slide-In */
    .sidebar.open {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100%;
        background: #0f172a;
        border-right: 1px solid #334155;
        padding: 12px;
        z-index: 9998;
    }

    /* Kleiner Button oben links */
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 9999;
        background: #1e293b;
        color: #e5e7eb;
        padding: 8px 12px;
        border-radius: 8px;
        border: 1px solid #334155;
        cursor: pointer;
    }

    /* Chat fullscreen */
    .layout {
        flex-direction: column;
        width: 100vw;
        max-width: 100vw;
    }

    .main-area {
        width: 100vw;
        max-width: 100vw;
    }

    .center-wrapper {
        justify-content: flex-start;
    }

    .chat {
        width: 100%;
        max-width: 100%;
    }

    .message {
        max-width: 95%;
    }
    
    
}