/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

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

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-icon {
    font-size: 48px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
.main-content {
    padding: 40px 0;
}

/* Filters Section */
.filters-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

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

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.view-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

.view-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.cloud {
    background-color: #3b82f6;
}

.dot.local {
    background-color: #10b981;
}

.dot.opensource {
    background-color: #f59e0b;
}

/* Agents Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.agent-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.agent-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.agent-card.category-cloud {
    border-top: 4px solid #3b82f6;
}

.agent-card.category-local {
    border-top: 4px solid #10b981;
}

.agent-card.category-opensource {
    border-top: 4px solid #f59e0b;
}

.agent-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.agent-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.agent-provider {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.agent-category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.agent-category.cloud {
    background: #dbeafe;
    color: #1e40af;
}

.agent-category.local {
    background: #d1fae5;
    color: #065f46;
}

.agent-category.opensource {
    background: #fef3c7;
    color: #92400e;
}

.agent-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-item {
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-features {
    margin-bottom: 20px;
}

.agent-features h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-tag {
    padding: 4px 12px;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

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

.btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    font-size: 0.9rem;
}

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

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

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

.agent-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stars {
    color: #fbbf24;
}

.rating-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: 8px;
}

/* Table View */
.agents-table-wrapper {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.agents-table {
    width: 100%;
    border-collapse: collapse;
}

.agents-table th,
.agents-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.agents-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

.agents-table th:hover {
    background: #e2e8f0;
}

.agents-table tbody tr {
    transition: background 0.2s;
}

.agents-table tbody tr:hover {
    background: var(--bg-color);
}

.agents-table tbody tr:last-child td {
    border-bottom: none;
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.category-badge.cloud {
    background: #dbeafe;
    color: #1e40af;
}

.category-badge.local {
    background: #d1fae5;
    color: #065f46;
}

.category-badge.opensource {
    background: #fef3c7;
    color: #92400e;
}

.features-cell {
    max-width: 200px;
}

.features-cell .feature-tag {
    display: inline-block;
    margin: 2px;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-top: 60px;
}

.footer p {
    margin: 8px 0;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 40px 0;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select {
        min-width: 100%;
    }

    .view-toggle {
        justify-content: center;
    }

    .stats-bar {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

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

    .agents-table th,
    .agents-table td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }

    .agent-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .header {
        padding: 30px 0;
    }

    .logo-icon {
        font-size: 36px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .filters-section {
        padding: 16px;
    }

    .agent-card {
        padding: 16px;
    }

    .agent-header {
        flex-direction: column;
        text-align: center;
    }

    .agent-stats {
        grid-template-columns: 1fr;
    }
}

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

.agent-card {
    animation: fadeIn 0.3s ease-out;
}

/* Utility Classes */
.hidden {
    display: none !important;
}
