/* Trecio Dashboard Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* Auth */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-box {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
}

.auth-box h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.auth-box p {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-900);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.user-email {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

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

.agent-card {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s;
    background: var(--gray-50);
}

.agent-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

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

.agent-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--gray-900);
}

.agent-type {
    font-size: 0.75rem;
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-top: 0.5rem;
    display: inline-block;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-idle {
    background: rgba(107, 114, 128, 0.1);
    color: var(--gray-600);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.agent-info {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.agent-info strong {
    color: var(--gray-900);
}

.agent-timestamp {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 1rem;
}

/* Activity Log */
.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.activity-header h2 {
    margin: 0;
}

.filters {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    color: var(--gray-900);
    cursor: pointer;
    font-size: 0.875rem;
}

.activity-log {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    border-left: 4px solid var(--gray-300);
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-radius: 4px;
    transition: all 0.2s;
}

.activity-item.execution {
    border-left-color: var(--primary);
}

.activity-item.config {
    border-left-color: var(--warning);
}

.activity-item.error {
    border-left-color: var(--error);
}

.activity-item.status {
    border-left-color: var(--success);
}

.activity-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.activity-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.activity-agent {
    font-weight: 600;
    color: var(--gray-900);
}

.activity-type {
    font-size: 0.75rem;
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.activity-action {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.activity-details {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    font-family: 'Monaco', 'Menlo', monospace;
}

.activity-detail-text {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .main-content {
        padding: 1rem;
    }

    .section {
        padding: 1rem;
    }

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

    .activity-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters {
        width: 100%;
        flex-direction: column;
    }

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