.chat-container {
    max-width: 1600px;
    height: 850px;
    margin: 0 auto;
    display: flex;
    background: rgba(15, 15, 25, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    position: relative;
}

.chat-sidebar {
    width: 320px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    flex-shrink: 0;
}

.chat-sidebar.closed {
    width: 0;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    padding: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

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

.room-item {
    padding: 15px 20px;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.room-item i {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s;
}

.room-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.room-item.active {
    background: rgba(130, 100, 255, 0.1);
    border-color: rgba(130, 100, 255, 0.2);
}

.room-item.active i {
    color: var(--primary);
}

.room-content {
    display: flex;
    flex-direction: column;
}

.room-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.room-desc {
    font-size: 0.75rem;
    opacity: 0.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* --- MAIN CHAT AREA --- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- MENU TOGGLE --- */
.menu-toggle-btn {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.chat-header {
    padding: 24px 35px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #34c759;
    border-radius: 50%;
    box-shadow: 0 0 15px #34c759;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-trigger {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 15px;
    border-radius: 30px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* --- PROFILE MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: rgba(25, 25, 35, 0.95);
    width: 100%;
    max-width: 450px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.modal-card h2 {
    margin-bottom: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
}

.modal-card p {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
}

.profile-setup-box {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.setup-field {
    text-align: left;
}

.setup-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.avatar-selection {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.avatar-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-option.selected {
    border-color: var(--primary);
    background: rgba(130, 100, 255, 0.15);
    color: var(--primary);
}

.color-selection {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 5px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.color-option.selected {
    border-color: white;
    transform: scale(1.2);
}

.save-profile-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    color: white;
    padding: 15px;
    border-radius: var(--radius-md);
    font-weight: 800;
    margin-top: 10px;
    box-shadow: 0 10px 20px rgba(130, 100, 255, 0.2);
}

.chat-messages {
    flex: 1;
    padding: 25px 35px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(130, 100, 255, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(130, 100, 255, 0.5);
    background-clip: content-box;
}

/* --- MESSAGE BUBBLES --- */
.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    margin-bottom: 8px;
    animation: messageSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

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

.msg-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin: 0 12px 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bubble-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message {
    padding: 14px 20px;
    border-radius: 22px;
    font-size: 0.98rem;
    line-height: 1.5;
    position: relative;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.msg-wrapper.ai {
    align-self: flex-start;
}

.msg-wrapper.ai .bubble-container {
    flex-direction: row;
}

.msg-wrapper.ai .message {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

.msg-wrapper.ai .avatar {
    background: rgba(130, 100, 255, 0.15);
    color: var(--primary);
    border-color: rgba(130, 100, 255, 0.2);
}

.msg-wrapper.user {
    align-self: flex-end;
}

.msg-wrapper.user .bubble-container {
    flex-direction: row-reverse;
}

.msg-wrapper.user .message {
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 10px 25px rgba(130, 100, 255, 0.25);
    font-weight: 500;
}

.msg-wrapper.user .msg-info {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

/* --- SYSTEM / MODERATION MSG --- */
.system-msg {
    align-self: center;
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 15px 0;
    border: 1px solid rgba(255, 59, 48, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: systemShake 0.5s ease;
}

@keyframes systemShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* --- QUICK CHIPS --- */
.quick-chips {
    padding: 0 20px 15px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chip {
    white-space: nowrap;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: white;
}

.chat-input-area {
    padding: 20px 25px 30px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 15px;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 18px 25px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(130, 100, 255, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    color: white;
    width: 58px;
    height: 58px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 10px 25px rgba(130, 100, 255, 0.3);
}

.send-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
    box-shadow: 0 15px 35px rgba(130, 100, 255, 0.4);
}

.typing-indicator {
    position: absolute;
    bottom: 120px;
    left: 35px;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    display: none;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1024px) {
    .chat-container {
        height: 90vh;
        margin: 20px;
    }

    .chat-sidebar {
        width: 280px;
    }
}

@media (max-width: 768px) {
    header {
        height: 30vh;
    }

    header h1 {
        font-size: 2.8rem;
    }

    .chat-container {
        height: calc(100vh - 80px);
        margin: 0;
        border-radius: 0;
        border: none;
    }

    .chat-sidebar {
        position: absolute;
        left: -320px;
        top: 0;
        bottom: 0;
        z-index: 100;
        width: 300px;
        background: rgba(15, 15, 25, 0.98);
        backdrop-filter: blur(20px);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .chat-sidebar.open {
        transform: translateX(320px);
    }

    /* Reset desktop transition for mobile fixed positioning */
    .chat-sidebar.closed {
        width: 300px;
        opacity: 1;
        pointer-events: auto;
    }

    .menu-toggle-btn {
        display: flex;
    }

    .chat-header {
        padding: 15px 20px;
    }

    .chat-header h2 {
        font-size: 1.1rem;
    }

    .header-right .profile-trigger span {
        display: none;
    }

    .header-right .profile-trigger {
        padding: 8px 12px;
    }

    .chat-messages {
        padding: 15px 20px;
    }

    .msg-wrapper {
        max-width: 90%;
    }

    .chat-input-area {
        padding: 15px;
        gap: 10px;
    }

    .chat-input {
        padding: 14px 18px;
        font-size: 0.9rem;
    }

    .send-btn {
        width: 50px;
        height: 50px;
    }

    .quick-chips {
        display: none;
    }

    .merke {
        margin: 20px;
    }
}
