/* Panel de Contexto Persistente */
.eq-context-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #2271b1;
    color: #fff;
    z-index: 999999;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 14px;
}

body.has-eq-context-panel {
    padding-top: 50px;
}

.eq-context-panel-info {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.eq-context-panel-section {
    margin-right: 20px;
    display: flex;
    align-items: center;
}

.eq-context-panel-label {
    font-weight: bold;
    margin-right: 8px;
    opacity: 0.8;
}

.eq-context-panel-value {
    background: rgba(255,255,255,0.15);
    padding: 3px 8px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Estilos para los botones y acciones del panel */
.eq-context-panel-actions {
    display: flex;
    align-items: center;
}

.eq-context-panel-button {
    background-color: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    padding: 4px 10px;
    margin-left: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.eq-context-panel-button:hover {
    background-color: rgba(255,255,255,0.25);
}

.eq-context-panel-button.end-session {
    background-color: rgba(220,53,69,0.6);
}

.eq-context-panel-button.end-session:hover {
    background-color: rgba(220,53,69,0.8);
}

.eq-context-panel-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Estilos para los modales */
.eq-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000000;
    display: none;
}

.eq-modal:not(#eq-cart-history-modal):not(#eq-contract-modal) {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000001;
    display: none;
}

/* Specific styles for contract modal */
#eq-contract-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000001;
    display: none;
}

.eq-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e2e2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eq-modal-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.eq-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    margin: 0;
}

.eq-modal-body {
    padding: 20px;
}

.eq-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e2e2e2;
    display: flex;
    justify-content: flex-end;
}

.eq-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
}

.eq-search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.eq-search-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.eq-search-item:hover {
    background-color: #f5f5f5;
}

.eq-search-item.selected {
    background-color: #e6f7ff;
}

.eq-no-results {
    padding: 15px;
    text-align: center;
    color: #666;
}

.eq-create-new {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.eq-form-row {
    margin-bottom: 15px;
}

.eq-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.eq-form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Estilos para selectores de fecha */
.eq-form-input.flatpickr-input {
    background-color: #fff;
}

.flatpickr-calendar {
    z-index: 1000002 !important;
}

/* Estilos responsivos mejorados */
@media (max-width: 768px) {
    .eq-context-panel {
        flex-direction: column;
        padding: 8px;
    }
    
    .eq-context-panel-info {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .eq-context-panel-section {
        margin-right: 0;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .eq-context-panel-value {
        max-width: none;
        flex-grow: 1;
    }
    
    /* Modificaciones para los botones en móvil */
    .eq-context-panel-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap; /* Permitir que los botones se envuelvan en múltiples líneas */
        justify-content: flex-start; /* Alinear desde la izquierda */
        gap: 8px; /* Espacio uniforme entre botones */
    }
    
    .eq-context-panel-button {
        margin: 4px 4px 4px 0; /* Espaciado uniforme */
        padding: 8px 12px; /* Botones más grandes para mejor interacción táctil */
        font-size: 13px; /* Texto ligeramente más grande */
        flex: 1 1 auto; /* Permitir que crezcan pero respetando su contenido */
        min-width: 100px; /* Ancho mínimo para mejor visualización */
        text-align: center; /* Centrar texto */
        white-space: nowrap; /* Evitar que el texto se rompa */
    }
    
    body.has-eq-context-panel {
        padding-top: 125px; /* Aumentar el padding para acomodar el panel más alto */
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 480px) {
    .eq-context-panel-button {
        min-width: 45%; /* En pantallas muy pequeñas, mostrar 2 botones por fila */
        font-size: 12px;
        padding: 10px 8px;
    }
    
    body.has-eq-context-panel {
        padding-top: 160px; /* Más espacio para el panel */
    }
}

/* Botón de toggle del panel */
.eq-context-toggle-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #2271b1;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 999998;
    transition: all 0.3s ease;
}

.eq-context-toggle-button:hover {
    background-color: #135e96;
    transform: scale(1.05);
}

.eq-context-toggle-button i {
    font-size: 20px;
    margin-bottom: 3px;
}

.eq-context-toggle-button span {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
}

/* Clase para controlar visibilidad durante carga */
.eq-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Clase para ocultar el panel completamente */
.eq-context-panel.eq-hidden {
    display: none !important;
}

/* Loading state styles */
.eq-context-panel.eq-loading-state {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eq-context-panel.eq-loading-state .eq-context-panel-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6c757d;
    font-size: 14px;
}

.eq-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mejoras de diseño para modales (excluyendo cart history y contract) */
.eq-modal:not(#eq-cart-history-modal):not(#eq-contract-modal) {
    width: 90%;
    max-width: 800px; /* Aumentar el ancho máximo */
    max-height: 85vh;
}

/* Estilo para formularios de dos columnas */
.eq-form-two-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.eq-form-column {
    flex: 1;
    min-width: 250px;
}

.eq-form-field {
    margin-bottom: 15px;
}

.eq-form-full-width {
    width: 100%;
    margin-bottom: 15px;
}

.eq-form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.eq-form-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.eq-form-message {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.eq-form-message.warning {
    background-color: #fff8e5;
    border: 1px solid #f0c33c;
    color: #8a6d3b;
}

.eq-form-message.success {
    background-color: #ecf9ec;
    border: 1px solid #46b450;
    color: #2b542c;
}

/* Mejorar apariencia de la sección de resultados */
.eq-search-results {
    max-height: 250px;
    margin-bottom: 20px;
}

/* Mejorar apariencia de los elementos de la lista */
.eq-search-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.eq-search-item:hover {
    border-left-color: #2271b1;
    padding-left: 12px;
}

.eq-search-item.selected {
    border-left-color: #2271b1;
    background-color: #f0f6fc;
}

/* Mejorar aspecto del panel principal */
.eq-context-panel {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.eq-context-panel-button {
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 6px 12px;
}

.eq-context-panel-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Mejoras para flatpickr en móviles */
@media (max-width: 768px) {
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 300px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        top: auto !important;
        bottom: auto !important;
        position: fixed !important;
        z-index: 1000010 !important;
        visibility: visible !important;
    }
    
    /* Mejorar tamaño de los días para interacción táctil */
    .flatpickr-day {
        height: 38px !important;
        line-height: 38px !important;
    }
}