/* Reset and base styles - Claude-inspired theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #171717;
    color: #f0f0f0;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #171717;
}

/* Header - Claude-inspired */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: #f0f0f0;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.1) 0%, rgba(45, 212, 191, 0.1) 100%);
    border-radius: 20px;
    border: 1px solid rgba(123, 97, 255, 0.2);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: linear-gradient(135deg, #7b61ff 0%, #2dd4bf 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header .subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    font-weight: 300;
    max-width: 800px;
    margin: 0 auto;
    color: #b0b0b0;
}

/* Main content layout */
.main-content {
    display: flex;
    gap: 30px;
    flex: 1;
    margin-bottom: 30px;
}

/* Sidebar */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    flex-shrink: 0;
}

.sidebar-section {
    background: rgba(30, 30, 30, 0.8);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(123, 97, 255, 0.2);
    transition: all 0.3s ease;
}

.sidebar-section:hover {
    border-color: rgba(123, 97, 255, 0.4);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.sidebar-section h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Configuration panel */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.provider-config {
    padding: 20px;
    border-radius: 12px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(123, 97, 255, 0.3);
    transition: all 0.3s ease;
}

.provider-config:hover {
    border-color: rgba(123, 97, 255, 0.6);
    box-shadow: 0 4px 20px rgba(123, 97, 255, 0.2);
}

.provider-config h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toggle switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.toggle-checkbox {
    display: none;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    background-color: #444;
    border-radius: 13px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-label::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #f0f0f0;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-checkbox:checked + .toggle-label {
    background-color: #7b61ff;
}

.toggle-checkbox:checked + .toggle-label::after {
    transform: translateX(24px);
}

/* API key input */
.api-key-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
    background: rgba(50, 50, 50, 0.8);
    color: #f0f0f0;
}

.api-key-input:focus {
    outline: none;
    border-color: #7b61ff;
    box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.2);
}

/* Model selection */
.model-selection {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-selection label {
    font-weight: 500;
    color: #b0b0b0;
}

.model-select {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(50, 50, 50, 0.8);
    color: #f0f0f0;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.model-select:focus {
    outline: none;
    border-color: #7b61ff;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #7b61ff 0%, #2dd4bf 100%);
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(123, 97, 255, 0.4);
}

.btn-secondary {
    background: rgba(60, 60, 60, 0.8);
    color: #b0b0b0;
    border: 1px solid #444;
}

.btn-secondary:hover {
    background: rgba(80, 80, 80, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#save-config {
    margin-top: 10px;
    width: 100%;
}

#load-config {
    width: 100%;
}

/* Status panel */
.status-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #444;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-weight: 500;
    color: #b0b0b0;
}

.status-value {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-value.healthy {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.status-value.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

/* Chat container */
.chat-container {
    flex: 1;
    background: rgba(30, 30, 30, 0.8);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(123, 97, 255, 0.3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-container:hover {
    border-color: rgba(123, 97, 255, 0.5);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid #444;
    background: rgba(40, 40, 40, 0.9);
}

.provider-selector {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.provider-selector label {
    font-weight: 500;
    color: #4a5568;
}

.provider-select, .model-select {
    padding: 10px 15px;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(50, 50, 50, 0.8);
    color: #f0f0f0;
    cursor: pointer;
    min-width: 180px;
}

#new-chat {
    margin-left: auto;
}

/* Chat messages */
.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.9) 0%, rgba(30, 30, 30, 0.9) 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 60vh;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.welcome-message i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #7b61ff;
}

.welcome-message h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #7b61ff 0%, #2dd4bf 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-message p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 15px;
    color: #b0b0b0;
}

.message {
    max-width: 80%;
    padding: 18px 22px;
    border-radius: 18px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #7b61ff 0%, #2dd4bf 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(123, 97, 255, 0.3);
}

.message.assistant {
    align-self: flex-start;
    background: rgba(60, 60, 60, 0.9);
    color: #f0f0f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-left: 3px solid #7b61ff;
}

.message.system {
    align-self: center;
    background: rgba(45, 212, 191, 0.1);
    color: #2dd4bf;
    border-radius: 8px;
    font-size: 0.9rem;
    max-width: 90%;
    border: 1px solid rgba(45, 212, 191, 0.3);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.message-content {
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.loading .message-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.message.loading .message-content::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #7b61ff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Chat input */
.chat-input-container {
    padding: 20px 25px;
    border-top: 1px solid #444;
    background: rgba(40, 40, 40, 0.9);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-input {
    width: 100%;
    padding: 18px 20px;
    border: 1px solid #444;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
    line-height: 1.5;
    background: rgba(50, 50, 50, 0.8);
    color: #f0f0f0;
}

.message-input:focus {
    outline: none;
    border-color: #7b61ff;
    box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.2);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stream-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-weight: 500;
    color: #b0b0b0;
    cursor: pointer;
}

.input-hint {
    margin-top: 15px;
    padding: 12px 16px;
    background: rgba(45, 212, 191, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2dd4bf;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(45, 212, 191, 0.3);
}

.input-hint i {
    font-size: 1.1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.95rem;
    opacity: 0.9;
    border-top: 1px solid #444;
    margin-top: 30px;
}

.footer a {
    color: #7b61ff;
    text-decoration: none;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #2dd4bf;
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: rgba(30, 30, 30, 0.95);
    margin: 5% auto;
    width: 80%;
    max-width: 700px;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid rgba(123, 97, 255, 0.3);
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #7b61ff 0%, #2dd4bf 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    font-size: 2rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

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

.modal-body {
    padding: 30px;
}

.modal-body h3 {
    margin: 20px 0 15px;
    color: #f0f0f0;
}

.modal-body ul {
    list-style-position: inside;
    margin-bottom: 25px;
}

.modal-body li {
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #444;
}

.modal-body code {
    background: rgba(50, 50, 50, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #7b61ff;
}

.modal-body pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .chat-messages {
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .sidebar-section {
        padding: 20px;
    }

    .provider-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .provider-select, .model-select {
        width: 100%;
    }

    #new-chat {
        margin-left: 0;
        width: 100%;
    }

    .input-actions {
        flex-wrap: wrap;
    }

    .btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}