/* Ameck Copilot - Modern Dark Theme Styles */

:root {
    /* Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --accent-primary: #238636;
    --accent-secondary: #2ea043;
    --accent-blue: #58a6ff;
    --accent-purple: #a371f7;
    --accent-orange: #d29922;
    
    --border-color: #30363d;
    --border-subtle: #21262d;
    
    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
    --info: #58a6ff;
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 60px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-blue);
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background-color: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.new-chat-btn svg {
    width: 18px;
    height: 18px;
}

.new-chat-btn:hover {
    background-color: var(--accent-secondary);
}

.model-selector {
    margin-top: 12px;
}

.model-selector label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.model-selector select {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.model-selector select:hover {
    border-color: var(--accent-primary);
}

.model-selector select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.model-info {
    margin-top: 12px;
    text-align: center;
}

.model-badge {
    display: inline-block;
    padding: 4px 12px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-primary);
}

/* Views */
.view {
    display: none;
    flex: 1;
    overflow: hidden;
}

.view.active {
    display: flex;
}

/* Chat View */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome Message */
.welcome-message {
    max-width: 720px;
    margin: auto;
    text-align: center;
    padding: 48px 24px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-lg);
    color: white;
}

.welcome-icon svg {
    width: 40px;
    height: 40px;
}

.welcome-message h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
}

.welcome-message > p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.capability-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 480px;
    margin: 0 auto;
}

.capability-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.capability-card:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.capability-card svg {
    width: 28px;
    height: 28px;
    color: var(--accent-blue);
}

.capability-card span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Chat Messages */
.message {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
}

.message.user {
    background-color: var(--bg-secondary);
}

.message.assistant {
    background-color: transparent;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background-color: var(--accent-blue);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    margin: 16px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.message-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}

.message-content pre code {
    display: block;
    padding: 16px;
    background-color: var(--bg-tertiary);
    overflow-x: auto;
}

.message-content :not(pre) > code {
    padding: 2px 6px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 13px;
}

.message-content ul, .message-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message-content li {
    margin-bottom: 6px;
}

.message-content h1, .message-content h2, .message-content h3 {
    margin: 20px 0 12px;
    font-weight: 600;
}

.message-content h1 {
    font-size: 24px;
}

.message-content h2 {
    font-size: 20px;
}

.message-content h3 {
    font-size: 16px;
}

/* Code blocks with copy button */
.code-block-wrapper {
    position: relative;
    margin: 16px 0;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--bg-hover);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 1px solid var(--border-color);
}

.code-block-language {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

.code-block-wrapper pre {
    margin: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Chat Input */
.chat-input-container {
    padding: 16px 24px 24px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: var(--accent-secondary);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

.input-footer {
    max-width: 900px;
    margin: 8px auto 0;
    text-align: center;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Code Analysis View */
.code-analysis-container,
.generate-container {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.code-analysis-container h2,
.generate-container h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.code-input-section {
    margin-bottom: 16px;
}

.code-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.code-header select {
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

#codeInput {
    width: 100%;
    height: 250px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

#codeInput:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.operation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.op-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.op-btn svg {
    width: 18px;
    height: 18px;
    color: var(--accent-blue);
}

.op-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-blue);
}

.analysis-result,
.generated-code {
    flex: 1;
    min-height: 200px;
    padding: 24px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-y: auto;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.result-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Generate View */
.generate-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group textarea,
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background-color: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.generate-btn svg {
    width: 20px;
    height: 20px;
}

.generate-btn:hover {
    background-color: var(--accent-secondary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(13, 17, 23, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-spinner span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--bg-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left var(--transition-normal);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .capability-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .operation-buttons {
        justify-content: center;
    }
}
