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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.chat-header h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.connection-status {
    font-size: 0.9em;
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 70%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    background: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.message.assistant {
    background: #e9ecef;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.message.system {
    background: #ffc107;
    color: #333;
    margin: 10px auto;
    text-align: center;
    max-width: 90%;
    font-size: 0.9em;
}

.chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.input-container {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
    transition: border-color 0.3s;
}

#messageInput:focus {
    border-color: #007bff;
}

#sendButton {
    padding: 12px 25px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

#sendButton:hover:not(:disabled) {
    background: #0056b3;
}

#sendButton:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.typing-indicator {
    display: inline-block;
    padding: 12px 18px;
    background: #e9ecef;
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    color: #666;
    font-style: italic;
}

.typing-dots {
    display: inline-block;
}

.typing-dots::after {
    content: '...';
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.message-time {
    font-size: 0.7em;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

.message.user .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

.message.assistant .message-time {
    text-align: left;
    color: rgba(0, 0, 0, 0.7);
}

.filters-panel {
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

.filters-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
}

.filters-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.filters-empty {
    color: #6c757d;
    font-size: 14px;
}

.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 10px;
}

.filter-item-vertical {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.filter-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.filter-label {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
}

.filter-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-control input[type="number"],
.filter-control input[type="text"],
.filter-number-input,
.filter-text-input {
    width: 180px;
    padding: 8px 10px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
}

.filter-control input[type="number"]:focus,
.filter-control input[type="text"]:focus,
.filter-number-input:focus,
.filter-text-input:focus {
    border-color: #007bff;
}

.filter-save-button {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: #007bff;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.filter-save-button:hover:not(:disabled) {
    background: #0056b3;
}

.filter-save-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.filter-value-text {
    font-size: 13px;
    color: #6c757d;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.filter-toggle input {
    display: none;
}

.filter-toggle-slider {
    width: 42px;
    height: 22px;
    background: #ced4da;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
    flex: 0 0 auto;
}

.filter-toggle-slider::after {
    content: "";
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.filter-toggle input:checked + .filter-toggle-slider {
    background: #28a745;
}

.filter-toggle input:checked + .filter-toggle-slider::after {
    transform: translateX(20px);
}

.filter-toggle-text {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
}

.filter-toggle[data-hasBinding="0"] .filter-toggle-text {
    opacity: 0.85;
}
