/* ============================================
   EXECUTION CIRCLES GRID
============================================ */
.execution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 20px;
    padding: 10px;
    /* IMPORTANTE: Permitir que tooltips salgan del contenedor */
    overflow: visible;
}

.execution-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* IMPORTANTE: Establecer z-index base */
    z-index: 1;
}

.execution-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* IMPORTANTE: Aumentar z-index al hacer hover */
    z-index: 100;
}

.execution-circle.completed {
    background-color: #10b981;
}

.execution-circle.pending {
    background-color: #f97316;
    animation: pulse-orange 2s infinite;
}

/* TOOLTIP MEJORADO */
.execution-circle .tooltip {
    position: absolute;
    bottom: 100%;  /* Cambiado de -35px a 100% para que aparezca arriba */
    left: 50%;
    transform: translateX(-50%) translateY(-8px); /* Pequeño espacio arriba del círculo */
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10; /* Muy alto para asegurar que esté encima de todo */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}



.execution-circle:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px); /* Se mueve un poco más arriba al aparecer */
}

@keyframes pulse-orange {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }
}

.execution-circle .tooltip {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.execution-circle:hover .tooltip {
    opacity: 1;
}

@keyframes pulse-orange {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }
}

/* ============================================
   MODAL STYLES
============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 5000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================
   STATUS BADGES
============================================ */
.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.pending {
    background-color: #fed7aa;
    color: #9a3412;
}

.status-badge.completed {
    background-color: #d1fae5;
    color: #065f46;
}

/* ============================================
   STAT CARDS
============================================ */
.stat-card {
    background-color: #f9fafb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #111827;
}

/* ============================================
   TABLE STYLES
============================================ */
.table-container {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

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

.table-container thead {
    background-color: #f9fafb;
}

.table-container th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}

.table-container td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #f3f4f6;
}

.table-container tbody tr:hover {
    background-color: #f9fafb;
}

/* ============================================
   BUTTONS
============================================ */
.btn-primary {
    padding: 0.5rem 1.5rem;
    background-color: #2563eb;
    color: white;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    padding: 0.5rem 1.5rem;
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #f9fafb;
}

.btn-text {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s;
}

.btn-text:hover {
    color: #1d4ed8;
}

/* ============================================
   GROUP BREAKDOWN
============================================ */
.group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
}

.group-row .name {
    font-weight: 600;
    color: #111827;
}

.group-row .stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.group-row .stats span {
    color: #6b7280;
}

.group-row .stats .diff {
    font-weight: 600;
}

.group-row .stats .diff.positive {
    color: #10b981;
}

.group-row .stats .diff.negative {
    color: #ef4444;
}

/* ============================================
   RESPONSIVE
============================================ */
/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Tablet y Mobile */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .value {
        font-size: 1.5rem;
    }
}

/* Mobile */
@media (max-width: 640px) {
    /* Header */
    header h1 {
        font-size: 1.25rem;
    }
    
    header .flex {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    /* Stats en columna */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card .label {
        font-size: 0.75rem;
    }
    
    .stat-card .value {
        font-size: 1.25rem;
    }
    
    /* Filtros */
    .filters {
        padding: 0.75rem;
    }
    
    .filters .grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .filters label {
        font-size: 0.75rem;
    }
    
    .filters select,
    .filters input[type="date"] {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Timeline más compacto */
    #executions-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .execution-circle {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .execution-circle .tooltip {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        min-width: 100px;
    }
    
    /* Modales full screen en móvil */
    .modal-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
        overflow-y: auto;
    }
    
    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        padding: 0.75rem;
    }
    
    .modal-header h2 {
        font-size: 1.125rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    /* Tablas con scroll horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    table {
        min-width: 600px;
        font-size: 0.75rem;
    }
    
    table th,
    table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Botones más grandes para táctil */
    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        min-height: 44px; /* Tamaño mínimo táctil */
    }
    
    .btn-text {
        padding: 0.5rem;
        min-height: 44px;
        font-size: 0.75rem;
    }
    
    /* Botones de acción apilados */
    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-actions button {
        width: 100%;
    }
    
    /* Info cards en columna */
    .info-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
    }
    
    /* Review modal ajustes */
    .review-modal-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
    }
    
    .review-details {
        font-size: 0.875rem;
    }
    
    .review-details .grid {
        grid-template-columns: 1fr;
    }
    
    /* Radio buttons más grandes */
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    .radio-group label {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Textarea más alto en móvil */
    textarea {
        min-height: 100px;
        font-size: 0.875rem;
    }
    
    /* Status badges más pequeños */
    .status-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Grupos breakdown */
    .group-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .group-row .stats {
        width: 100%;
        justify-content: space-between;
    }
    
    /* History timeline */
    .history-timeline {
        padding-left: 1rem;
    }
    
    .history-timeline > div {
        padding-left: 1.5rem;
        font-size: 0.75rem;
    }
    
    /* Ocultar elementos no críticos en móvil */
    .hide-on-mobile {
        display: none !important;
    }
}

/* Landscape mobile */
@media (max-width: 640px) and (orientation: landscape) {
    .modal-content {
        max-height: 100vh;
    }
    
    .modal-body {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
}

/* Mejoras táctiles generales */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivos táctiles */
    button,
    a,
    .execution-circle {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Aumentar área táctil */
    .btn-text {
        padding: 0.75rem 1rem;
    }
    
    /* Tooltips no funcionan bien en táctil */
    .execution-circle:hover .tooltip {
        display: none;
    }
}

