/* Variables de color */
:root {
    --cp-primary: #ff6600;
    --cp-primary-dark: #cc5200;
    --cp-secondary: #4a5568;
    --cp-success: #48bb78;
    --cp-warning: #ed8936;
    --cp-danger: #f56565;
    --cp-info: #4299e1;
    --cp-light: #f7fafc;
    --cp-dark: #2d3748;
    --cp-transitorio: #9f7aea;
    --cp-border-radius: 12px;
    --cp-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --cp-box-shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   CAMBIOS ESPECÍFICOS PARA VERSIÓN MÓVIL
   ============================================ */

@media (max-width: 768px) {
    /* Historial de Ingresos y Egresos - Versión móvil */
    
    /* 1. Achicar botón de buscar y agrandar input */
    .cp-historial-search {
        flex-direction: column;
        gap: 10px;
    }
    
    .cp-historial-search .cp-search-input-sm {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
        flex: 1;
    }
    
    .cp-historial-search .cp-btn-sm {
        width: 80px !important;
        min-width: 80px !important;
        padding: 8px 12px !important;
        font-size: 14px;
    }
    
    /* 2. Centrar todos los títulos */
    .cp-ingresos-header h2,
    .cp-historial-header h3,
    .cp-recientes-container h3,
    .cp-form-container h2,
    .cp-info-box h3,
    .cp-table-container h2 {
        text-align: center !important;
    }
    
    /* 3. Achicar títulos */
    .cp-ingresos-header h2 {
        font-size: 22px !important;
        margin-bottom: 5px;
    }
    
    .cp-subtitle {
        font-size: 14px !important;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .cp-historial-header h3,
    .cp-recientes-container h3 {
        font-size: 18px !important;
        margin-bottom: 15px;
    }
    
    /* 4. Quitar espacios en blanco */
    .cp-container {
        padding: 10px !important;
        margin: 5px 0 !important;
    }
    
    .cp-table-container,
    .cp-search-container,
    .cp-historial-container,
    .cp-recientes-container,
    .cp-form-container,
    .cp-info-box {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    /* 5. Quitar descripciones en móvil */
    .cp-instructions,
    .cp-search-hint,
    .cp-scanner-hint,
    .cp-form-note,
    .cp-table-description {
        display: none !important;
    }
    
    /* 6. Hacer formularios más compactos */
    .cp-form-grid {
        gap: 8px !important;
    }
    
    .cp-form-group {
        margin-bottom: 8px;
    }
    
    .cp-form-group label {
        font-size: 12px !important;
        margin-bottom: 3px;
    }
    
    .cp-form-group input {
        padding: 10px !important;
        font-size: 14px !important;
        min-height: 40px;
    }
    
    /* 7. Tabla responsiva mejorada */
    .cp-table-responsive {
        margin: 10px -15px;
        width: calc(100% + 30px);
    }
    
    .cp-table th,
    .cp-table td {
        padding: 6px 8px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }
    
    .cp-table th {
        font-size: 11px !important;
        padding: 8px !important;
    }
    
    /* 8. Botones más compactos */
    .cp-btn {
        padding: 8px 12px !important;
        font-size: 14px !important;
        min-height: 36px;
    }
    
    .cp-btn-lg {
        padding: 12px 16px !important;
        font-size: 16px !important;
    }
    
    .cp-btn-sm {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
    
    /* 9. Historial filters más compacto */
    .cp-historial-filters {
        padding: 10px !important;
        gap: 8px !important;
    }
    
    .cp-filter-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .cp-filter-group label {
        font-size: 12px !important;
        margin-bottom: 3px;
    }
    
    .cp-select-sm,
    .cp-input-date {
        padding: 6px 8px !important;
        font-size: 13px !important;
        width: 100%;
        color: #000000 !important; /* Color negro */
    }
    
    /* 10. Footer del historial más compacto */
    .cp-historial-footer {
        padding-top: 10px !important;
        margin-top: 15px !important;
        flex-direction: column;
        gap: 10px;
    }
    
    .cp-leyenda {
        justify-content: center;
        gap: 10px;
    }
    
    .cp-leyenda-item {
        font-size: 11px;
    }
    
    /* 11. Movimientos recientes más compactos */
    .cp-movimiento-reciente {
        padding: 10px !important;
        margin-bottom: 8px;
    }
    
    .cp-movimiento-hora {
        font-size: 12px !important;
    }
    
    .cp-movimiento-nombre {
        font-size: 14px !important;
    }
    
    .cp-movimiento-estado {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
    
    /* 12. Info box más compacto */
    .cp-info-list li {
        padding: 6px 0 6px 20px !important;
        font-size: 13px !important;
    }
    
    .cp-nota-importante {
        padding: 10px !important;
        font-size: 12px !important;
    }
    
    /* 13. Paginación más compacta */
    .cp-pagination,
    .cp-pagination-historial {
        gap: 5px;
        margin-top: 15px;
    }
    
    .cp-page-link,
    .cp-page-historial {
        min-width: 30px !important;
        height: 30px !important;
        font-size: 12px;
        padding: 0 !important;
    }
    
    /* 14. QR Scanner optimizado para móvil */
    .cp-video-container {
        max-width: 100% !important;
        aspect-ratio: 4/3;
    }
    
    .cp-manual-qr-input {
        flex-direction: column;
    }
    
    .cp-manual-qr-input .cp-btn {
        width: 100%;
    }
    
    /* 15. Modal para móviles */
    .cp-modal-content {
        width: 95% !important;
        margin: 10px auto !important;
        padding: 15px !important;
    }
    
    .cp-modal-content h3 {
        font-size: 18px !important;
        text-align: center;
    }
    
    /* 16. Eliminar márgenes innecesarios */
    .cp-mt-20, .cp-mt-30 {
        margin-top: 10px !important;
    }
    
    .cp-mb-20, .cp-mb-30 {
        margin-bottom: 10px !important;
    }
    
    /* 17. Ajustar contenedor de resultados */
    .cp-resultados-busqueda {
        padding: 10px !important;
    }
    
    .cp-persona-item {
        padding: 10px !important;
    }
    
    /* 18. Ajustar botones de acción */
    .cp-historial-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .cp-historial-buttons .cp-btn {
        flex: 1;
        margin: 0 2px;
    }
    
    /* 19. Textos más pequeños en general */
    body {
        font-size: 14px;
    }
    
    /* 20. Ocultar elementos no esenciales en móvil */
    .cp-icon {
        font-size: 16px !important;
    }
    
    .cp-loading-spinner {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* 21. Clases específicas para móvil */
    .cp-mobile-hide {
        display: none !important;
    }
    
    .cp-mobile-search-btn {
        min-width: 80px !important;
        width: auto !important;
    }
    
    .cp-mobile-search-input {
        flex: 1;
    }
    
    /* 22. Inputs de búsqueda optimizados */
    .cp-search-input-group {
        flex-direction: column;
    }
    
    .cp-search-input,
    .cp-search-input-group .cp-btn {
        width: 100%;
    }
}

/* Para pantallas muy pequeñas (menos de 400px) */
@media (max-width: 400px) {
    .cp-table th,
    .cp-table td {
        padding: 4px 6px !important;
        font-size: 11px !important;
    }
    
    .cp-ingresos-header h2 {
        font-size: 20px !important;
    }
    
    .cp-historial-header h3 {
        font-size: 16px !important;
    }
    
    .cp-btn {
        padding: 6px 10px !important;
        font-size: 13px !important;
    }
    
    .cp-form-group input {
        padding: 8px !important;
        font-size: 13px !important;
    }
    
    .cp-search-input {
        padding: 10px !important;
        font-size: 14px !important;
    }
}

/* Para orientación horizontal en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .cp-video-container {
        max-width: 70% !important;
    }
    
    .cp-historial-search {
        flex-direction: row;
    }
    
    .cp-historial-search .cp-search-input-sm {
        flex: 2;
    }
    
    .cp-historial-search .cp-btn-sm {
        flex: 1;
    }
}

/* ============================================
   ESTILOS GENERALES (existentes)
   ============================================ */

/* Contenedor principal */
.cp-container {
    background: linear-gradient(135deg, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
    padding: 30px;
    border-radius: var(--cp-border-radius);
    box-shadow: var(--cp-box-shadow);
    margin: 20px 0;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.cp-container-pendiente {
    background: linear-gradient(135deg, #ff6600 0%, #cc5200 100%);
}

/* Tablas */
.cp-table-container {
    background: white;
    padding: 30px;
    border-radius: var(--cp-border-radius);
    box-shadow: var(--cp-box-shadow);
    margin-bottom: 30px;
}

.cp-table-description {
    color: var(--cp-secondary);
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.cp-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.cp-table th {
    background: var(--cp-primary);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.cp-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.cp-table tr:hover {
    background-color: #f7fafc;
    cursor: pointer;
}

/* Badges */
.cp-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin: 2px;
}

.cp-badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.cp-badge-warning {
    background: #feebc8;
    color: #744210;
}

.cp-badge-primary {
    background: #bee3f8;
    color: #2c5282;
}

.cp-badge-info {
    background: var(--cp-transitorio);
    color: white;
}

.cp-badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

.cp-badge-sm {
    padding: 3px 8px;
    font-size: 12px;
}

/* Control de ingresos */
.cp-ingresos-header {
    text-align: center;
    margin-bottom: 40px;
}

.cp-ingresos-header h2 {
    color: white;
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cp-subtitle {
    color: white;
    font-size: 18px;
    opacity: 0.9;
    margin: 0;
}

.cp-search-container {
    background: white;
    padding: 30px;
    border-radius: var(--cp-border-radius);
    margin-bottom: 30px;
    box-shadow: var(--cp-box-shadow);
}

.cp-search-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cp-search-input-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.cp-search-input {
    flex: 1;
    padding: 15px 20px;
    border: 3px solid var(--cp-primary);
    border-radius: var(--cp-border-radius);
    font-size: 18px;
    box-sizing: border-box;
    min-height: 56px;
    color: #000000 !important; /* Color negro */
}

.cp-search-input::placeholder {
    color: #666666 !important; /* Color de placeholder negro */
}

/* Resultados de búsqueda */
.cp-resultados-busqueda {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid #e2e8f0;
    animation: fadeIn 0.3s ease-out;
}

.cp-lista-personas {
    display: grid;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.cp-lista-personas::-webkit-scrollbar {
    width: 8px;
}

.cp-lista-personas::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cp-lista-personas::-webkit-scrollbar-thumb {
    background: var(--cp-primary);
    border-radius: 4px;
}

.cp-persona-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cp-persona-item:hover {
    background: var(--cp-primary);
    color: white;
    border-color: var(--cp-primary);
    transform: translateY(-2px);
    box-shadow: var(--cp-box-shadow-hover);
}

.cp-persona-item:hover .cp-persona-info {
    color: white;
}

.cp-persona-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.cp-persona-nombre {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: #000000; /* Color negro */
}

.cp-persona-detalle {
    font-size: 14px;
    color: var(--cp-secondary);
}

.cp-persona-item:hover .cp-persona-detalle {
    color: rgba(255, 255, 255, 0.9);
}

.cp-persona-validar {
    padding: 8px 16px;
    background: var(--cp-success);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cp-persona-item:hover .cp-persona-validar {
    background: white;
    color: var(--cp-primary);
}

/* Escáner QR */
.cp-scanner-area {
    background: #1a202c;
    border-radius: var(--cp-border-radius);
    padding: 20px;
    margin-top: 20px;
    animation: slideInUp 0.3s ease-out;
}

.cp-camera-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.cp-camera-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.cp-camera-selector label {
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

/* CAMBIO CRÍTICO: Color negro para todos los selects */
.cp-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    color: #000000 !important; /* Color negro */
    font-weight: 600;
    flex: 1;
    max-width: 200px;
    cursor: pointer;
}

.cp-select option {
    color: #000000 !important; /* Color negro para opciones */
    background-color: white;
}

.cp-select:focus {
    outline: none;
    border-color: var(--cp-primary);
}

.cp-video-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid var(--cp-primary);
    aspect-ratio: 4/3;
    background: black;
}

#cp-video-preview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cp-scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cp-scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    border: 3px solid var(--cp-success);
    border-radius: 10px;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
}

.cp-scan-status {
    text-align: center;
    margin-top: 20px;
    color: white;
}

.cp-scan-indicator {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto;
    width: 80%;
    overflow: hidden;
}

.cp-scan-line {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--cp-success), transparent);
    animation: scan-animation 2s infinite ease-in-out;
}

@keyframes scan-animation {
    0% { left: -100%; }
    100% { left: 100%; }
}

#cp-scan-message {
    margin-top: 10px;
    font-size: 14px;
    opacity: 0.8;
    min-height: 20px;
}

.cp-manual-qr-input {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.cp-manual-qr-input .cp-search-input {
    flex: 1;
}

/* Modal de selección */
.cp-modal-seleccion {
    max-width: 600px;
}

.cp-modal-lista-personas {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 5px;
}

/* Resultados de validación */
.cp-ultimo-movimiento {
    background: white;
    border-radius: 8px;
    padding: 25px;
    border-left: 6px solid var(--cp-primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
}

.cp-movimiento-detalle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.cp-movimiento-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--cp-primary);
}

.cp-movimiento-label {
    font-weight: 600;
    color: var(--cp-secondary);
    font-size: 14px;
    margin-bottom: 5px;
    display: block;
}

.cp-movimiento-valor {
    font-size: 18px;
    color: var(--cp-dark);
    font-weight: 500;
    word-break: break-word;
}

.cp-movimiento-tipo {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 16px;
    margin-top: 10px;
    text-align: center;
}

.cp-movimiento-tipo.ingreso {
    background: #c6f6d5;
    color: #22543d;
}

.cp-movimiento-tipo.egreso {
    background: #fed7d7;
    color: #742a2a;
}

/* Movimientos recientes */
.cp-recientes-list {
    display: grid;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.cp-movimiento-reciente {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--cp-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out;
    flex-wrap: wrap;
    gap: 10px;
}

.cp-movimiento-reciente.ingreso {
    border-left-color: var(--cp-success);
}

.cp-movimiento-reciente.egreso {
    border-left-color: var(--cp-danger);
}

.cp-movimiento-reciente.transitorio {
    border-left-color: var(--cp-transitorio);
    background: rgba(159, 122, 234, 0.05);
}

.cp-movimiento-info {
    flex: 1;
    min-width: 200px;
}

.cp-movimiento-hora {
    font-size: 14px;
    color: var(--cp-secondary);
    margin-bottom: 5px;
}

.cp-movimiento-nombre {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
    color: #000000; /* Color negro */
}

.cp-movimiento-dni {
    font-size: 14px;
    color: var(--cp-secondary);
}

.cp-movimiento-estado {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.cp-movimiento-estado.ingreso {
    background: #c6f6d5;
    color: #22543d;
}

.cp-movimiento-estado.egreso {
    background: #fed7d7;
    color: #742a2a;
}

.cp-movimiento-estado.transitorio {
    background: var(--cp-transitorio);
    color: white;
}

/* Botones */
.cp-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    min-height: 44px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.cp-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--cp-box-shadow-hover);
}

.cp-btn-primary {
    background: var(--cp-primary);
    color: white;
    border: 2px solid var(--cp-primary);
}

.cp-btn-primary:hover {
    background: var(--cp-primary-dark);
    border-color: var(--cp-primary-dark);
}

.cp-btn-secondary {
    background: var(--cp-secondary);
    color: white;
    border: 2px solid var(--cp-secondary);
}

.cp-btn-secondary:hover {
    background: #2d3748;
    border-color: #2d3748;
}

.cp-btn-danger {
    background: var(--cp-danger);
    color: white;
    border: 2px solid var(--cp-danger);
}

.cp-btn-danger:hover {
    background: #c53030;
    border-color: #c53030;
}

.cp-btn-success {
    background: var(--cp-success);
    color: white;
    border: 2px solid var(--cp-success);
}

.cp-btn-success:hover {
    background: #38a169;
    border-color: #38a169;
}

.cp-btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    min-height: 32px;
}

.cp-btn-lg {
    padding: 15px 30px;
    font-size: 18px;
    min-height: 56px;
}

.cp-btn-transitorio {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    border: none;
    color: white;
}

.cp-btn-transitorio:hover {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    transform: translateY(-2px);
}

/* Paginación */
.cp-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.cp-page-link {
    padding: 10px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: var(--cp-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.cp-page-link:hover,
.cp-page-link.active {
    background: var(--cp-primary);
    color: white;
    border-color: var(--cp-primary);
}

/* Modal QR */
.cp-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.cp-modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: var(--cp-border-radius);
    width: 90%;
    max-width: 700px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cp-modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--cp-dark);
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cp-modal-close:hover {
    color: var(--cp-danger);
    background: #f7fafc;
}

.cp-qr-instructions {
    text-align: center;
    margin-top: 15px;
    color: var(--cp-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Acciones QR */
.cp-qr-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .cp-search-input-group {
        flex-direction: column;
    }
    
    .cp-search-input,
    .cp-btn {
        width: 100%;
        font-size: 16px;
    }
    
    .cp-table {
        font-size: 14px;
        min-width: 700px;
    }
    
    .cp-table th,
    .cp-table td {
        padding: 10px;
    }
    
    .cp-movimiento-detalle {
        grid-template-columns: 1fr;
    }
    
    .cp-camera-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .cp-video-container {
        max-width: 100%;
        aspect-ratio: 16/9;
    }
    
    .cp-modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
    }
    
    .cp-ingresos-header h2 {
        font-size: 28px;
    }
    
    .cp-subtitle {
        font-size: 16px;
    }
    
    .cp-btn-lg {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .cp-search-input {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .cp-table-container,
    .cp-search-container,
    .cp-historial-container {
        padding: 20px;
    }
    
    .cp-movimiento-reciente {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    
    .cp-movimiento-estado {
        align-self: flex-start;
    }
    
    .cp-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cp-persona-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .cp-persona-validar {
        align-self: flex-end;
    }
}

/* Animaciones */
@keyframes cp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cp-container,
.cp-table-container,
.cp-search-container {
    animation: cp-fadeIn 0.5s ease-out;
}

/* Estado deshabilitado */
.cp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cp-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Iconos */
.cp-icon {
    margin-right: 8px;
    font-size: 20px;
    line-height: 1;
}

/* Mensajes flotantes */
.cp-mensaje-flotante {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: var(--cp-border-radius);
    color: white;
    font-weight: 600;
    z-index: 9999;
    box-shadow: var(--cp-box-shadow);
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-out 2.7s forwards;
    max-width: calc(100vw - 40px);
    word-wrap: break-word;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.cp-mensaje-flotante-success {
    background: var(--cp-success);
    border-left: 5px solid #2f855a;
}

.cp-mensaje-flotante-error {
    background: var(--cp-danger);
    border-left: 5px solid #c53030;
}

.cp-mensaje-flotante-warning {
    background: var(--cp-warning);
    border-left: 5px solid #d69e2e;
}

/* Tabla de historial */
.cp-historial-container {
    background: white;
    padding: 30px;
    border-radius: var(--cp-border-radius);
    margin-top: 30px;
    box-shadow: var(--cp-box-shadow);
}

.cp-historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.cp-historial-header h3 {
    margin: 0;
    color: var(--cp-dark);
    font-size: 24px;
}

.cp-table-responsive {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    -webkit-overflow-scrolling: touch;
}

.cp-table-striped tbody tr:nth-child(odd) {
    background-color: #f8f9fa;
}

.cp-table-hover tbody tr:hover {
    background-color: #e9ecef;
    cursor: pointer;
}

.cp-historial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 15px;
}

.cp-total-movimientos {
    font-weight: 600;
    color: var(--cp-dark);
    font-size: 16px;
}

#cp-total-movimientos {
    color: var(--cp-primary);
    font-weight: 700;
    font-size: 20px;
}

.cp-leyenda {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.cp-leyenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cp-leyenda-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.cp-leyenda-color.ingreso {
    background: var(--cp-success);
}

.cp-leyenda-color.egreso {
    background: var(--cp-danger);
}

.cp-leyenda-color.transitorio {
    background: var(--cp-transitorio);
}

.cp-leyenda-texto {
    font-size: 14px;
    color: var(--cp-secondary);
    font-weight: 500;
}

/* Estados en tabla */
.cp-estado-ingreso {
    background: #c6f6d5;
    color: #22543d;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    text-align: center;
}

.cp-estado-egreso {
    background: #fed7d7;
    color: #742a2a;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    text-align: center;
}

/* Modal detalles */
.cp-modal-detalles {
    max-width: 700px;
}

.cp-historial-persona {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.cp-lista-movimientos-persona {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 15px;
    padding-right: 5px;
}

.cp-movimiento-persona-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--cp-primary);
    transition: all 0.3s ease;
}

.cp-movimiento-persona-item.ingreso {
    border-left-color: var(--cp-success);
}

.cp-movimiento-persona-item.egreso {
    border-left-color: var(--cp-danger);
}

.cp-movimiento-persona-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cp-movimiento-persona-fecha {
    font-size: 14px;
    color: var(--cp-secondary);
    font-weight: 500;
}

.cp-movimiento-persona-tipo {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cp-movimiento-persona-tipo.ingreso {
    background: var(--cp-success);
    color: white;
}

.cp-movimiento-persona-tipo.egreso {
    background: var(--cp-danger);
    color: white;
}

/* Información de búsqueda */
.cp-search-info {
    margin-top: 10px;
    text-align: center;
}

.cp-search-hint {
    font-size: 14px;
    color: var(--cp-secondary);
    font-style: italic;
    margin: 0;
    line-height: 1.5;
}

/* Persona encontrada */
.cp-persona-encontrada {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: white;
    padding: 25px;
    border-radius: var(--cp-border-radius);
    margin: 20px 0;
    border-left: 6px solid var(--cp-primary);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cp-persona-campo {
    display: flex;
    flex-direction: column;
}

.cp-persona-label {
    font-weight: 600;
    color: var(--cp-secondary);
    font-size: 14px;
    margin-bottom: 5px;
}

.cp-persona-valor {
    font-size: 16px;
    color: var(--cp-dark);
    font-weight: 500;
    word-break: break-word;
}

.cp-acciones-persona {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 5px;
}

/* Estilos para filas de la tabla */
.cp-fila-ingreso {
    background-color: rgba(198, 246, 213, 0.1) !important;
}

.cp-fila-ingreso:hover {
    background-color: rgba(198, 246, 213, 0.3) !important;
}

.cp-fila-egreso {
    background-color: rgba(254, 215, 215, 0.1) !important;
}

.cp-fila-egreso:hover {
    background-color: rgba(254, 215, 215, 0.3) !important;
}

.cp-fila-transitorio {
    background-color: rgba(159, 122, 234, 0.1) !important;
}

.cp-fila-transitorio:hover {
    background-color: rgba(159, 122, 234, 0.2) !important;
}

/* Mejoras para formularios */
.cp-form-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: var(--cp-border-radius);
    margin-bottom: 30px;
}

.cp-instructions {
    color: var(--cp-dark);
    margin-bottom: 25px;
    font-size: 16px;
    line-height: 1.6;
}

.cp-form {
    width: 100%;
}

.cp-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.cp-form-group {
    display: flex;
    flex-direction: column;
}

.cp-form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--cp-dark);
    font-size: 14px;
}

/* CAMBIO CRÍTICO: Color negro para todos los inputs y selects de formularios */
.cp-form-group input,
.cp-form-group select,
.cp-form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    width: 100%;
    color: #000000 !important; /* Color negro */
}

.cp-form-group input::placeholder,
.cp-form-group textarea::placeholder {
    color: #666666 !important; /* Color de placeholder negro */
}

.cp-form-group select option {
    color: #000000 !important; /* Color negro para opciones */
    background-color: white;
}

.cp-form-group input:focus,
.cp-form-group select:focus,
.cp-form-group textarea:focus {
    border-color: var(--cp-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.cp-form-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.cp-form-note {
    color: var(--cp-secondary);
    font-size: 14px;
    margin-top: 15px;
    font-style: italic;
}

/* Info box */
.cp-info-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: var(--cp-border-radius);
    margin-top: 20px;
}

.cp-info-box h3 {
    color: var(--cp-dark);
    margin-bottom: 20px;
    font-size: 22px;
}

.cp-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cp-steps li {
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    color: var(--cp-dark);
    font-size: 16px;
    position: relative;
    padding-left: 30px;
}

.cp-steps li:before {
    content: counter(step);
    counter-increment: step;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--cp-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.cp-steps li:last-child {
    border-bottom: none;
}

/* Resultado transitorio */
.cp-resultado-transitorio {
    margin-top: 20px;
    padding: 25px;
    background: white;
    border-radius: var(--cp-border-radius);
    box-shadow: var(--cp-box-shadow);
    animation: slideInUp 0.5s ease-out;
    border-left: 6px solid #4CAF50;
}

.cp-mensaje {
    padding: 20px;
    border-radius: var(--cp-border-radius);
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-out;
}

.cp-mensaje-success {
    background: #c6f6d5;
    border: 2px solid #38a169;
    color: #22543d;
}

.cp-mensaje-error {
    background: #fed7d7;
    border: 2px solid #f56565;
    color: #742a2a;
}

.cp-mensaje-destacado {
    font-weight: 700;
    font-size: 18px;
    margin: 15px 0;
    color: inherit;
}

/* Info list */
.cp-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cp-info-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: #000000;
    font-size: 16px;
    position: relative;
    padding-left: 30px;
}

.cp-info-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cp-success);
    font-size: 18px;
    font-weight: bold;
}

.cp-info-list li:last-child {
    border-bottom: none;
}

/* Estados de carga */
.cp-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading spinner adicional */
.cp-loading-historial,
.cp-loading-recientes {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
    font-style: italic;
}

.cp-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--cp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

/* Texto */
.cp-text-muted {
    color: #a0aec0;
    font-style: italic;
}

.cp-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
    font-style: italic;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
    margin: 20px 0;
}

/* Selector de cámara */
.cp-camera-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.cp-camera-selector label {
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

/* Mejoras para hover en móviles */
@media (hover: none) {
    .cp-btn:hover {
        transform: none;
    }
    
    .cp-table tr:hover {
        background-color: inherit;
    }
    
    .cp-persona-item:hover {
        transform: none;
    }
}

/* Ajustes para Safari iOS */
@supports (-webkit-touch-callout: none) {
    .cp-btn {
        cursor: pointer;
    }
    
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Estilos para scroll en móviles */
.cp-table-responsive::-webkit-scrollbar {
    height: 8px;
}

.cp-table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cp-table-responsive::-webkit-scrollbar-thumb {
    background: var(--cp-primary);
    border-radius: 4px;
}

/* Mejoras para el título */
.cp-ingresos-header h2 {
    font-size: 2.5rem;
    line-height: 1.2;
}

@media (max-width: 480px) {
    .cp-ingresos-header h2 {
        font-size: 2rem;
    }
    
    .cp-subtitle {
        font-size: 1rem;
    }
    
    .cp-btn {
        width: 100%;
    }
    
    .cp-form-group input,
    .cp-form-group select {
        font-size: 16px;
    }
}

/* Mejoras finales para accesibilidad */
.cp-btn:focus,
.cp-search-input:focus,
.cp-form-group input:focus,
.cp-form-group select:focus {
    outline: 2px solid var(--cp-primary);
    outline-offset: 2px;
}

.cp-table th[scope="col"] {
    text-align: left;
}

/* Clase para elementos ocultos en móviles */
.cp-mobile-hidden {
    display: none;
}

@media (min-width: 769px) {
    .cp-mobile-hidden {
        display: table-cell;
    }
}

/* Clase para elementos visibles solo en móviles */
.cp-mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .cp-mobile-only {
        display: block;
    }
}

/* Estilos para el contador de resultados */
.cp-result-count {
    font-size: 14px;
    color: var(--cp-secondary);
    margin-top: 10px;
    text-align: center;
    font-weight: 500;
}

/* Estilos para el separador de secciones */
.cp-section-separator {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--cp-primary), transparent);
    margin: 30px 0;
    border: none;
}

/* Clase para alinear elementos al centro */
.cp-text-center {
    text-align: center;
}

/* Clase para márgenes */
.cp-mt-20 { margin-top: 20px; }
.cp-mb-20 { margin-bottom: 20px; }
.cp-mt-30 { margin-top: 30px; }
.cp-mb-30 { margin-bottom: 30px; }

/* Estilos para imágenes responsivas */
.cp-img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Clase para ocultar elementos visualmente pero mantener accesibilidad */
.cp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mejoras para el estado activo de botones */
.cp-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Estilos para el estado de carga */
.cp-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    font-size: 20px;
    font-weight: 600;
}

/* Estilos para tooltips */
.cp-tooltip {
    position: relative;
    display: inline-block;
}

.cp-tooltip .cp-tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--cp-dark);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    font-weight: normal;
}

.cp-tooltip:hover .cp-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Instrucciones de permisos de cámara */
.cp-permisos-instructions {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--cp-border-radius);
    padding: 20px;
    margin-top: 20px;
    color: #856404;
}

.cp-permisos-instructions h4 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 15px;
}

.cp-permisos-instructions ul {
    margin: 10px 0;
    padding-left: 20px;
}

.cp-permisos-instructions li {
    margin-bottom: 8px;
    color: #856404;
}

.cp-permisos-instructions strong {
    color: #856404;
}

/* Indicador de estado de cámara */
.cp-camera-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    background: #f8f9fa;
}

.cp-camera-status.granted {
    background: #d4edda;
    color: #155724;
}

.cp-camera-status.denied {
    background: #f8d7da;
    color: #721c24;
}

.cp-camera-status-icon {
    font-size: 24px;
}

/* Mensaje de ayuda para cámara */
.cp-camera-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    text-align: center;
}

/* Botón con estado de cámara */
.cp-btn-camera-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cp-btn-camera-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Estilos para el área de escaneo en móviles */
@media (max-width: 768px) {
    .cp-permisos-instructions {
        padding: 15px;
        font-size: 14px;
    }
    
    .cp-permisos-instructions ul {
        padding-left: 15px;
    }
}

/* Animación para el botón de cámara */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.cp-btn-escanear-active {
    animation: pulse 2s infinite;
    background: linear-gradient(135deg, #ff6600 0%, #ff3300 100%) !important;
}

/* Estilos para el estado del botón de escáner */
.cp-btn-escanear[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.cp-btn-escanear[disabled]:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Mejoras para el botón de cámara en diferentes estados */
.cp-btn.cp-btn-escanear {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cp-btn.cp-btn-escanear:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.cp-btn.cp-btn-escanear:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* Estilos para indicador de escaneo activo */
.cp-scanning-active {
    animation: pulse-border 2s infinite;
    border: 2px solid var(--cp-primary);
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 102, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 102, 0, 0);
    }
}

/* Clase para ocultar elementos mientras se carga */
.cp-hidden-while-loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cp-loaded {
    opacity: 1;
}

/* Estilos para mensajes de error de cámara */
.cp-camera-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    color: #721c24;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

.cp-camera-error h4 {
    margin-top: 0;
    color: #721c24;
    margin-bottom: 10px;
}

.cp-camera-error p {
    margin: 5px 0;
}

/* Nota importante */
.cp-nota-importante {
    background: #856404;
    border: 1px solid #856404;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    color: #856404;
}

.cp-nota-importante h4 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 10px;
}

.cp-nota-importante p {
    margin: 0;
    color: #856404;
}

/* Estilos específicos para el área de cámara en móviles */
@media (max-width: 768px) {
    .cp-camera-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cp-camera-selector {
        width: 100%;
    }
    
    .cp-select {
        max-width: 100%;
    }
    
    #cp-btn-detener-escaneo {
        width: 100%;
    }
}

/* Estilos para el buscador en historial */
.cp-historial-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.cp-historial-search {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.cp-search-input-sm {
    padding: 8px 12px;
    font-size: 14px;
    min-height: 36px;
    flex: 1;
}

.cp-historial-buttons {
    display: flex;
    gap: 10px;
}

.cp-historial-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    align-items: center;
}

.cp-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cp-filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--cp-secondary);
    white-space: nowrap;
}

.cp-select-sm {
    padding: 6px 10px;
    font-size: 14px;
    min-height: 36px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    color: #000000 !important; /* Color negro */
}

.cp-select-sm option {
    color: #000000 !important; /* Color negro para opciones */
    background-color: white;
}

.cp-input-date {
    padding: 6px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #000000 !important; /* Color negro */
}

.cp-historial-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.cp-resultados-busqueda-historial {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

#cp-texto-busqueda-historial {
    flex: 1;
}

.cp-pagination-historial {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.cp-page-historial {
    padding: 6px 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    color: var(--cp-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.cp-page-historial:hover,
.cp-page-historial.active {
    background: var(--cp-primary);
    color: white;
    border-color: var(--cp-primary);
}

.cp-page-historial.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cp-page-historial.disabled:hover {
    background: white;
    color: var(--cp-dark);
    border-color: #e2e8f0;
}

/* Modal de exportar */
.cp-modal-exportar {
    max-width: 500px;
}

.cp-exportar-option {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.cp-exportar-option input[type="radio"] {
    margin-right: 10px;
}

.cp-exportar-option label {
    font-weight: 600;
    cursor: pointer;
    color: var(--cp-dark);
}

.cp-exportar-dates {
    margin-top: 15px;
    padding: 15px;
    background: #f1f3f5;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
}

.cp-exportar-date-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cp-exportar-date-group:last-child {
    margin-bottom: 0;
}

.cp-exportar-date-group label {
    min-width: 60px;
    font-weight: 600;
    font-size: 14px;
}

.cp-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

@media (max-width: 768px) {
    .cp-historial-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cp-historial-search {
        min-width: 100%;
    }
    
    .cp-historial-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cp-filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cp-filter-group label {
        width: 100%;
    }
    
    .cp-exportar-date-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cp-exportar-date-group label {
        width: 100%;
    }
    
    .cp-historial-buttons {
        justify-content: stretch;
    }
    
    .cp-historial-buttons .cp-btn {
        flex: 1;
    }
}

/* ===== NUEVOS ESTILOS PARA EL MODAL DE COMENTARIOS ===== */

/* Estilos para los detalles del movimiento */
.cp-detalles-movimiento {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.cp-detalle-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--cp-primary);
}

.cp-detalle-label {
    font-weight: 600;
    color: var(--cp-secondary);
    font-size: 12px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cp-detalle-valor {
    font-size: 14px;
    color: var(--cp-dark);
    font-weight: 500;
    word-break: break-word;
}

/* Sección de comentarios */
.cp-comentarios-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.cp-comentarios-section h4 {
    color: var(--cp-dark);
    margin-bottom: 15px;
    font-size: 18px;
}

.cp-comentarios-actuales {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    min-height: 50px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cp-dark);
    border: 1px solid #e2e8f0;
}

.cp-comentarios-actuales.vacio {
    color: #a0aec0;
    font-style: italic;
}

.cp-comentario-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 120px;
    margin-bottom: 15px;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
    color: #000000 !important; /* Color negro */
}

.cp-comentario-textarea::placeholder {
    color: #666666 !important; /* Color de placeholder negro */
}

.cp-comentario-textarea:focus {
    border-color: var(--cp-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

/* Loading mini para guardar comentarios */
.cp-loading-mini {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Estilos para el modal de detalles en móviles */
@media (max-width: 768px) {
    .cp-detalles-movimiento {
        grid-template-columns: 1fr;
    }
    
    .cp-detalle-item {
        padding: 12px;
    }
    
    .cp-detalle-label {
        font-size: 11px;
    }
    
    .cp-detalle-valor {
        font-size: 13px;
    }
    
    .cp-comentario-textarea {
        min-height: 100px;
        font-size: 16px; /* Para evitar zoom en iOS */
    }
    
    .cp-modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 20px 15px;
    }
    
    .cp-comentarios-section h4 {
        font-size: 16px;
    }
    
    .cp-modal-actions {
        flex-direction: column;
    }
    
    .cp-modal-actions .cp-btn {
        width: 100%;
    }
}

/* Estilos para el estado de los movimientos en el modal */
.cp-estado-ingreso,
.cp-estado-egreso {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.cp-estado-ingreso {
    background: #c6f6d5;
    color: #22543d;
}

.cp-estado-egreso {
    background: #fed7d7;
    color: #742a2a;
}

/* Mejoras para la sección de historial de persona */
.cp-historial-persona {
    margin-top: 25px;
}

.cp-historial-persona h4 {
    color: var(--cp-dark);
    margin-bottom: 15px;
    font-size: 16px;
}

/* Ajustes para el scroll en el modal */
.cp-modal-content {
    max-height: 85vh;
    overflow-y: auto;
}

/* Estilos para cuando el textarea está deshabilitado */
.cp-comentario-textarea:disabled {
    background: #f1f3f5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Clase para input con error */
.cp-input-error {
    border-color: var(--cp-danger) !important;
}

/* Estilos para el responsable en la tabla */
.cp-columna-fecha-usuario {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-fecha-hora {
    font-weight: 500;
    color: var(--cp-dark);
}

.cp-responsable {
    font-size: 11px;
    color: var(--cp-secondary);
    font-style: italic;
    margin-top: 2px;
}
/* ============================================
   ESTILOS PARA INGRESO/EGRESO TRANSITORIO Y PDF
   ============================================ */

/* Estilos para Ingreso/Egreso Transitorio en tabla */
.cp-estado-transitorio {
    background: #9f7aea;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    text-align: center;
    min-width: 140px;
}

/* Hover para transitorios */
.cp-fila-transitorio .cp-estado-transitorio {
    background: #9f7aea;
}

.cp-fila-transitorio:hover .cp-estado-transitorio {
    background: #805ad5;
}

/* Estilos específicos para PDF */
.transitorio-ingreso,
.transitorio-egreso {
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 12px;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.transitorio-ingreso {
    background: #9f7aea;
    color: white;
}

.transitorio-egreso {
    background: #b794f4;
    color: white;
}

/* Mejora para el selector de establecimiento en modal */
#cp-pdf-establecimiento {
    color: #000000 !important;
    background-color: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
}

#cp-pdf-establecimiento option {
    color: #000000 !important;
    background-color: white;
}

#cp-pdf-establecimiento:focus {
    border-color: #ff6600;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

/* Stats en PDF */
.stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-item {
    background: white;
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid #ff6600;
    font-size: 12px;
    font-weight: 600;
}

/* Info box en PDF */
.info-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 6px solid #ff6600;
    font-size: 13px;
}

.info-box p {
    margin: 5px 0;
}

/* Estilos para impresión */
@media print {
    .info-box {
        border: 1px solid #ff6600;
        background: #f5f5f5;
    }
    
    .stat-item {
        border: 1px solid #666;
        background: white;
    }
    
    h1 {
        color: black !important;
    }
    
    th {
        background: #333 !important;
        color: white !important;
    }
}

/* Estilos responsivos para el modal PDF */
@media (max-width: 768px) {
    #cp-modal-exportar-pdf .cp-modal-content {
        width: 95%;
        padding: 15px;
    }
    
    #cp-modal-exportar-pdf h3 {
        font-size: 20px;
    }
    
    #cp-modal-exportar-pdf .cp-modal-actions {
        flex-direction: column;
    }
    
    #cp-modal-exportar-pdf .cp-modal-actions button {
        width: 100%;
    }
    
    #cp-pdf-establecimiento {
        font-size: 16px; /* Para evitar zoom en iOS */
    }
}