/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Left Sidebar */
.sidebar {
    width: 260px;
    background-color: #1a1a1a;
    display: flex;
    border-right: 1px solid #2d2d2d;
    position: relative;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 48px;
}

.sidebar-icons {
    width: 48px;
    min-width: 48px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    border-right: 1px solid #2d2d2d;
    position: relative;
    z-index: 2;
    background-color: #1a1a1a;
}

.icon-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: #2d2d2d;
}

.icon-btn.active {
    background-color: #2d2d2d;
}

.sidebar-content {
    width: 212px;
    min-width: 212px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 12px;
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(0);
    position: relative;
    z-index: 1;
}

.sidebar.collapsed .sidebar-content {
    transform: translateX(-100%);
    opacity: 0;
}

.chat-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-new-chat {
    flex: 1;
    padding: 10px 16px;
    background-color: #ffffff;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-new-chat:hover {
    background-color: #f0f0f0;
}

.btn-folder {
    width: 40px;
    height: 40px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-folder:hover {
    background-color: #3d3d3d;
}

.search-container {
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
}

.search-input::placeholder {
    color: #888888;
}

.search-input:focus {
    outline: none;
    border-color: #4d4d4d;
}

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

.no-chats {
    color: #888888;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Sidebar Divider */
.sidebar-divider {
    width: 1px;
    background-color: #2d2d2d;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.collapse-btn {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 11;
}

.collapse-btn svg {
    transition: transform 0.3s ease;
}

.collapse-btn svg.rotated {
    transform: rotate(180deg);
}

.collapse-btn:hover {
    background-color: #3d3d3d;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #1a1a1a;
    position: relative;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #2d2d2d;
}

.quick-settings {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}

.quick-settings svg {
    color: #888888;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}

.model-selector svg {
    color: #888888;
}

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.chat-area.no-scroll {
    overflow: hidden;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
}

.chat-title {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
}

.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 38px;
    background-color: #ffffff;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.6;
}

.user-message {
    background-color: #2d2d2d;
    align-self: flex-end;
    margin-left: auto;
}

.bot-message {
    background-color: #2d2d2d;
    align-self: flex-start;
}

.message.typing {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.message.typing span {
    width: 8px;
    height: 8px;
    background-color: #888888;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.message.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.message.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Message Input */
.message-input-container {
    padding: 16px 200px;
    border-top: 1px solid #2d2d2d;
    background-color: #1a1a1a;
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 24px;
    padding: 8px;
}

.attach-btn {
    background: transparent;
    border: none;
    color: #888888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s;
}

.attach-btn:hover {
    color: #ffffff;
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    padding: 4px 0;
}

.message-input::placeholder {
    color: #888888;
}

.send-btn {
    background: transparent;
    border: none;
    color: #888888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s, opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.send-btn.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.send-btn-circle {
    transition: transform 0.3s ease;
    transform-origin: center;
}

.send-btn:hover .send-btn-circle {
    transform: scale(1.1);
}

.send-btn:hover {
    color: #ffffff;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #3d3d3d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4d4d4d;
}

/* Auth Styles */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-button, .user-button {
    padding: 8px 16px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-button:hover, .user-button:hover {
    background-color: #3d3d3d;
}

.auth-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.auth-modal-open .app-container {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

.auth-modal-content {
    background-color: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.auth-close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 28px;
    font-weight: bold;
    color: #888888;
    cursor: pointer;
    transition: color 0.2s;
}

.auth-close:hover {
    color: #ffffff;
}

.auth-form h2 {
    color: #ffffff;
    margin-bottom: 24px;
    font-size: 24px;
}

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

.form-group label {
    display: block;
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4d4d4d;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background-color: #ffffff;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 16px;
}

.auth-btn:hover {
    background-color: #f0f0f0;
}

.auth-switch {
    text-align: center;
    color: #888888;
    font-size: 14px;
}

.auth-switch a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-switch a:hover {
    color: #888888;
}

.user-menu {
    position: absolute;
    top: 60px;
    right: 20px;
    background-color: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    padding: 16px;
    min-width: 200px;
    z-index: 100;
}

.user-menu-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-info {
    color: #ffffff;
    font-size: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2d2d2d;
}

.logout-btn {
    padding: 8px 16px;
    background-color: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background-color: #3d3d3d;
}
