/* ============================================
   RESPONSIVE - MEJORAS PARA MÓVILES
   ============================================ */

@media (max-width: 1024px) {
    /* Tablets */
    .content-top-bar {
        gap: 15px;
    }
    
    .search-section {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    /* Móviles grandes */
    .content-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-section {
        max-width: 100%;
    }

    .search-form {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .search-input {
        min-width: 0;
        flex: 1;
    }

    .btn-search {
        flex-shrink: 0;
    }

    .btn-clear-search {
        flex-shrink: 0;
    }

    .btn-create {
        width: 100%;
        justify-content: center;
    }

    /* Tabla responsive - Scroll horizontal */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
        font-size: 13px;
    }

    .data-table thead th {
        padding: 10px 12px;
        font-size: 11px;
    }

    .data-table tbody td {
        padding: 10px 12px;
        font-size: 14px;
    }

    .item-name {
        font-size: 14px;
    }

    .badge {
        font-size: 13px;
    }

    .badge i {
        width: 16px;
        height: 16px;
    }

    .price,
    .amount {
        font-size: 14px;
    }

    .btn-action {
        width: 32px;
        height: 32px;
    }

    .btn-action i {
        width: 16px;
        height: 16px;
    }

    /* Paginación */
    .pagination {
        flex-direction: column;
        gap: 12px;
        padding: 12px 15px;
    }

    .pagination-info {
        font-size: 13px;
        text-align: center;
    }

    .pagination-buttons {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .pagination-buttons a {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    /* Móviles pequeños */
    .search-form {
        flex-direction: column;
    }

    .btn-search,
    .btn-clear-search {
        width: 100%;
        justify-content: center;
        padding: 10px;
    }

    .data-table {
        min-width: 500px;
    }

    .data-table thead th {
        padding: 8px 10px;
        font-size: 10px;
    }

    .data-table tbody td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }

    .btn-action {
        width: 28px;
        height: 28px;
    }

    .btn-action i {
        width: 14px;
        height: 14px;
    }

    .pagination-buttons a {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Ocultar algunos números de página en móviles muy pequeños */
    .pagination-buttons a:not(.active):not(:first-child):not(:last-child):nth-child(n+4) {
        display: none;
    }
}

/* Mejoras adicionales para scroll horizontal */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Indicador visual de scroll disponible en móviles */
@media (max-width: 768px) {
    .table-wrapper::after {
        content: '← Desliza →';
        display: block;
        text-align: center;
        padding: 8px;
        font-size: 11px;
        color: #9CA3AF;
        background: #F9FAFB;
        border-top: 1px solid #E5E7EB;
    }
    
    /* Ocultar indicador cuando ya no hay scroll */
    .table-wrapper.scrolled::after {
        display: none;
    }
}



    /* Barra superior */
    .content-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        gap: 20px;
        flex-wrap: wrap;
    }

    .search-section {
        flex: 1;
        min-width: 300px;
    }

    .search-form {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .search-input {
        flex: 1;
        padding: 10px 16px;
        border: 1px solid #E5E7EB;
        border-radius: 8px;
        font-size: 14px;
        color: #1F2937;
        transition: all 0.2s;
    }

    .search-input:focus {
        outline: none;
        border-color: #8B5CF6;
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    }

    .search-input::placeholder {
        color: #9CA3AF;
    }

    /* Botones */
    .btn-search,
    .btn-clear-search,
    .btn-create {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        border: none;
        text-decoration: none;
    }

    .btn-search {
        background: #8B5CF6;
        color: white;
    }

    .btn-search:hover {
        background: #7C3AED;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    }

    .btn-clear-search {
        background: #F3F4F6;
        color: #6B7280;
    }

    .btn-clear-search:hover {
        background: #E5E7EB;
        color: #374151;
    }

    .btn-create {
        background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
        color: white;
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    }

    .btn-create:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
    }

    .btn-search i,
    .btn-clear-search i,
    .btn-create i {
        width: 16px;
        height: 16px;
    }

    /* Tabla */
    .table-wrapper {
        background: white;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

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

    .data-table thead {
        background: #F9FAFB;
        border-bottom: 2px solid #E5E7EB;
    }

    .data-table th {
        padding: 12px 16px;
        text-align: left;
        font-size: 11px;
        font-weight: 600;
        color: #6B7280;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .data-table tbody tr {
        border-bottom: 1px solid #F3F4F6;
        transition: all 0.2s;
    }

    .data-table tbody tr:hover {
        background: #F9FAFB;
    }

    .data-table tbody tr:last-child {
        border-bottom: none;
    }

    .data-table td {
        padding: 12px 16px;
        font-size: 14px;
        color: #374151;
    }

    .no-results {
        text-align: center;
        padding: 60px 20px !important;
    }

    /* Botones de acción */
    .action-buttons {
        display: flex;
        gap: 8px;
    }

    .btn-action {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
        background: #F3F4F6;
        color: #6B7280;
    }

    .btn-action i {
        width: 16px;
        height: 16px;
    }

    .btn-action:hover {
        transform: translateY(-1px);
    }

    .btn-edit:hover {
        background: #DBEAFE;
        color: #2563EB;
    }

    .btn-delete:hover {
        background: #FEE2E2;
        color: #DC2626;
    }

    /* Paginación */
    .pagination {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        border-top: 1px solid #F3F4F6;
        flex-wrap: wrap;
        gap: 15px;
    }

    .pagination-info {
        font-size: 14px;
        color: #6B7280;
    }

    .pagination-buttons {
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .pagination-buttons a {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 500;
        color: #6B7280;
        background: white;
        border: 1px solid #E5E7EB;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
    }

    .pagination-buttons a:hover:not(.disabled) {
        background: #F9FAFB;
        border-color: #8B5CF6;
        color: #8B5CF6;
    }

    .pagination-buttons a.active {
        background: #8B5CF6;
        color: white;
        border-color: #8B5CF6;
    }

    .pagination-buttons a.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }

    .pagination-buttons a i {
        width: 14px;
        height: 14px;
    }

    /* Celdas compactas */
    .cell-content {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
    }

    .text-primary {
        font-weight: 500;
        color: #1F2937;
    }

    .text-secondary {
        color: #6B7280;
    }

    .text-muted {
        color: #D1D5DB;
        font-style: italic;
    }

    .text-valor {
        font-weight: 600;
        color: #10B981;
        font-size: 15px;
    }

    .cell-dispositivo {
        color: #6B7280;
        font-size: 13px;
    }

    .cell-dispositivo i {
        width: 14px;
        height: 14px;
        color: #9CA3AF;
    }

    .cell-mac {
        font-family: 'Courier New', monospace;
    }

    .mac-address {
        background: #F3F4F6;
        color: #4B5563;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
        letter-spacing: 0.5px;
        display: inline-block;
    }

    .cell-fecha {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .fecha-dia {
        color: #374151;
        font-weight: 500;
        font-size: 13px;
    }

    /* Contador regresivo */
    .countdown-timer {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
    }

    .countdown-timer i {
        width: 16px;
        height: 16px;
    }

    .countdown-text {
        font-family: 'Courier New', monospace;
        font-weight: 600;
    }

    .countdown-expiring {
        color: #DC2626 !important;
    }

    .countdown-expiring .countdown-text {
        color: #DC2626;
    }

    .countdown-warning {
        color: #F59E0B !important;
    }

    .countdown-warning .countdown-text {
        color: #F59E0B;
    }

    .countdown-normal {
        color: #10B981 !important;
    }

    .countdown-normal .countdown-text {
        color: #10B981;
    }

    /* Filas con estados */
    .expiring-soon {
        background: #FEF3C7 !important;
    }

    .expired {
        background: #FEE2E2 !important;
    }

    @media (max-width: 768px) {
        .content-top-bar {
            flex-direction: column;
            align-items: stretch;
        }

        .search-section {
            width: 100%;
            min-width: 100%;
        }

        .search-form {
            flex-direction: column;
        }

        .btn-create {
            width: 100%;
            justify-content: center;
        }

        .pagination {
            flex-direction: column;
            gap: 10px;
        }

        .pagination-buttons {
            width: 100%;
            justify-content: center;
            flex-wrap: wrap;
        }

        .cell-content {
            font-size: 13px;
        }

        .text-primary {
            font-size: 13px;
        }

        .text-secondary {
            font-size: 12px;
        }

        .text-valor {
            font-size: 14px;
        }

        .mac-address {
            font-size: 11px;
            padding: 3px 6px;
        }

        .fecha-dia {
            font-size: 12px;
        }

        .countdown-timer {
            font-size: 12px;
        }
    }
