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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #76b852, #8DC26F);
    color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Sections */
section {
    margin-bottom: 30px;
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* Current model card */
.model-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.model-card.current {
    border-color: #76b852;
    background-color: #f8fff8;
    box-shadow: 0 0 15px rgba(118, 184, 82, 0.2);
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.model-info h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #2c3e50;
}

.model-owner {
    color: #7f8c8d;
    font-style: italic;
    margin-bottom: 15px;
}

.model-settings h4 {
    margin-bottom: 10px;
    color: #34495e;
}

.model-settings ul {
    list-style-type: none;
}

.model-settings li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

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

/* Models grid */
.controls-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-container {
    flex: 1;
    min-width: 250px;
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-container label {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.filter-container select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-container select:focus {
    outline: none;
    border-color: #76b852;
    box-shadow: 0 0 0 2px rgba(118, 184, 82, 0.2);
}

#model-search {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#model-search:focus {
    outline: none;
    border-color: #76b852;
    box-shadow: 0 0 0 2px rgba(118, 184, 82, 0.2);
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.model-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.model-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.speed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.size-badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: #e8f4f8;
    color: #2980b9;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #2980b9;
}

.model-item:hover {
    border-color: #76b852;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.model-item.selected {
    border-color: #3498db;
    background-color: #f0f8ff;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.2);
}

.model-item h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #2c3e50;
}

.model-item .model-owner {
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.switch-button {
    background-color: #76b852;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
    width: 100%;
}

.switch-button:hover {
    background-color: #5daa3d;
}

.switch-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: #27ae60;
}

.notification.error {
    background-color: #e74c3c;
}

.hidden {
    display: none;
}

/* Loading state */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #76b852;
    animation: spin 1s ease-in-out infinite;
}

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

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

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    .models-grid {
        grid-template-columns: 1fr;
    }

    section {
        padding: 15px;
    }
    
    .controls-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        width: 100%;
    }
    
    .filter-container {
        width: 100%;
        justify-content: space-between;
    }
}

/* Terminal Chat Styles */
.chat-section {
    margin-bottom: 30px;
}

.terminal-window {
    background-color: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', Courier, monospace;
}

.terminal-header {
    background-color: #2d2d2d;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3d3d3d;
}

.terminal-title {
    color: #76b852;
    font-weight: bold;
    font-size: 0.9rem;
}

.terminal-btn {
    background-color: #3d3d3d;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.terminal-btn:hover {
    background-color: #4d4d4d;
}

.terminal-output {
    height: 400px;
    overflow-y: auto;
    padding: 15px;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-size: 0.95rem;
    line-height: 1.6;
}

.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 4px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #5d5d5d;
}

.terminal-input-container {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #2d2d2d;
    border-top: 1px solid #3d3d3d;
}

.terminal-prompt {
    color: #76b852;
    font-weight: bold;
    margin-right: 10px;
    font-size: 1.1rem;
}

.terminal-input {
    flex: 1;
    background-color: transparent;
    border: none;
    color: #d4d4d4;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    outline: none;
}

.terminal-input::placeholder {
    color: #6d6d6d;
}

.chat-message {
    margin-bottom: 15px;
    padding: 8px 0;
}

.user-message {
    color: #76b852;
}

.user-message::before {
    content: "→ You: ";
    font-weight: bold;
}

.assistant-message {
    color: #4ec9b0;
}

.assistant-message::before {
    content: "← AI: ";
    font-weight: bold;
}

.system-message {
    color: #808080;
    font-style: italic;
    margin-bottom: 15px;
}

.error-message {
    color: #f48771;
}

.error-message::before {
    content: "✗ Error: ";
    font-weight: bold;
}

.loading-message {
    color: #dcdcaa;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-message::before {
    content: "⟳ ";
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
