/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* Styles for the new "My Agents" view */
.my-agents-grid {
    display: grid;
    /* Cria colunas responsivas que se ajustam ao tamanho da tela */
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    padding: 24px 0;
}

.my-agent-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    overflow: hidden; /* Garante que elementos internos não vazem */
}

.my-agent-card:hover {
    transform: translateY(-5px);
    /* Sombra sutil com a cor de destaque para um efeito "glow" */
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.1), 0 0 15px rgba(118, 75, 162, 0.1);
    border-color: var(--border-secondary);
}

.my-agent-card__header {
    display: flex;
    align-items: center; /* Alinha avatar e texto verticalmente */
    gap: 16px;
    margin-bottom: 20px;
}

.my-agent-card__header .agent-avatar {
    width: 56px;
    height: 56px;
    font-size: 24px;
    flex-shrink: 0; /* Impede que o avatar encolha */
    border: 2px solid var(--border-secondary);
}

.my-agent-card__info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.my-agent-card__info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 4px 0 0;
    line-height: 1.4;
    /* Garante que o texto não quebre o layout */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-agent-card__details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background-color: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.my-agent-card__details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background-color: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.my-agent-card__details .detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.my-agent-card__details .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.my-agent-card__details .value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-agent-card__details .model-value {
    color: var(--accent-primary);
    font-weight: 600;
}

/* --- Badges de Status e Sistema --- */
.agent-tag, .system-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
    border: 1px solid transparent;
}

.agent-tag.public {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.agent-tag.private {
    background-color: rgba(128, 128, 128, 0.1);
    color: var(--text-secondary);
    border-color: rgba(128, 128, 128, 0.3);
}


.my-agent-card__stats {
    display: flex;
    justify-content: space-around;
    background-color: var(--bg-primary); /* Fundo mais escuro para destaque */
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.stat-item {
    text-align: center;
}

.stat-item .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.my-agent-card__actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.my-agent-card__actions {
    margin-top: auto; /* Empurra os botões para a base do card */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.my-agent-card__actions .btn-action {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* Espaço entre ícone e texto */
}

.my-agent-card__actions .btn-action:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}


/* Card meta item for clone count */
.agent-meta .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.agent-meta .stat-item svg {
    flex-shrink: 0;
}


/* Enhanced Modal Styles */
.modal.wide {
    max-width: 700px;
}

.modal-agent-header {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
}

.modal-agent-info {
    flex: 1;
}

.modal-agent-persona {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.modal-agent-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.clone-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-primary);
}

.precision-mode-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(102, 126, 234, 0.1); /* Cor do gradiente do logo */
    color: #667eea;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    width: fit-content;
}

.precision-mode-indicator svg {
    flex-shrink: 0;
}

.modal-section h4 {
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Alinha os itens à esquerda */
}
.modal-memories-container {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.identity-preview-item {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-style: italic;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}


/* =================================
   Mind Visualization Widgets
   ================================= */
.mind-widgets-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 16px;
    margin-left: 16px;
    border-left: 1px solid var(--border-primary);
}

.mind-widget-btn {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition-fast);
    position: relative;
}

.mind-widget-btn:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: scale(1.1);
}

.mind-popover {
    display: none; /* Hidden by default */
    position: absolute;
    top: 75px; /* Position below the header */
    right: 24px;
    width: 350px;
    max-width: 90vw;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1010;
    animation: fadeInUp 0.2s ease-out;
}

.mind-popover.visible {
    display: block;
}

.popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
}

.popover-header h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.popover-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.popover-content {
    padding: 16px;
    max-height: 40vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Specific popover content styles */
.memory-item-popover {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    border-left: 3px solid var(--accent-secondary);
}
.memory-item-popover .memory-type-badge {
    float: right;
    margin-left: 8px;
}
.memory-item-popover p {
    color: var(--text-secondary);
    margin: 0;
    font-style: italic;
}

.coherence-state-display {
    text-align: center;
    padding: 10px;
}
.coherence-state-display .state-value {
    font-size: 20px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    color: var(--accent-primary);
    text-transform: capitalize;
}

.identity-evolution-display {
    font-size: 13px;
}
.identity-evolution-display .identity-part {
    margin-bottom: 10px;
}
.identity-evolution-display .identity-part strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}
.identity-evolution-display .identity-part p {
    color: var(--text-secondary);
    margin: 0;
    padding-left: 10px;
    border-left: 2px solid var(--border-secondary);
}


.my-agent-card__actions .btn-danger {
    color: var(--error);
}

.my-agent-card__actions .btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ff8a8a;
}

.stat-item {
    text-align: center;
}

.stat-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.my-agent-card-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.my-agent-card-actions .btn-action {
    background-color: var(--background-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.my-agent-card-actions .btn-action:hover {
    background-color: var(--background-hover);
}

.my-agent-card-actions .btn-danger {
    color: var(--error);
}

.my-agent-card-actions .btn-danger:hover {
    background-color: #fed7d7;
}

:root {
    /* Character.AI inspired color palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-quaternary: #202020;
    
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --text-disabled: #4d4d4d;
    
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    
    --border-primary: #2a2a2a;
    --border-secondary: #3a3a3a;
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 60px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 400ms ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-normal);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}


/* Marketplace-specific styles */
.marketplace-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
}

.marketplace-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.agent-badges {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.system-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-badge.ncf {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.system-badge.ceaf {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.public-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.agent-description {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
    flex: 1;
    margin: 0;
}

.agent-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-secondary);
}

.agent-meta .owner {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.agent-meta .capabilities {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-secondary);
}

.chat-btn, .clone-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.chat-btn {
    background: var(--accent-primary);
    color: white;
}

.chat-btn:hover {
    background: #3b82f6;
    transform: translateY(-1px);
}

.clone-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.clone-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
}

/* Featured section updates */
.featured-agents h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.featured-agents h2 span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Agent options modal */
.owner-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* No agents message */
.no-agents-message h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.no-agents-message p {
    margin: 0;
    font-size: 14px;
}

/* Error message */
.error-message h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.error-message p {
    margin: 0 0 24px 0;
    font-size: 14px;
}

/* Loading states for marketplace */
.marketplace-loading {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.marketplace-skeleton {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    height: 200px;
    position: relative;
    overflow: hidden;
}

.marketplace-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .marketplace-card {
        min-height: auto;
    }

    .card-actions {
        flex-direction: column;
    }

    .chat-btn, .clone-btn {
        width: 100%;
    }

    .featured-agents h2 {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .agent-meta {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
}

/* Enhanced modal styles for agent options */
.modal-header .agent-avatar {
    background: var(--accent-gradient);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* =================================
   Footer Styles
   ================================= */
.page-footer {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 40px 20px;
    margin-top: auto; /* Pushes footer to the bottom if content is short */
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links,
.footer-legal {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Important for responsiveness */
}

.footer-links {
    gap: 24px;
    font-size: 15px;
}

.footer-legal {
    gap: 16px;
    font-size: 13px;
    font-weight: 500;
}

.footer-links a,
.footer-legal a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover,
.footer-legal a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* In-Chat Model Selector */
.model-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.model-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-selector {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 250px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.model-selector:hover {
    border-color: var(--border-secondary);
}

.model-selector:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.model-selector.updating {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
}

/* =================================
   Memory Management Modal
   ================================= */
.modal.wide {
    max-width: 800px;
}

.modal .tabs {
    display: flex;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 24px;
}

.modal .tab {
    padding: 12px 20px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.modal .tab:hover {
    color: var(--text-primary);
}

.modal .tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.3s ease-out;
}

/* Browse & Edit Tab */
.memory-list-container {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
}

.memory-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.memory-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.memory-type-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-gradient);
    color: white;
}

.memory-actions button {
    background: none;
    border: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 8px;
}
.memory-actions button:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

.memory-content-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.memory-content-text p {
    margin: 0;
}

.memory-content-text textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-quaternary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    font-size: 14px;
}

/* Upload Tab */
.file-upload-area {
    border: 2px dashed var(--border-secondary);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}
.file-upload-area:hover, .file-upload-area.dragover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}
.file-upload-area .upload-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.upload-progress-container {
    margin-top: 20px;
}
.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Export & Analytics Tabs */
.memory-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}
.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-primary);
}
.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.analytics-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 20px;
}
.analytics-card h4 {
    margin-bottom: 16px;
    font-weight: 600;
}
.analytics-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 10px;
}
.analytics-item span:first-child {
    color: var(--text-secondary);
}
.analytics-item span:last-child {
    font-weight: 500;
    color: var(--text-primary);
}

.placeholder-text {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}
/* Agent Sidebar Item Actions */
.agent-item-actions {
    display: none; /* Hidden by default */
    margin-left: auto; /* Pushes to the right */
}
.agent-item:hover .agent-item-actions {
    display: flex; /* Show on hover */
    gap: 4px;
}
.agent-item-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-muted);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.agent-item-btn:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

/* Agent Details Modal - Founding Memories */
.founding-memories {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-primary);
}

.founding-memories h4 {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.memory-preview-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}

.memory-preview-item .memory-type-badge {
    float: right;
    margin-left: 8px;
}

.memory-preview-item p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    font-style: italic;
}

/* Styles for "Add New Memory" button and form */
.memory-browse-actions {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 20px;
}

.add-memory-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.add-memory-btn:hover {
    background: #5a67d8; /* A slightly darker shade */
}

.add-memory-form {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease-out;
}

.add-memory-form h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.add-memory-form .form-group {
    margin-bottom: 16px;
}

.add-memory-form .form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.add-memory-form textarea,
.add-memory-form select,
.add-memory-form input[type="range"] {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    padding: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.add-memory-form textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.form-actions button {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-secondary);
}

.footer-divider {
    border: none;
    height: 1px;
    background-color: var(--border-primary);
    margin: 24px auto;
}

.modal-content .btn {
    padding: 12px 24px;
    font-weight: 500;
}

.modal-content .btn svg {
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-text {
    transition: opacity var(--transition-fast);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.create-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 24px;
}

.create-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.sidebar.collapsed .create-btn {
    padding: 12px 8px;
}

.sidebar.collapsed .create-btn span {
    display: none;
}

.sidebar-nav {
    margin-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.nav-item:hover,
.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-quaternary);
}

.agents-section {
    flex: 1;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.agents-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.agent-item:hover {
    background: var(--bg-tertiary);
}

.agent-item.active {
    background: var(--bg-quaternary);
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.agent-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    border-top: 1px solid var(--border-primary);
    padding: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background var(--transition-fast);
}

.user-profile:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}

.username {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.user-menu-btn:hover {
    color: var(--text-primary);
}

.user-menu {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
}

.user-menu a {
    display: block;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.user-menu a:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
    transition: margin-left var(--transition-normal);
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.view {
    height: 100vh;
    overflow-y: auto;
}

/* Discover View */
.discover-header {
    text-align: center;
    padding: 80px 40px 60px;
    max-width: 800px;
    margin: 0 auto;
}

.discover-header h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.discover-header p {
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.discover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    padding: 0 40px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.discover-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.discover-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.featured-agents {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.featured-agents h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.featured-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.featured-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.featured-card .agent-avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
    margin-bottom: 12px;
}

.featured-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.featured-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Chat View */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    flex-wrap: wrap;
     gap: 16px;
}

.agent-capabilities {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto; /* Push to the right */
}

.connections-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 24px;
    border-right: 1px solid var(--border-primary);
}

.connection-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

.connection-icon svg {
    width: 18px;
    height: 18px;
}

.live-memory-controls {
    display: flex;
    gap: 20px;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

/* The switch - a label containing a hidden checkbox and a span */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

/* Hide default HTML checkbox */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--accent-primary);
}

input:checked + .slider:before {
    -webkit-transform: translateX(18px);
    -ms-transform: translateX(18px);
    transform: translateX(18px);
    background-color: white;
}

/* Agent Avatar Images */
.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.featured-card .agent-avatar {
    overflow: hidden; /* Ensure image stays within border-radius */
}

/* Chat Header Dropdown Menu */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    min-width: 180px;
    padding: 8px;
}

.dropdown-menu a {
    color: var(--text-secondary);
    padding: 10px 12px;
    text-decoration: none;
    display: block;
    border-radius: 6px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.dropdown-menu a:hover {
    background-color: var(--bg-quaternary);
    color: var(--text-primary);
}

/* Agent Profile Modal Styles */
.profile-avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
}
.profile-avatar-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-gradient);
    font-size: 48px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    border: 3px solid var(--bg-tertiary);
}
#profile-modal-agent-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* Agent Files Modal Styles */
#files-list-container {
    max-height: 40vh;
    overflow-y: auto;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 20px;
}
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 6px;
}
.file-item:nth-child(odd) {
    background-color: var(--bg-secondary);
}
.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-info span {
    font-size: 14px;
    color: var(--text-secondary);
}
.file-size {
    font-size: 12px;
    color: var(--text-muted);
    background-color: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

input:disabled + .slider {
    cursor: not-allowed;
    opacity: 0.5;
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.agent-info .agent-avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.agent-details h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

.agent-details p {
    font-size: 14px;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    height: calc(100vh - 140px);
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease-out;
}

.message.user {
    flex-direction: row-reverse;
}

.message .agent-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message:not(.user) .message-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
}

.message.user .message-content {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

.message.typing .message-content {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-style: italic;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingDots 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.chat-input-container {
    position: sticky;
    bottom: 0;
    padding: 20px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
}

.chat-input {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-fast);
}

.chat-input input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    transform: none;
}

/* Create View */
.create-header {
    text-align: center;
    padding: 60px 40px 40px;
}

.create-header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.create-header p {
    font-size: 18px;
    color: var(--text-secondary);
}

.create-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 40px 40px;
}

.creation-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.type-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.type-option:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.type-option.active {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.05);
}

.type-icon {
    font-size: 32px;
    margin-bottom: 16px;
}

.type-option h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.type-option p {
    color: var(--text-secondary);
    font-size: 14px;
}

.creation-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 32px;
}

.agent-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all var(--transition-fast);
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.system-type-selector label {
    margin-bottom: 12px;
}

.system-options {
    display: flex;
    gap: 12px;
}

.system-option {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.system-option:hover {
    border-color: var(--border-secondary);
}

.system-option.active {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
}

.system-badge {
    font-weight: 600;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-ceaf {
    background: var(--accent-primary);
    color: white;
}

.system-ncf {
    background: var(--success);
    color: white;
}

.btn-create {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 16px;
}

.btn-create:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-create:disabled {
    background: var(--bg-tertiary);
    color: var(--text-disabled);
    cursor: not-allowed;
}

.prebuilt-agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.prebuilt-agent-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.prebuilt-agent-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.prebuilt-agent-card.selected {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 24px;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-content {
    padding: 24px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.auth-tab.active {
    background: var(--accent-gradient);
    color: white;
}

.btn-auth {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 16px;
}

.btn-auth:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.link {
    color: var(--accent-primary);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .discover-header {
        padding: 40px 20px 30px;
    }
    
    .discover-header h1 {
        font-size: 32px;
    }
    
    .discover-header p {
        font-size: 16px;
    }
    
    .discover-grid,
    .featured-agents,
    .create-content {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .creation-type-selector {
        grid-template-columns: 1fr;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .modal {
        margin: 20px;
        width: auto;
    }
}

@media (max-width: 480px) {
    .discover-header h1 {
        font-size: 28px;
    }
    
    .discover-grid {
        grid-template-columns: 1fr;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .system-options {
        flex-direction: column;
    }
}