
/* Animaciones y efectos adicionales */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Mobile Responsive - Simplificado */
@media (max-width: 900px) {
    .app-header {
        padding: 0.75rem 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .dashboard-container {
        padding: 0.5rem;
        min-height: calc(100vh - 60px); /* Ajuste para header más pequeño */
    }
    
    .dashboard-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .dashboard-actions {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-info {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .action-card {
        min-height: 150px;
        padding: 1rem;
    }
    
    .action-card h3 {
        font-size: 1.1rem;
    }

    .user-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: medium;
    }

    .user-info p {
        font-size: medium;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.5rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .dashboard-container {
        padding: 0.25rem;
        min-height: calc(100vh - 50px);
    }
    
    .dashboard-header {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .dashboard-header h1 {
        font-size: 1.3rem;
    }
    
    .action-card, .info-section, .test-info {
        padding: 1rem;
    }
    
    .btn-action, .btn-logout, .btn-secondary {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .login-container {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
    }
}

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

/* Print styles */
@media print {
    .app-header,
    .quick-actions,
    .btn-action,
    .btn-logout,
    .btn-secondary {
        display: none !important;
    }
    
    body {
        background: var(--white) !important;
    }
    
    .dashboard-container,
    .action-card,
    .info-section {
        box-shadow: none !important;
        border: 1px solid var(--input-border-muted) !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Responsive para tablas */
@media (max-width: 1500px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    
    .data-table {
        min-width: 700px; /* Aumentar el ancho mínimo */
        table-layout: auto; /* Permitir que las columnas se ajusten */
    }

    .data-table th {
        padding: 0.75rem 0.75rem;
        font-size: 0.9rem;
        width: auto; /* Permitir que el ancho se ajuste */
    }
    .data-table td {
        padding: 0.75rem 0.75rem;
        width: auto; /* Permitir que el ancho se ajuste */
        white-space: nowrap; /* Evitar el ajuste de línea */
        
    }
    
    .actions-cell .btn-small {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
        margin-right: 0.5rem;
        margin-bottom: 0.25rem;
        min-width: 70px;
    }
    
    .actions-cell .btn-small:last-child {
        margin-right: 0;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .admin-top {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .admin-actions {
        width: 100%;
        justify-content: stretch;
        padding: 0;
        flex-wrap: wrap;
    }
    
    .admin-actions .btn-action,
    .admin-actions .btn-secondary {
        flex: 1;
        font-size: medium;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
    }
    
    .actions-cell {
        text-align: left;
        padding: 0.5rem 0.25rem;
    }
    
    .actions-cell .btn-small {
        display: inline-block;
        margin: 0.2rem 0.25rem;
        width: auto;
        min-width: 65px;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Search Bar Responsive */
@media (max-width: 768px) {
    .search-bar-container {
        margin: 0 0.5rem;
    }
    
    .search-bar {
        padding: 0.75rem;
    }
    
    .search-input {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 0.75rem;
    }
    
    .search-btn,
    .clear-btn {
        width: 40px;
        height: 40px;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-results-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .toggle-filters-btn {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .search-input-wrapper {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-input {
        width: 100%;
    }
    
    .search-btn,
    .clear-btn {
        width: 100%;
        height: 44px;
        border-radius: 8px;
    }
    
    .search-btn {
        order: -1;
    }
    
    .filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}

/* Animaciones para la selección de filas */
@keyframes rowSelect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1.02);
    }
}

/* Orientación landscape en móviles */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #busquedaModal .modal-container {
        max-height: 95vh;
    }
    
    #busquedaModal .modal-header {
        padding: 0.5rem 1rem;
    }
    
    #busquedaModal .modal-body {
        padding: 0.75rem 1rem;
    }
    
    #busquedaModal .navigation-help {
        display: none;
    }
    
    #busquedaModal .modal-footer {
        padding: 0.5rem 1rem;
    }
}

/* Pantallas muy pequeñas */
@media screen and (max-width: 360px) {
    #busquedaModal .modal-header h3 {
        font-size: 0.9rem;
    }
    
    #busquedaModal .table th:nth-child(1),
    #busquedaModal .table td:nth-child(1) {
        width: 35%;
    }
    
    #busquedaModal .table th:nth-child(2),
    #busquedaModal .table td:nth-child(2) {
        width: 50%;
    }
    
    #busquedaModal .table th:nth-child(4),
    #busquedaModal .table td:nth-child(4) {
        width: 15%;
    }
}

/* Móviles */
@media screen and (max-width: 480px) {
    #busquedaModal.modal-overlay {
        padding: 0.25rem;
    }
    
    #busquedaModal .modal-container {
        max-height: 98vh;
        border-radius: 8px;
    }
    
    #busquedaModal .modal-header {
        padding: 0.75rem;
    }
    
    #busquedaModal .modal-header h3 {
        font-size: 1rem;
    }
    
    #busquedaModal .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1.5rem;
    }
    
    #busquedaModal .modal-body {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    #busquedaModal .search-input {
        padding: 0.75rem 2.25rem 0.75rem 0.875rem;
        font-size: 16px;
    }
    
    #busquedaModal .clear-btn {
        right: 8px;
        padding: 6px;
    }
    
    #busquedaModal .clear-icon {
        width: 16px;
        height: 16px;
    }
    
    #busquedaModal #productosInfo {
        padding: 0.375rem 0.75rem;
        margin-bottom: 0.5rem !important;
    }
    
    #busquedaModal #productosCount {
        font-size: 0.8rem;
    }
    
    #busquedaModal .table {
        font-size: 0.75rem;
    }
    
    #busquedaModal .table-header th,
    #busquedaModal .table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Ajustar anchos para móviles */
    #busquedaModal .table th:nth-child(1),
    #busquedaModal .table td:nth-child(1) {
        width: 30%;
    }
    
    #busquedaModal .table th:nth-child(2),
    #busquedaModal .table td:nth-child(2) {
        width: 55%;
    }
    
    #busquedaModal .table th:nth-child(4),
    #busquedaModal .table td:nth-child(4) {
        width: 15%;
    }
    
    #busquedaModal .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    #busquedaModal .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        min-width: 32px;
    }
    
    #busquedaModal .text-muted {
        font-size: 0.7rem;
    }
    
    #busquedaModal .navigation-help {
        padding: 0.5rem;
        font-size: 0.75rem;
        display: none; /* Ocultar en móviles para ahorrar espacio */
    }
    
    #busquedaModal .modal-footer {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    #busquedaModal .btn-primary,
    #busquedaModal .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        flex: 1;
    }
}

/* Tablets y pantallas medianas */
@media screen and (max-width: 768px) {
    #busquedaModal.modal-overlay {
        padding: 0.5rem;
    }
    
    #busquedaModal .modal-container {
        max-width: 100%;
        max-height: 95vh;
    }
    
    #busquedaModal .modal-header {
        padding: 1rem;
    }
    
    #busquedaModal .modal-header h3 {
        font-size: 1.1rem;
    }
    
    #busquedaModal .modal-body {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    #busquedaModal .search-input {
        padding: 0.875rem 2.5rem 0.875rem 1rem;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    #busquedaModal .table-responsive {
        border-radius: 8px;
    }
    
    #busquedaModal .table {
        font-size: 0.8rem;
    }
    
    #busquedaModal .table-header th,
    #busquedaModal .table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Ocultar código de barras en tablets */
    #busquedaModal .table th:nth-child(3),
    #busquedaModal .table td:nth-child(3) {
        display: none;
    }
    
    /* Ajustar anchos de columnas */
    #busquedaModal .table th:nth-child(1),
    #busquedaModal .table td:nth-child(1) {
        width: 25%;
    }
    
    #busquedaModal .table th:nth-child(2),
    #busquedaModal .table td:nth-child(2) {
        width: 60%;
    }
    
    #busquedaModal .table th:nth-child(4),
    #busquedaModal .table td:nth-child(4) {
        width: 15%;
        text-align: center;
    }
    
    #busquedaModal .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    #busquedaModal .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    #busquedaModal .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    #busquedaModal .btn-primary,
    #busquedaModal .btn-secondary {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* Responsive para el modal de búsqueda */
@media (max-width: 768px) {
    #busquedaModal .modal-container {
        max-width: 95%;
        margin: 1rem;
    }
    
    #busquedaModal .data-table th,
    #busquedaModal .data-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    #busquedaModal .data-table th:nth-child(3),
    #busquedaModal .data-table td:nth-child(3) {
        display: none; /* Ocultar marca en móviles */
    }
}

/* Animación de spinner para carga */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .search-input {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .search-btn, .clear-btn {
        width: 40px;
        height: 40px;
        margin: 0 0.25rem;
    }
    
    .search-icon, .clear-icon {
        width: 18px;
        height: 18px;
    }
}
