/* AiTril Web Interface - Brand Design System */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Syne:wght@400;600;800&family=DM+Mono:wght@300;400;500&display=swap');

:root {
    /* Brand Colors - AiTril Design System */
    --color-primary: #4A5FD9;
    --color-primary-dark: #3A4FB9;
    --color-primary-darker: #2A3F99;
    --color-primary-light: #5A6FE9;

    --color-secondary: #E94C89;
    --color-secondary-dark: #D93C79;
    --color-secondary-light: #F95C99;

    --color-accent: #00D9FF;
    --color-accent-dark: #00B9DF;
    --color-accent-glow: rgba(0, 217, 255, 0.5);

    /* Backgrounds */
    --bg-primary: #0A0E1A;
    --bg-secondary: #1A1E2A;
    --bg-tertiary: #2A2E3A;
    --bg-agent: #1A1E2A;

    /* Text Colors */
    --text-primary: #E8E8F0;
    --text-secondary: #A8A8B0;
    --text-tertiary: #686870;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;

    /* Agent colors - LLM provider specific */
    --agent-gpt: #10b981;
    --agent-claude: #4A5FD9;
    --agent-gemini: #F59E0B;

    /* Status colors */
    --status-active: var(--color-accent);
    --status-waiting: #ffa500;
    --status-complete: var(--color-primary);

    /* Phase colors */
    --phase-planning: #8b5cf6;
    --phase-implementation: var(--color-primary);
    --phase-review: var(--color-accent);

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-sans: 'Syne', sans-serif;
    --font-mono: 'DM Mono', monospace;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;

    /* Transitions */
    --transition-standard: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* Main Layout */
#app {
    display: flex;
    height: 100vh;
    max-width: 1800px;
    margin: 0 auto;
}

/* Sidebar - Agent Status */
.sidebar {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo {
    font-size: 24px;
}

.app-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-secondary) 50%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Agent Status Cards */
.agents-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-card {
    background: var(--bg-agent);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 16px;
    transition: all 0.3s ease;
}

.agent-card.active {
    border-color: var(--status-active);
    box-shadow: 0 0 20px rgba(16, 163, 127, 0.2);
}

.agent-card.gpt.active {
    border-color: var(--agent-gpt);
    box-shadow: 0 0 20px rgba(16, 163, 127, 0.2);
}

.agent-card.claude.active {
    border-color: var(--agent-claude);
    box-shadow: 0 0 20px rgba(204, 120, 92, 0.2);
}

.agent-card.gemini.active {
    border-color: var(--agent-gemini);
    box-shadow: 0 0 20px rgba(66, 133, 244, 0.2);
}

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

.agent-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}

.planner-badge {
    font-size: 14px;
    margin-left: 4px;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.6));
    animation: gentle-glow 2s ease-in-out infinite;
}

@keyframes gentle-glow {
    0%, 100% {
        filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
    }
}

.agent-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-complete);
}

.status-dot.active {
    background: var(--status-active);
    animation: pulse 2s ease-in-out infinite;
}

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

.agent-progress {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* Phase Indicator */
.phase-indicator {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-top: auto;
}

.phase-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.phases {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phase {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.phase.active {
    background: var(--bg-agent);
    color: var(--text-primary);
    font-weight: 600;
}

.phase-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
}

.phase.active .phase-dot {
    background: var(--status-active);
}

.phase.planning.active .phase-dot {
    background: var(--phase-planning);
}

.phase.implementation.active .phase-dot {
    background: var(--phase-implementation);
}

.phase.review.active .phase-dot {
    background: var(--phase-review);
}

/* Main Chat Area */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mode-selector {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--border-radius);
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: var(--bg-primary);
}

.mode-btn.active {
    background: linear-gradient(90deg, var(--color-accent), var(--color-secondary));
    color: var(--bg-primary);
    font-weight: 600;
    box-shadow: 0 4px 12px var(--color-accent-glow);
}

.info-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.info-btn:hover {
    background: var(--bg-primary);
    color: var(--text-secondary);
    transform: scale(1.1);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    max-width: 800px;
    animation: fadeIn 0.3s ease-in;
}

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

.message.user {
    margin-left: auto;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 12px;
}

.message-avatar.user {
    background: #6b6b6b;
}

.message-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    font-size: 15px;
    line-height: 1.7;
}

.message.user .message-content {
    background: var(--bg-agent);
}

/* Status Messages */
.message.status {
    max-width: 800px;
    margin: 0 auto;
}

.message-content.status-message {
    background: #e8f5e9;
    border-left: 4px solid var(--status-active);
    color: var(--text-primary);
    font-weight: 500;
}

/* Agent Response Group */
.agent-response-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.agent-response {
    display: flex;
    gap: 12px;
}

.agent-response .message-avatar {
    flex-shrink: 0;
}

.agent-response.gpt .message-avatar {
    background: var(--agent-gpt);
}

.agent-response.claude .message-avatar {
    background: var(--agent-claude);
}

.agent-response.gemini .message-avatar {
    background: var(--agent-gemini);
}

.agent-response-content {
    flex: 1;
}

/* Code blocks */
.message-content pre {
    background: var(--text-primary);
    color: #f0f0f0;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 14px;
    margin: 12px 0;
}

.message-content code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

.message-content pre code {
    background: transparent;
    padding: 0;
}

/* Input Area */
.input-container {
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.input-field {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    font-family: var(--font-sans);
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-color: var(--status-active);
}

.send-btn {
    padding: 14px 24px;
    background: var(--status-active);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: #0d8c6d;
}

.send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: bounce 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Mode Info Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-in;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    transform: rotate(90deg);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-right: 40px;
}

.modal-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Deployment Selector */
.deployment-selector {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    margin: 16px 0;
}

.deployment-selector h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.deployment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deployment-option {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.deployment-option:hover {
    border-color: var(--status-active);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.deployment-option-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.deployment-option-header input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.deployment-option-header label {
    flex: 1;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
}

.deployment-option-description {
    margin: 0;
    padding-left: 32px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.deployment-option input[type="radio"]:checked + label {
    color: var(--status-active);
    font-weight: 600;
}

.phase.deployment.active .phase-dot {
    background: #f59e0b;
}

/* ============================================
   SETTINGS PAGE STYLES
   ============================================ */

/* Settings Button */
.settings-btn {
    padding: 8px 16px;
    background: rgba(74, 95, 217, 0.2);
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9em;
    transition: all var(--transition-standard);
}

.settings-btn:hover {
    background: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(74, 95, 217, 0.4);
    transform: translateY(-1px);
}

/* Settings Modal Overlay - Initially Hidden */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* Modal Content */
.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 2em;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* Settings Content */
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Provider/Deployment Cards */
.providers-list,
.deployments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.provider-card,
.deployment-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.provider-card:hover,
.deployment-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.provider-header,
.deployment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.provider-header h3,
.deployment-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-primary);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: #10b981;
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Form Groups */
.provider-details,
.deployment-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group select {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95em;
    transition: all 0.2s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[type="text"]:read-only {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-group select {
    cursor: pointer;
}

/* Buttons */
.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* General Settings */
.general-settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 500px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .settings-tabs {
        flex-direction: column;
    }

    .settings-content {
        padding: 16px;
    }

    .provider-card,
    .deployment-card {
        padding: 16px;
    }
}
