:root {
    --primary-color: #3b71ca;
    --secondary-color: #6c757d;
    --success-color: #14a44d;
    --dark-color: #212529;
    --border-color: #dee2e6;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-hover: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8fafc;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.logo img {
    height: auto;
    max-width: 100%;
    display: block;
}

/* Input Group compacto - ancho automático basado en contenido */
.compact-input-group {
    font-family: 'Poppins', sans-serif;
    box-shadow: var(--shadow);
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    background: white;
    height: 38px;
    display: inline-flex !important; /* Cambiado a inline-flex */
    width: auto !important; /* Ancho automático basado en contenido */
    max-width: 100%; /* Máximo ancho disponible */
}

.compact-input-group:hover {
    border-color: var(--primary-color);
}

/* Resetear flex de Bootstrap y forzar anchos */
.compact-input-group > * {
    flex: none !important; /* Deshabilitar flex automático */
}

/* Select compacto - ancho 180px */
.compact-select {
    background-color: white;
    border: none !important;
    border-right: 1px solid var(--border-color) !important;
    width: 180px !important; /* Nuevo ancho */
    height: 36px !important; /* Forzar altura */
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--dark-color);
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.compact-select:focus {
    background-color: white;
    box-shadow: inset 0 0 0 1px var(--primary-color);
    z-index: 3;
}

/* Input compacto - ancho 280px */
.compact-input {
    border: none !important;
    border-right: 1px solid var(--border-color) !important;
    width: 280px !important; /* Nuevo ancho */
    height: 36px !important; /* Forzar altura */
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--dark-color);
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.compact-input:focus {
    box-shadow: inset 0 0 0 1px var(--primary-color);
    z-index: 3;
}

.compact-input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

/* Botón de reset compacto - ancho 36px solo icono */
.compact-reset-btn {
    background: linear-gradient(180deg, #6b7280 0%, #374151 50%, #1f2937 100%);
    color: #ffffff;
    border: none !important;
    border-left: 1px solid var(--border-color) !important;
    width: 36px !important; /* Ancho cuadrado para solo icono */
    height: 36px !important; /* Misma altura que los otros elementos */
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    padding: 0 !important; /* Sin padding para centrar mejor el icono */
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1;
}

.compact-reset-btn:hover {
    background: linear-gradient(180deg, #7c8696 0%, #4b5563 50%, #374151 100%);
    color: #ffffff;
    transform: scale(1.05);
}

/* Estados focus para accesibilidad */
.compact-select:focus-visible,
.compact-input:focus-visible,
.compact-reset-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
    z-index: 4;
}

/* Tarjetas de toner */
.toner-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.toner-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.toner-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toner-code {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    word-break: break-word;
}

.toner-brand {
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Colores de marcas */
.toner-brand.hp { background: #0096D6; }
.toner-brand.brother { background: #0033A0; }
.toner-brand.canon { background: #BC002D; }
.toner-brand.samsung { background: #1428A0; }
.toner-brand.xerox { background: #FF0000; }
.toner-brand.kyocera { background: #ED1C24; }
.toner-brand.lexmar { background: #0066CC; }
.toner-brand.sharp { background: #FF0000; }
.toner-brand.okidata { background: #68217A; }
.toner-brand.ricoh { background: #014983; }
.toner-brand.default { background: var(--secondary-color); }

/* Detalles del toner */
.toner-details {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-label {
    font-weight: 500;
    color: var(--secondary-color);
    min-width: 100px;
    font-size: 0.875rem;
}

.detail-value {
    color: var(--dark-color);
    text-align: right;
    flex: 1;
    margin-left: 10px;
    font-size: 0.875rem;
    word-break: break-word;
}

/* Precio */
.price {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Compatibilidad */
.compatibility {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    border-left: 4px solid var(--primary-color);
    max-height: 120px;
    overflow-y: auto;
}

.compatibility-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.compatibility-list {
    line-height: 1.4;
    color: var(--dark-color);
}

/* Paginación */
.page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0 0.125rem;
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
}

.page-btn:hover, 
.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.page-dots {
    padding: 0.5rem 0.75rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Sin resultados */
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: 0.5rem;
    color: var(--secondary-color);
    border: 2px dashed var(--border-color);
}

/* WhatsApp Float */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 25px;
    right: 25px;
    background: linear-gradient(135deg, #25d366, #128C7E);
    color: #FFF;
    border-radius: 50px;
    font-size: 30px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-tooltip {
    position: absolute;
    right: 70px;
    bottom: 15px;
    background: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    font-family: 'Poppins', sans-serif;
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent transparent var(--primary-color);
}

.whatsapp-float:hover .whatsapp-tooltip {
    opacity: 1;
    transform: translateX(0);
}

@keyframes pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); 
    }
}

/* Modal de WhatsApp */
.whatsapp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.whatsapp-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-hover);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--dark-color);
}

.whatsapp-number {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.whatsapp-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.whatsapp-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 140px;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.whatsapp-btn.primary {
    background: var(--primary-color);
    color: white;
}

.whatsapp-btn.primary:hover {
    background: #2d63a8;
    transform: translateY(-1px);
}

.whatsapp-btn.secondary {
    background: #f8f9fa;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
}

.whatsapp-btn.secondary:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
}

/* Footer */
footer {
    background: #2d3748;
    border-top: 3px solid var(--primary-color);
    margin-top: auto;
}

footer .text-warning {
    color: #fbbf24;
}

/* Responsive para input-group compacto */
@media (max-width: 1200px) {
    .compact-select {
        width: 180px !important;
    }
    
    .compact-input {
        width: 280px !important;
    }
    
    .compact-reset-btn {
        width: 36px !important;
    }
}

@media (max-width: 992px) {
    .compact-input-group {
        flex-wrap: nowrap;
    }
    
    .compact-select {
        width: 160px !important; /* Ajustado para tablet */
    }
    
    .compact-input {
        width: 240px !important; /* Ajustado para tablet */
    }
    
    .compact-reset-btn {
        width: 36px !important;
    }
}

@media (max-width: 768px) {
    .compact-input-group {
        flex-direction: column;
        gap: 0.5rem;
        border-radius: 0.375rem;
        height: auto;
        width: 100% !important; /* En móvil ocupa todo el ancho */
        display: flex !important;
    }
    
    .compact-input-group .compact-select,
    .compact-input-group .compact-input,
    .compact-input-group .compact-reset-btn {
        width: 100% !important;
        border-radius: 0.375rem;
        border: 1px solid var(--border-color) !important;
        height: 38px;
    }
    
    .compact-select {
        border-right: 1px solid var(--border-color) !important;
    }
    
    .compact-input {
        border-right: 1px solid var(--border-color) !important;
    }
    
    .compact-reset-btn {
        border-left: 1px solid var(--border-color) !important;
        width: 100% !important; /* En móvil ocupa todo el ancho */
        justify-content: center;
    }
    
    header .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo {
        text-align: center;
    }
    
    .toner-card {
        padding: 1rem;
    }
    
    .toner-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .detail-label,
    .detail-value {
        min-width: auto;
        text-align: left;
        margin-left: 0;
    }
    
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-tooltip {
        display: none;
    }
    
    .page-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
        margin: 0 0.0625rem;
    }
    
    .page-dots {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .whatsapp-modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .whatsapp-buttons {
        flex-direction: column;
    }
    
    .whatsapp-btn {
        min-width: 100%;
    }
}

@media (max-width: 576px) {
    #pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .page-btn, 
    .page-dots {
        margin: 0.125rem;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .toner-code {
        font-size: 1rem;
    }
    
    .price {
        font-size: 1.1rem;
        padding: 0.75rem;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .toner-card:hover {
        transform: none;
    }
    
    .whatsapp-float {
        animation: none;
    }
    
    .compact-input-group:hover {
        transform: none;
    }
}

/* Scrollbar personalizado */
.compatibility::-webkit-scrollbar {
    width: 6px;
}

.compatibility::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.compatibility::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

.compatibility::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}