:root {
    --primary-color: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-dark: #4834d4;
    --accent-color: #00cec9;
    --background-light: #ffffff;
    --background-dark: #18191a;
    --text-light: #2d3436;
    --text-dark: #f5f6fa;
    --card-light: #ffffff;
    --card-dark: #242526;
    --border-light: #e0e0e0;
    --border-dark: #3a3b3c;
    --input-light: #f5f6fa;
    --input-dark: #3a3b3c;
    --success: #00b894;
    --warning: #fdcb6e;
    --error: #ff7675;
    --font-primary: 'Inter', sans-serif;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-dark: 0 2px 10px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
    --radius: 12px;
}

.light-theme {
    --background: var(--background-light);
    --card-bg: var(--card-light);
    --text-color: var(--text-light);
    --border-color: var(--border-light);
    --input-bg: var(--input-light);
    --shadow: var(--shadow-light);
}

.dark-theme {
    --background: var(--background-dark);
    --card-bg: var(--card-dark);
    --text-color: var(--text-dark);
    --border-color: var(--border-dark);
    --input-bg: var(--input-dark);
    --shadow: var(--shadow-dark);
}

::selection {
    background-color: var(--primary-color);
    color: white;
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--background);
    color: var(--text-color);
    transition: var(--transition);
    min-height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: var(--transition);
}

.logo {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.logo i {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-right: 0.8rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.new-chat-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.new-chat-btn:hover {
    background-color: var(--primary-dark);
}

.new-chat-btn i {
    margin-right: 0.5rem;
}

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

.chat-history h3 {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 1rem;
    font-weight: 600;
}

#history-list {
    list-style: none;
}

.history-item {
    padding: 0.8rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.history-item:hover {
    background-color: rgba(108, 92, 231, 0.1);
}

.history-item.active {
    background-color: rgba(108, 92, 231, 0.2);
}

.history-item i {
    margin-right: 0.8rem;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.history-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.settings {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#settings-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.8rem;
    border-radius: var(--radius);
    transition: var(--transition);
    width: 100%;
    text-align: left;
    margin-bottom: 0.8rem;
}

#settings-btn:hover {
    background-color: rgba(108, 92, 231, 0.1);
}

#settings-btn i {
    margin-right: 0.8rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: var(--transition);
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

.model-info {
    display: flex;
    align-items: center;
}

#current-model {
    font-weight: 600;
    margin-right: 1rem;
}

.model-status {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.05);
}

.model-status.online {
    color: var(--success);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    margin-right: 0.4rem;
    display: inline-block;
}

.header-actions {
    display: flex;
    gap: 0.8rem;
}

.header-actions button {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.7;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: var(--transition);
}

.header-actions button:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    scroll-behavior: smooth;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.welcome-logo {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    background-color: rgba(108, 92, 231, 0.1);
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.welcome-screen h2 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-screen p {
    color: var(--text-color);
    opacity: 0.7;
    max-width: 600px;
    margin-bottom: 2rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    max-width: 700px;
}

.suggestion-chip {
    background-color: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-chip:hover {
    background-color: rgba(108, 92, 231, 0.2);
}

.message {
    display: flex;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
}

.message.user {
    background-color: rgba(108, 92, 231, 0.05);
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.message-avatar.user {
    background-color: var(--primary-color);
    color: white;
}

.message-avatar.ai {
    background-color: var(--accent-color);
    color: white;
}

.message-content {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content pre {
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

.message-content code {
    font-family: monospace;
    font-size: 0.9rem;
}

.message-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background-color: var(--input-bg);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
}

#user-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    resize: none;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    color: var(--text-color);
    max-height: 200px;
    line-height: 1.9;
}

#user-input::placeholder {
    color: var(--text-color);
    opacity: 0.5;
}

.input-actions {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
}

.input-actions button {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    margin-left: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.input-actions button:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
}

#send-message {
    background-color: var(--primary-color);
    color: white;
    opacity: 1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

#send-message:hover {
    background-color: var(--primary-dark);
}

/* Typing indicator */
.typing-indicator {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: var(--text-color);
    display: block;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite ease-in-out;
}

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

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

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

@keyframes typing {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
    100% {
        transform: translateY(0px);
    }
}

.hidden {
    display: none;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: var(--card-bg);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.select-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.select-wrapper::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-family: var(--font-primary);
    appearance: none;
    font-size: 0.9rem;
}

.appearance-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.radio-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    margin-bottom: 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.radio-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.custom-radio {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
}

.radio-container:hover input ~ .custom-radio {
    background-color: rgba(108, 92, 231, 0.1);
}

.radio-container input:checked ~ .custom-radio {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-radio:after {
    content: "";
    position: absolute;
    display: none;
}

.radio-container input:checked ~ .custom-radio:after {
    display: block;
}

.radio-container .custom-radio:after {
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.slider-setting {
    margin-bottom: 1.5rem;
}

.slider-setting label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.slider-container {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.slider-container input {
    flex: 1;
    margin-right: 1rem;
}

.slider-container span {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
}

.setting-description {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
}

.modal-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn:hover {
    background-color: var(--primary-dark);
}

.secondary-btn {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Style for the delete button in the conversation list */
.history-item .delete-btn {
    background: none;
    border: none;
    color: var(--error);
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0.3rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-item .delete-btn:hover {
    background-color: rgba(255, 118, 117, 0.1);
    color: var(--error);
}

.history-item .delete-btn i {
    font-size: 1rem; /* Adjust icon size */
}

/* Hamburger Button Styles */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1100;
    box-shadow: var(--shadow);
    transition: background 0.3s ease-in-out;
}

.menu-toggle:hover {
    background: var(--primary-dark);
}

.menu-toggle i {
    font-size: 1.5rem;
}

/* Responsive Sidebar for Small Screens */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        background-color: var(--card-bg);
        box-shadow: var(--shadow);
        transition: left 0.3s ease-in-out;
        z-index: 1000;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .menu-toggle {
        display: block;
    }

    .model-info {
        margin-left: 8vw;
    }
}

@media (max-width: 480px) {
    .menu-toggle {
        left: 10px;
        top: 10px;
        padding: 10px;
    }
    
    .sidebar {
        width: 250px;
    }
}