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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    height: 100vh;
    background: #f5f5f5;
}

#sidebar {
    width: 260px;
    background: #050509;
    /* Darker background */
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1f2937;
}

#sidebar-header {
    padding: 15px;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #8e8ea0;
    /* Slight grey tint or white */
    color: white;
    margin: 0;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#new-chat-small-btn {
    background: #343541;
    border: 1px solid #565869;
    color: white;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s;
}

#new-chat-small-btn:hover {
    background: #40414f;
}

#new-chat-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    /* Purple gradient */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
}

#new-chat-btn:hover {
    opacity: 0.9;
}

#history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ececf1;
    font-size: 14px;
}

.history-item:hover {
    background: #2a2b32;
}

.history-item.active {
    background: #343541;
    color: white;
}

.history-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-history-btn {
    background: none;
    border: none;
    color: #8e8ea0;
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s, color 0.2s;
    font-size: 16px;
}

.history-item:hover .delete-history-btn {
    opacity: 1;
}

.delete-history-btn:hover {
    color: #ef4444;
    /* Red on hover */
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

#header-bar {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    z-index: 100;
}

#header-bar h1 {
    font-size: 20px;
    font-weight: 600;
}

#header-bar select {
    padding: 8px 12px;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    cursor: pointer;
}

#model-select {
    border-color: #00aa66;
}

#profile-select {
    border-color: #0066cc;
}

#header-bar button {
    padding: 8px 16px;
    background: #f3f4f6;
    /* Light grey default */
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    /* Pill shape */
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

#header-bar button:hover {
    background: #e5e7eb;
    color: #111827;
}

#clear-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #ef4444 !important;
    /* Red text */
}

#clear-btn:hover {
    background: #fef2f2 !important;
    /* Light red bg */
    border-color: #fee2e2 !important;
}



#input-box {
    padding: 15px 20px;
    background: white;
    border-top: 2px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 150px;
    max-height: 50vh;
}

#user-input:focus {
    outline: none;
    border-color: #818cf8;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.button-group button {
    padding: 12px 16px;
    background: #f3f4f6;
    color: #4b5563;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.button-group button:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Send Button Gradient */
#send-btn {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
}

#send-btn:hover {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
}

#emoji-picker {
    position: absolute;
    bottom: 100px;
    right: 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
}

#emoji-picker.show {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    text-align: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.emoji-item:hover {
    background: #f0f0f0;
}

/* SETTINGS DROPDOWN */
.settings-container {
    position: relative;
    margin-right: auto;
    /* Push clear button to the right if needed, or just spacing */
    margin-left: 20px;
}

.settings-btn {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px !important;
    font-weight: 500;
    border-radius: 20px;
    /* Pill */
    transition: all 0.2s;
}

.settings-btn:hover {
    background: #e5e7eb !important;
    color: #111827 !important;
}

.settings-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    width: 300px;
    background: white;
    color: #333;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    max-height: 80vh;
    overflow-y: auto;
    padding: 8px 0;
}

.settings-dropdown.show {
    display: block;
}

.settings-section {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.settings-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #888;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

/* OPTION LISTS */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    transition: background 0.2s;
}

.option-item:hover {
    background: #f5f5f5;
}

.option-item.active {
    background: #e6fff2;
    /* Light green bg */
    color: #00aa66;
    font-weight: 600;
}

.option-item.active::after {
    content: "✓";
    font-weight: bold;
}

/* SLIDER */
.slider-container {
    padding: 0 5px;
}

input[type=range] {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00aa66;
    /* Green thumb */
    cursor: pointer;
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    color: #888;
}

/* WEB BUTTON */
.web-btn {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    margin-right: 10px;
    opacity: 1;
    /* Reset opacity */
    transition: all 0.2s;
    border-radius: 20px;
    /* Pill */
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
}

.web-btn:hover {
    background: #e5e7eb !important;
    color: #111827 !important;
}

.web-btn.active {
    background: #00aa66 !important;
    /* Green */
    border-color: #00aa66 !important;
    opacity: 1;
    box-shadow: 0 0 10px rgba(0, 170, 102, 0.4);
}