:root {
    --primary-color: #2563eb;
    --hover-color: #1d4ed8;
    --border-radius: 12px;
    --sidebar-width: 280px;
    --button-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 600;
    color: var(--primary-color);
}

.nav-link {
    color: #4b5563;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f0f6ff;
    color: var(--primary-color);
}

.nav-link.active {
    background: #f0f6ff;
    color: var(--primary-color);
}

.content-wrapper {
    display: flex;
    flex: 1;
    margin-top: 56px;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid #e9ecef;
    padding: 20px;
    position: relative;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

.new-chat-btn {
    background: var(--button-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.chat-item {
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-item:hover {
    background: #f0f6ff;
}

.chat-item.active {
    background: #f0f6ff;
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px 8%;
    margin-bottom: 120px;
}

.message {
    display: flex;
    gap: 20px;
    margin: 28px 0;
}

.user-message {
    flex-direction: row-reverse;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.message-content {
    max-width: 75%;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: white;
    position: relative;
    line-height: 1.6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    word-break: break-word;
    margin-bottom: 8px;
}

.reference-container {
    width: 75%;
    margin-left: 0;
    padding-left: 68px;
    margin-top: -16px;
    margin-bottom: 24px;
    box-sizing: border-box;
}

.reference-content {
    width: 100%;
    margin-left: 0;
    box-sizing: border-box;
    padding: 12px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9em;
}

.rating-container {
    width: 75%;
    margin-left: 80px; 
    margin-top: 12px;
    padding: 8px 0;
}

.star-rating {
    display: flex;
    gap: 6px;
    cursor: pointer;
}

.star-rating i {
    color: #e4e5e9;
}

.star-rating i:hover,
.star-rating i.active {
    color: #ffd700;
    transform: scale(1.1);
}

.star-rating[data-rated] i {
    pointer-events: none;
}

.reference-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}

.ref-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: -1px;
    padding-left: 26px;
}

.ref-similarity {
    color: #64748b;
    font-size: 0.85em;
}
.ref-number {
    color: var(--primary-color);
    font-weight: 500;
}

.ref-link {
    color: #64748b;
    text-decoration: none;
    margin-left: 8px;
    font-size: 0.85em;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.ref-link:hover {
    color: var(--primary-color);
}

.ref-link i {
    transition: color 0.2s ease-in-out;
}

.ref-link:hover i {
    color: var(--hover-color);
}

.user-message .message-content {
    background: white;
    color: #1a1a1a;
}

.input-container {
    position: fixed;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width);
    background: white;
    padding: 16px 0;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: center;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
}

.input-wrapper {
    width: 85%;
    display: flex;
    gap: 16px;
    max-width: 1200px;
    padding: 0 20px;
    align-items: center;
}

.model-select {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 5px;
    width: 140px;
    height: 48px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#user-input {
    flex: 1;
    min-height: 100.5px;
    max-height: 300px;
    padding: 18px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    resize: vertical;
    font-size: 16px;
    line-height: 1.6;
    transition: border-color 0.2s;
}

#user-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.send-btn {
    background: var(--button-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    transition: all 0.2s;
    width: 140px;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.rating-container {
    margin-top: 10px;
}

.reference-container {
    margin-bottom: -10px;
}

.reference-item {
    margin: 4px 0;
}

.ref-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.ref-content {
    flex: 1;
    max-height: 1.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: none;
    -webkit-box-orient: vertical;
    transition: max-height 0.3s ease-in-out;
    margin: 0;
    line-height: 1.5;
}

.ref-content.expanded {
    max-height: none;
    -webkit-line-clamp: unset;
    line-clamp: none;
    
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    padding-top: 2px;
}

.expand-btn.expanded {
    transform: rotate(180deg);
}

.expand-btn i {
    font-size: 0.8em;
}

.dropdown-menu {
    --bs-dropdown-min-width: 2rem;
}

.model-select option {
    padding: 8px 12px;
    font-size: 14px;
    color: #4b5563;
    transition: all 0.2s;
}

.model-select option:hover {
    background: #f0f6ff;
    color: var(--primary-color);
}