/* Variables */
:root {
    --primary-blue: #1a73e8;
    --primary-blue-light: #e8f0fe;
    --primary-blue-dark: #0d47a1;
    --accent-orange: #ff9800;
    --accent-orange-light: #ffe0b2;
    --accent-orange-dark: #e65100;
    --light-gray: #f5f7fa;
    --medium-gray: #eaedf2;
    --dark-gray: #606770;
    --error-red: #dc3545;
    --error-red-light: #ffe0e0;
    --white: #ffffff;
    --black: #333333;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.15);
    --animation-duration: 0.3s;
    --standard-transition: all 0.2s;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Prompt', sans-serif;
    background-color: var(--light-gray);
    color: var(--black);
}

/* Common Styles */
.btn {
    cursor: pointer;
    transition: var(--standard-transition);
}

.btn-primary {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-blue-dark);
    transform: translateY(-1px);
}

.btn-danger:hover {
    color: var(--error-red);
    background-color: var(--error-red-light);
}

.btn-circle {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-rounded {
    border-radius: var(--border-radius-sm);
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes typingPulse {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Navbar */
.navbar {
    background-color: var(--white) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 600;
    color: var(--primary-blue) !important;
}

.nav-link {
    color: #555 !important;
    font-weight: 500;
    transition: var(--standard-transition);
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius-sm);
    margin: 0 0.25rem;
}

.nav-link:hover {
    color: var(--primary-blue) !important;
    background-color: var(--primary-blue-light);
}

.nav-link.active {
    color: var(--primary-blue) !important;
    background-color: var(--primary-blue-light);
}

/* Chat Container */
.chat-container {
    display: flex;
    height: 100vh;
    background-color: var(--white);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    margin-top: 0;
}

/* Sidebar */
.chat-sidebar {
    width: 280px;
    background-color: var(--medium-gray);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-blue);
}

#new-chat-btn {
    background-color: var(--primary-blue);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.75rem;
    transition: var(--standard-transition);
}

#new-chat-btn:hover {
    background-color: var(--primary-blue-dark);
    transform: translateY(-1px);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Chat List */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background-color: var(--white);
    cursor: pointer;
    transition: var(--standard-transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-item:hover {
    background-color: var(--primary-blue-light);
    border-color: var(--primary-blue-light);
    transform: translateY(-1px);
}

.chat-item.active {
    background-color: var(--primary-blue-light);
    border-color: var(--primary-blue);
    border-left: 4px solid var(--primary-blue);
}

.chat-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.chat-item-actions {
    display: none;
}

.chat-item:hover .chat-item-actions {
    display: flex;
    gap: 0.4rem;
}

.new-chat-item {
    color: var(--primary-blue);
    border: 2px dashed var(--primary-blue-light);
    background-color: rgba(26, 115, 232, 0.05);
    justify-content: center;
    margin-top: 0.5rem;
    font-weight: 500;
}

.new-chat-item:hover {
    background-color: var(--primary-blue-light);
    border-color: var(--primary-blue);
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    position: relative;
    height: 100%;
}

.chat-header {
    padding: 0.8rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: var(--white);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 10;
    box-sizing: border-box;
}

.chat-title-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-title-container h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-blue);
}

#edit-title-btn {
    color: var(--dark-gray);
    border: none;
    background: none;
    font-size: 0.9rem;
    padding: 0.35rem;
    border-radius: 50%;
    transition: var(--standard-transition);
}

#edit-title-btn:hover {
    color: var(--primary-blue);
    background-color: var(--primary-blue-light);
}

.chat-settings button {
    color: var(--dark-gray);
    border: none;
    background: none;
    margin-left: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--standard-transition);
}

.chat-settings button:hover {
    color: var(--primary-blue);
    background-color: var(--primary-blue-light);
}

#clear-chat-btn:hover {
    color: var(--error-red);
    background-color: var(--error-red-light);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    background-image: 
        radial-gradient(circle at 25px 25px, rgba(26, 115, 232, 0.15) 2%, transparent 0%), 
        radial-gradient(circle at 75px 75px, rgba(255, 152, 0, 0.1) 2%, transparent 0%);
    background-size: 100px 100px;
    position: absolute;
    top: 60px;
    bottom: 160px;
    left: 0;
    right: 0;
    padding-bottom: 20px;
    margin: 0;
}

/* Welcome Message */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 20px;
}

.welcome-container img {
    max-width: 150px;
    margin-bottom: 20px;
}

.welcome-message {
    font-size: 24px;
    color: var(--primary-blue);
    font-weight: 500;
}

.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: fadeIn var(--animation-duration) ease;
    max-width: 85%;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message.assistant {
    margin-right: auto;
}

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.75rem;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background-color: var(--accent-orange-light);
    color: var(--accent-orange-dark);
}

.message.assistant .message-avatar {
    background-image: url("https://lert.tsu.ac.th/chat/assets/lert_c.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: transparent; /* ซ่อนไอคอนเดิม */
}

.message.error .message-avatar {
    background-image: url("https://lert.tsu.ac.th/chat/assets/lert_c.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: transparent;
}


.message-content {
    flex: 0 1 auto;
    max-width: 100%;
}

.message-text {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
    font-size: 0.95rem;
}

.message.user .message-text {
    background-color: var(--accent-orange);
    color: var(--white);
    border-top-right-radius: 3px;
}

.message.assistant .message-text {
    background-color: var(--white);
    color: var(--black);
    border-top-left-radius: 3px;
    border-left: 3px solid var(--primary-blue);
}

.message.error .message-text {
    background-color: var(--error-red-light);
    color: var(--error-red);
    border-left: 3px solid var(--error-red);
}

.message-time {
    color: var(--dark-gray);
    font-size: 0.75rem;
    margin-top: 0.4rem;
    text-align: right;
    opacity: 0.75;
}

/* Input Area */
.chat-input {
    padding: 0.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background-color: var(--white);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    box-sizing: border-box;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--white);
    border-radius: 24px;
    border: 1px solid #ddd;
    padding: 6px 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}

.input-container:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

.chat-input textarea {
    flex: 1;
    border: none !important;
    box-shadow: none !important;
    background: transparent;
    margin: 0 8px;
    padding: 8px 0;
    resize: none;
    font-size: 0.95rem;
    outline: none;
    max-height: 100px;
    min-height: 24px;
    border-radius: 0;
}

.voice-btn, .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: var(--standard-transition);
    background-color: transparent;
}

.voice-btn {
    color: #666;
}

.voice-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.voice-btn.active {
    color: var(--error-red);
    animation: pulse 1.5s infinite;
}

.send-btn, #send-btn {
    background-color: var(--primary-blue);
    color: var(--white);
    margin-left: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    box-shadow: none;
    font-weight: normal;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.send-btn:hover, #send-btn:hover {
    background-color: var(--primary-blue-dark);
    transform: scale(1.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.send-btn:disabled, #send-btn:disabled {
    background-color: #b0bec5;
    cursor: not-allowed;
}

#message-input:not(:placeholder-shown) ~ #send-btn,
#message-input:focus ~ #send-btn {
    opacity: 1;
}

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 18px;
    padding: 0.85rem 1.25rem;
    resize: none;
    font-size: 0.95rem;
    outline: none;
    transition: var(--standard-transition);
    box-shadow: var(--shadow-sm);
}

.input-group #send-btn {
    align-self: flex-end;
    border-radius: 12px;
    padding: 0.5rem 1.5rem;
    margin-bottom: 10px;
    opacity: 1;
    width: auto;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    padding: 0.5rem;
    justify-content: center;
}

.typing-indicator span {
    height: 10px;
    width: 10px;
    margin: 0 2px;
    background-color: #6c757d;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0% { transform: scale(0.5); opacity: 0.5; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.5); opacity: 0.5; }
}

/* Container Components */
.assistant-container,
.model-container,
.parameters-container {
    background-color: var(--white);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e0e0e0;
}

.assistant-container {
    border-left: 3px solid var(--primary-blue);
    margin-bottom: 0;
}

.assistant-selector, 
.model-selector, 
.params-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.assistant-selector label,
.model-selector label,
.param-group label {
    font-weight: 500;
    color: var(--dark-gray);
    white-space: nowrap;
}

.assistant-selector label {
    font-weight: 600;
    color: var(--primary-blue);
}

.assistant-selector select,
.model-selector select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid #ddd;
    outline: none;
    transition: var(--standard-transition);
}

.assistant-selector select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.param-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Form Controls */
.form-slider {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    accent-color: var(--primary-blue);
}

.form-number {
    width: 60px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.25rem;
}

/* Hidden Elements */
.mode-selector,
.sidebar-toggle-btn,
.profile-toggle-btn {
    display: none;
}

/* Claude Style Controls */
.claude-style-controls {
    display: none;
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
}

.claude-style-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--white);
    color: var(--dark-gray);
    box-shadow: var(--shadow-sm);
    transition: var(--standard-transition);
    cursor: pointer;
    padding: 0;
}

.claude-style-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.claude-style-btn.active {
    background-color: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

.claude-style-btn.sidebar-btn {
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
}

.claude-style-btn.add-chat-btn {
    background-color: var(--accent-orange);
    color: var(--white);
    border-color: var(--accent-orange);
}

.claude-style-btn.clear-btn {
    color: var(--error-red);
    border-color: rgba(220, 53, 69, 0.3);
}

.claude-style-btn.profile-btn {
    color: var(--primary-blue);
}

/* Sidebar Sliding Effects for Mobile */
.toggle-sidebar-btn {
    position: fixed;
    top: 75px;
    left: 15px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1040;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
    display: none;
}

.toggle-sidebar-btn.open {
    left: 290px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1020;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* Responsive styles */
@media (min-width: 992px) {
    .chat-container {
        display: flex;
    }
    
    .chat-sidebar {
        position: relative;
        left: 0;
        height: auto;
    }
    
    .toggle-sidebar-btn {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1050;
        height: 56px;
    }
    
    main.py-4 {
        padding: 0 !important;
        margin: 0 !important;
        position: fixed;
        top: 56px;
        bottom: 0;
        left: 0;
        right: 0;
        overflow: hidden;
        height: calc(100% - 56px);
    }
    
    .container {
        padding: 0;
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .chat-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        height: 100%;
        max-height: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .chat-sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        width: 280px;
        z-index: 1030;
        padding-top: 0;
        background-color: var(--medium-gray);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        border-radius: 0;
    }
    
    .chat-sidebar.open {
        transform: translateX(280px);
    }
    
    .chat-main {
        width: 100%;
        flex: 1;
        height: 100%;
        overflow: hidden;
        position: relative;
    }
    
    .chat-messages {
        position: absolute;
        top: 60px;
        bottom: 180px;
        left: 0;
        right: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 20px;
    }
    
    .chat-input {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 10px;
        z-index: 1020;
        background-color: var(--white);
    }
    
    .chat-input textarea {
        max-height: 70px;
    }
    
    .toggle-sidebar-btn {
        display: flex;
    }
    
    .claude-style-controls {
        display: flex;
    }
    
    .navbar-profile-section {
        transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
        max-height: 50px;
        overflow: hidden;
    }
    
    .navbar-profile-section.collapsed {
        max-height: 0;
        opacity: 0;
    }
    
    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .model-selector, 
    .params-control,
    .assistant-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .input-group #send-btn {
        width: 100%;
    }
    
    .model-container, 
    .assistant-container, 
    .parameters-container {
        margin-bottom: 8px;
        padding: 0.75rem;
    }
    
    .assistant-selector label, 
    .model-selector label, 
    .param-group label {
        font-size: 0.95rem;
    }
}

@media (max-width: 767.98px) {
    /* Increased mobile text sizes */
    body {
        font-size: 16px;
    }
    
    .message-text {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .chat-item-name {
        font-size: 0.95rem;
    }
    
    .sidebar-header h3 {
        font-size: 1.2rem;
    }
    
    .chat-title-container h2 {
        font-size: 1.25rem;
    }
    
    .welcome-message {
        font-size: 1.5rem;
    }
    
    .message-time {
        font-size: 0.8rem;
    }
    
    .chat-input textarea {
        font-size: 1rem;
    }
    
    .assistant-selector label,
    .model-selector label,
    .param-group label {
        font-size: 0.95rem;
    }
    
    .assistant-selector select {
        font-size: 0.95rem;
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-messages {
        padding: 0.8rem;
        bottom: 140px;
    }
    
    .claude-style-controls {
        left: 5px;
    }
    
    .claude-style-btn {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }
    
    .input-container {
        border-radius: 20px;
        padding: 4px 6px;
        margin-bottom: 8px;
    }
    
    .voice-btn, 
    .send-btn {
        width: 36px;
        height: 36px;
    }
    
    .assistant-container {
        padding: 6px 8px;
        border-radius: 8px;
    }
    
    .assistant-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
    
    .assistant-selector label {
        margin-bottom: 2px;
    }
    
    .assistant-selector select {
        padding: 4px 6px;
        height: 32px;
    }
    
    .chat-input {
        padding: 8px;
    }
    
    .welcome-container img {
        max-width: 120px;
    }
}

@media (max-width: 375px) {
    /* Slightly larger text for very small screens */
    body {
        font-size: 15px;
    }
    
    .message-text {
        font-size: 0.95rem;
    }
    
    .welcome-message {
        font-size: 1.3rem;
    }
    
    .chat-title-container h2 {
        font-size: 1.15rem;
    }
    
    .assistant-selector select {
        font-size: 0.9rem;
    }
    
    .chat-messages {
        bottom: 130px;
        padding: 8px;
    }
    
    .assistant-selector label {
        font-size: 0.9rem;
    }
    
    .chat-input {
        padding: 5px;
    }
    
    .voice-btn, 
    .send-btn {
        width: 32px;
        height: 32px;
    }
    
    .assistant-container {
        padding: 4px 6px;
    }
    
    .assistant-selector select {
        height: 28px;
        padding: 2px 4px;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        margin: 0 0.5rem;
    }
    
    .welcome-container img {
        max-width: 100px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .chat-container {
        height: calc(100vh - 10px);
    }
    
    .chat-sidebar {
        top: 40px;
        height: calc(100% - 40px);
    }
    
    .chat-input {
        padding: 5px;
    }
    
    .chat-input textarea {
        max-height: 40px;
        padding: 5px 10px;
    }
    
    .parameters-container {
        display: none;
    }
    
    .model-container,
    .assistant-container {
        padding: 3px;
        margin-bottom: 3px;
    }
    
    .chat-messages {
        bottom: 120px;
    }
    
    .input-container {
        margin-bottom: 5px;
    }
    
    .assistant-selector {
        flex-direction: row;
        gap: 5px;
    }
    
    .assistant-selector label {
        font-size: 0.85rem;
    }
    
    .assistant-selector select {
        height: 30px;
        padding: 2px 5px;
    }
}

/* Keyboard handling for mobile */
body.keyboard-visible .chat-messages {
    bottom: 50px;
}

body.keyboard-visible .parameters-container,
body.keyboard-visible .model-container,
body.keyboard-visible .assistant-container {
    display: none;
}

body.keyboard-visible .chat-input {
    padding: 4px;
    border-top: none;
}

body.keyboard-visible .input-container {
    margin-bottom: 0;
}

body.keyboard-visible .chat-input textarea {
    min-height: 18px;
    max-height: 36px;
}

/* ส่วนของคำถามที่พบบ่อย (FAQ) */
/* สไตล์สำหรับ FAQ */
.faq-wrapper {
    background-color: #f5f5f5;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.faq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.faq-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.faq-filter {
    width: 200px;
}

.faq-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.faq-category-container {
    margin-bottom: 15px;
}

.faq-category-title {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.faq-item {
    background-color: #fff;
    border-radius: 5px;
    padding: 10px 15px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.faq-item:hover {
    background-color: #f0f8ff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.faq-question {
    display: flex;
    align-items: center;
}

.faq-question i {
    color: #007bff;
    margin-right: 10px;
    font-size: 1rem;
}

.faq-question span {
    font-size: 0.9rem;
    color: #444;
}

/* สไตล์สำหรับสถานะ Loading */
.message-loading {
    display: flex;
    justify-content: center;
    padding: 15px;
    color: #666;
    font-style: italic;
}

.message-loading i {
    margin-right: 8px;
    color: #007bff;
}

/* แสดงผลข้อความแจ้งเตือนระบบ */
.message.system {
    padding: 8px 15px;
    margin: 10px auto;
    text-align: center;
    max-width: 80%;
}

.message.system .message-content {
    background-color: #fffde7;
    border: 1px solid #ffd600;
    border-radius: 8px;
    padding: 8px 12px;
}

.message.system .message-text {
    color: #795548;
    font-style: italic;
    font-size: 0.9rem;
}

.message.system .message-time {
    font-size: 0.7rem;
    text-align: right;
    color: #9e9e9e;
}

/* ปรับปรุงการแสดงผลในโหมดมือถือ */
@media (max-width: 768px) {
    .faq-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .faq-filter {
        width: 100%;
        margin-top: 10px;
    }
    
    .faq-question span {
        font-size: 0.85rem;
    }
}

/* CSS สำหรับปุ่มค้นหาจากเว็บไซต์ */
.search-option {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

#search-website-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

#search-website-btn:hover {
    background-color: #0056b3;
    color: white;
}

#search-website-btn i {
    font-size: 14px;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* สไตล์สำหรับแสดงผลการค้นหา */
.search-result {
    border-left: 3px solid #0d6efd;
    padding-left: 10px;
    margin: 10px 0;
}

.search-result-title {
    font-weight: bold;
    color: #0d6efd;
    margin-bottom: 5px;
}

.search-result-url {
    display: block;
    color: #28a745;
    font-size: 0.85em;
    margin-bottom: 5px;
    word-break: break-all;
}

.search-result-url:hover {
    text-decoration: underline;
}

.search-result-source {
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
}



/* สไตล์สำหรับ sidebar-resizer */
.sidebar-resizer {
    width: 8px;
    height: 100%;
    position: absolute;
    left: 300px; /* ปรับค่าให้ตรงกับความกว้างเริ่มต้นของ sidebar */
    top: 0;
    background-color: transparent;
    cursor: col-resize;
    z-index: 100;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-resizer:hover,
.sidebar-resizer.active {
    background-color: rgba(0, 123, 255, 0.1);
}

.sidebar-resizer i {
    color: #999;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar-resizer:hover i,
.sidebar-resizer.active i {
    opacity: 1;
}


/* ปรับปรุงตอนที่หน้าจอเล็ก */
@media (max-width: 768px) {
    .sidebar-resizer {
        display: none;
    }
    
   
}
