/**
 * 🤖 Agent Activity Module - Premium Styles
 * 
 * Design System: Academia Krav Maga v2.0
 * Colors: #667eea (primary), #764ba2 (secondary)
 * Pattern: Isolated CSS with .module-isolated-* prefix
 */

/* ========== CONTAINER ========== */
.module-isolated-agent-activity {
    padding: 0;
    min-height: 100vh;
}

/* ========== TABS ========== */
.module-tabs {
    display: flex;
    gap: 8px;
    padding: 0 0 16px 0;
}

.tab-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #e5e7eb;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #4a5568;
    transition: all 0.2s ease;
    position: relative;
    top: 2px;
}

.tab-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-color: #667eea;
    border-bottom: 2px solid white;
    z-index: 1;
}

.tab-count {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.tab-btn.active .tab-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ========== FILTROS ========== */
.filters-section {
    animation: slideDown 0.3s ease;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========== TABELA ========== */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.table-premium thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table-premium th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-premium tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.table-premium tbody tr:hover {
    background: #f8f9fa;
}

.table-premium tbody tr.row-selected {
    background: #fff3cd;
}

.table-premium td {
    padding: 12px;
    vertical-align: top;
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-primary {
    background: #cfe2ff;
    color: #084298;
}

.badge-secondary {
    background: #e2e3e5;
    color: #41464b;
}

.badge-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ========== BOTÕES DE AÇÃO ========== */
.btn-action {
    padding: 6px 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-action.btn-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.btn-action.btn-success:hover {
    background: #c3e6cb;
}

.btn-action.btn-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.btn-action.btn-danger:hover {
    background: #f5c6cb;
}

.btn-action.btn-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.btn-action.btn-warning:hover {
    background: #ffeaa7;
}

/* ========== AÇÕES EM LOTE ========== */
.bulk-actions {
    animation: slideDown 0.3s ease;
}

/* ========== ESTADOS ========== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state h3 {
    margin: 16px 0 8px;
    color: #374151;
    font-size: 20px;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ========== PAGINAÇÃO ========== */
.pagination-controls {
    animation: fadeIn 0.3s ease;
}

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

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 1024px) {
    .filters-section > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .table-premium {
        font-size: 13px;
    }
    
    .table-premium th,
    .table-premium td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .filters-section > div {
        grid-template-columns: 1fr !important;
    }
    
    .module-header-premium > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
    
    .module-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .table-responsive {
        overflow-x: scroll;
    }
    
    .table-premium {
        min-width: 900px;
    }
    
    .pagination-controls {
        flex-direction: column !important;
        gap: 12px;
        text-align: center;
    }
    
    .pagination-controls > div:last-child {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ========== ESTATÍSTICAS CARDS ========== */
.stat-card-enhanced {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.stat-card-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* ========== BOTÕES DO SISTEMA ========== */
.btn-form {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-form:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary-form {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary-form:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary-form {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary-form:hover:not(:disabled) {
    background: #e5e7eb;
}

.btn-success-form {
    background: #10b981;
    color: white;
}

.btn-success-form:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-warning-form {
    background: #f59e0b;
    color: white;
}

.btn-warning-form:hover:not(:disabled) {
    background: #d97706;
}

.btn-danger-form {
    background: #ef4444;
    color: white;
}

.btn-danger-form:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-info-form {
    background: #3b82f6;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========== UTILITÁRIOS ========== */
.mt-3 {
    margin-top: 24px;
}

.mb-3 {
    margin-bottom: 24px;
}

/* ========== ANIMAÇÕES ADICIONAIS ========== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.table-premium tbody tr {
    animation: slideInRight 0.3s ease;
}

.table-premium tbody tr:nth-child(1) { animation-delay: 0.05s; }
.table-premium tbody tr:nth-child(2) { animation-delay: 0.1s; }
.table-premium tbody tr:nth-child(3) { animation-delay: 0.15s; }
.table-premium tbody tr:nth-child(4) { animation-delay: 0.2s; }
.table-premium tbody tr:nth-child(5) { animation-delay: 0.25s; }

/* ========== 🆕 MODAIS DE ORQUESTRAÇÃO ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
    animation: slideUpModal 0.3s ease;
}

.modal-large {
    max-width: 900px;
}

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

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 2px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #f3f4f6;
    color: #1a202c;
}

/* ========== FORM GROUPS (MODAL) ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group .form-text {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
}

/* ========== EXECUTION LOG TABLE ========== */
.execution-log-table {
    max-height: 500px;
    overflow-y: auto;
}

.execution-row {
    transition: all 0.2s ease;
}

.execution-row:hover {
    background-color: #f9fafb;
}

.execution-completed {
    background-color: rgba(16, 185, 129, 0.05);
}

.execution-failed {
    background-color: rgba(239, 68, 68, 0.05);
}

.execution-started {
    background-color: rgba(251, 191, 36, 0.05);
}

.execution-error-details {
    background-color: #fef2f2;
}

.execution-error-details details {
    padding: 16px;
}

.execution-error-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #dc2626;
    font-size: 13px;
}

.execution-error-details summary:hover {
    color: #991b1b;
}

.execution-error-details pre {
    margin-top: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 11px;
    color: #7f1d1d;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== BOTÕES DE AÇÃO EXPANDIDOS ========== */
.btn-action.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-action.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-action.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-action.btn-primary:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-action.btn-info:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-action.btn-secondary:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

/* ========== TEXT UTILITIES ========== */
.text-success {
    color: #10b981;
    font-weight: 600;
}

.text-error {
    color: #ef4444;
    font-weight: 600;
}

.text-warning {
    color: #f59e0b;
    font-weight: 600;
}

/* ========== BADGES EXPANDIDOS ========== */
.badge.badge-secondary {
    background: #6b7280;
    color: white;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
    
    .execution-log-table {
        max-height: 400px;
    }
}
