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

:root {
    --background: #0a0a0a;
    --background-card: #111111;
    --background-hover: #1a1a1a;
    --foreground: #ffffff;
    --foreground-muted: #8a8a8a;
    --primary: #00ffc8;
    --primary-hover: #00e6b5;
    --primary-glow: rgba(0, 255, 200, 0.3);
    --border: #1a1a1a;
    --border-focus: #00ffc8;
    --error: #ff4757;
    --success: #25ba3b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

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

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.lang-select {
    padding: 0.5rem 1rem;
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--foreground);
    font-size: 0.85rem;
    cursor: pointer;
}

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

.search-filter {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 300px;
}

.form-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--foreground);
    font-size: 0.9rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-control {
    padding: 0.75rem 1rem;
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--foreground);
    font-size: 0.9rem;
    min-width: 180px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.category-filter {
    display: flex;
    align-items: center;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-actions .form-control {
    min-width: 150px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-secondary {
    background: var(--background-card);
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-focus);
}

.btn-outline {
    background: transparent;
    color: var(--foreground-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    border-color: var(--border-focus);
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.agent-card {
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

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

.agent-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    overflow: hidden;
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-info { flex: 1; }

.agent-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.agent-description {
    color: var(--foreground-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.agent-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.agent-category,
.agent-specialty {
    padding: 0.25rem 0.75rem;
    background: rgba(0, 255, 200, 0.1);
    border-radius: 4px;
    color: var(--primary);
}

.agent-specialty {
    background: rgba(255, 255, 255, 0.05);
    color: var(--foreground-muted);
}

.agent-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    align-items: center;
}

.favorite-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--foreground-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
}

.favorite-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.favorite-btn.active {
    color: var(--primary);
    border-color: var(--primary);
}

.favorites-section {
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.favorites-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.favorites-section .section-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.favorites-section .favorite-icon {
    color: var(--primary);
}
.favorites-section .favorites-count {
    color: var(--foreground-muted);
    font-size: 0.9rem;
}
.favorites-section .favorites-content {
    margin-top: 1rem;
}

.favorites-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.favorite-card {
    background: rgba(0, 255, 200, 0.05);
    border: 1px solid rgba(0, 255, 200, 0.2);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
    width: 260px;
    flex-shrink: 0;
}

.favorite-card:hover {
    border-color: var(--primary);
    background: rgba(0, 255, 200, 0.1);
    transform: translateY(-2px);
}

.favorite-card .agent-avatar {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    font-size: 2rem;
    font-weight: 700;
    color: #000;
    overflow: hidden;
    margin-bottom: 1rem;
}

.favorite-card .agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorite-card .agent-info {
    flex: 1;
    width: 100%;
}

.favorite-card .agent-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.35rem;
}

.favorite-card .agent-info p {
    font-size: 0.85rem;
    color: var(--foreground-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-card .agent-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0;
    border-top: none;
    width: 100%;
    justify-content: center;
}

.favorite-card .agent-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.favorite-card .agent-actions .favorite-btn {
    padding: 0.5rem;
    font-size: 1.1rem;
}

.loading-small {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--foreground-muted);
}

.no-favorites-text {
    color: var(--foreground-muted);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.all-agents-section {
    margin-top: 2rem;
}

.all-agents-section .section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.loading-small .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(0, 255, 200, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    color: var(--foreground-muted);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    grid-column: 1 / -1;
}

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

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--foreground-muted);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
    
    .search-filter {
        flex-direction: column;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .agents-grid {
        grid-template-columns: 1fr;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

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

.modal-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-specialty {
    color: var(--primary);
    font-size: 0.9rem;
    margin: 0.25rem 0 0 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--foreground-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--foreground);
}

.modal-body {
    padding: 1.5rem;
}

.modal-section {
    margin-top: 1.5rem;
}

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

.modal-section-content {
    color: var(--foreground);
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
