/* Mission Control Dashboard Styles */

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

:root {
    --primary-bg: #0a0e1a;
    --secondary-bg: #1a1f2e;
    --card-bg: #242938;
    --border-color: #2d3748;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --accent-blue: #667eea;
    --accent-purple: #764ba2;
    --status-online: #48bb78;
    --status-idle: #ed8936;
    --status-offline: #e53e3e;
    --status-maintenance: #805ad5;
}

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

.mission-control {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.online {
    background: var(--status-online);
}

.separator {
    color: var(--text-muted);
}

.uptime {
    color: var(--status-online);
    font-weight: 500;
}

.header-right {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.current-time {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

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

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--secondary-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

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

.nav-item.active {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
}

.nav-icon {
    font-size: 1rem;
}

.nav-text {
    flex: 1;
    font-weight: 500;
}

.nav-count {
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* System Metrics */
.system-metrics {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: auto;
}

.metric {
    margin-bottom: 1rem;
}

.metric:last-child {
    margin-bottom: 0;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-trend {
    font-size: 0.875rem;
    color: var(--status-online);
}

.metric-bar {
    background: var(--border-color);
    height: 4px;
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.metric-fill {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Dashboard */
.dashboard {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-controls {
    display: flex;
    gap: 1rem;
}

.control-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.control-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Agent Cards Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.agent-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-blue);
}

.agent-card.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--status-online), #68d391);
}

.agent-card.idle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--status-idle), #fbb040);
}

.agent-card.maintenance::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--status-maintenance), #b794f6);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
}

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

.agent-avatar.brandley {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
}

.agent-avatar.charlie {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.agent-avatar.marley {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.agent-avatar.selma {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.agent-avatar.felix {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.agent-details {
    flex: 1;
}

.agent-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.agent-role {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.agent-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.agent-status.online,
.agent-status.active {
    background: rgba(72, 187, 120, 0.1);
    color: var(--status-online);
    border: 1px solid var(--status-online);
}

.agent-status.idle {
    background: rgba(237, 137, 54, 0.1);
    color: var(--status-idle);
    border: 1px solid var(--status-idle);
}

.agent-status.maintenance {
    background: rgba(128, 90, 213, 0.1);
    color: var(--status-maintenance);
    border: 1px solid var(--status-maintenance);
}

/* Projects */
.agent-projects {
    margin-bottom: 1.5rem;
}

.project {
    background: var(--secondary-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.project:last-child {
    margin-bottom: 0;
}

.project-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.project-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.progress-bar {
    flex: 1;
    background: var(--border-color);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
}

.progress-bar .fill.complete {
    background: linear-gradient(135deg, var(--status-online), #68d391);
}

.progress-bar .fill.planned {
    background: linear-gradient(135deg, var(--text-muted), #a0aec0);
}

.progress-bar .fill.setup {
    background: linear-gradient(135deg, var(--status-maintenance), #b794f6);
}

/* Agent Metrics */
.agent-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Load More */
.load-more {
    text-align: center;
    padding: 2rem 0;
}

.load-more-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.load-more-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 1200px) {
    .agents-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: 2;
    }

    .dashboard {
        order: 1;
        padding: 1rem;
    }

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

    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header-left {
        flex-direction: column;
        gap: 1rem;
    }

    .system-status {
        flex-wrap: wrap;
        justify-content: center;
    }
}


/* ==========================================================
   BACK BUTTON
   ========================================================== */

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 1.25rem;
    transition: color 150ms ease;
}

.back-btn:hover {
    color: #f1f5f9;
}

.back-arrow {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    transition: transform 150ms ease;
}

.back-btn:hover .back-arrow {
    transform: translateX(-2px);
}


/* ==========================================================
   MESSAGE BOARD — VIEW HEADER
   ========================================================== */

.view-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.view-title-row h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-selector-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.profile-select {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.profile-select:focus {
    border-color: #3b82f6;
}

.profile-select option {
    background: var(--card-bg);
}


/* ==========================================================
   MESSAGE COMPOSER
   ========================================================== */

.msg-composer {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.composer-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    transition: background 0.2s ease;
}

.composer-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.composer-textarea {
    background: transparent;
    border: none;
    outline: none;
    color: #f1f5f9;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: none;
    width: 100%;
    min-height: 80px;
}

.composer-textarea::placeholder {
    color: #475569;
}

.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.char-counter {
    font-size: 0.8125rem;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.post-btn {
    background: #3b82f6;
    border: none;
    color: white;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.post-btn:hover:not(:disabled) {
    background: #2563eb;
}

.post-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ==========================================================
   MESSAGE FEED & CARDS
   ========================================================== */

.msg-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
}

.msg-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1.25rem;
    animation: msgFadeIn 0.25s ease;
}

.msg-card--pinned {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.03);
}

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

.pin-indicator {
    font-size: 0.75rem;
    color: #f59e0b;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.03em;
}

.msg-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.875rem;
    gap: 0.75rem;
}

.msg-author-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.msg-author-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.msg-author-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #f1f5f9;
}

.msg-author-role {
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
}

.msg-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.msg-timestamp {
    font-size: 0.8125rem;
    color: #64748b;
}

.msg-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 4px 6px;
    border-radius: 6px;
    color: #64748b;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
}

.msg-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.msg-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.msg-content {
    font-size: 0.9375rem;
    color: #e2e8f0;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 1rem;
}


/* ==========================================================
   REACTIONS
   ========================================================== */

.msg-reactions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.reaction-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, border-color 0.15s ease;
    color: inherit;
    line-height: 1;
}

.reaction-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #475569;
}

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

.reaction-count {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}


/* ==========================================================
   EMPTY STATE
   ========================================================== */

.msg-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    max-width: 800px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    font-size: 0.9375rem;
    color: #64748b;
}


/* ==========================================================
   MESSAGE BOARD RESPONSIVE
   ========================================================== */

@media (max-width: 768px) {
    .view-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .msg-composer,
    .msg-feed,
    .msg-empty {
        max-width: 100%;
    }

    .msg-header-actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}