/**
 * Estilos para Display de Puntos - Frontend
 * 
 * @package ObjetecaPuntos
 * @version 2.1.1 - Refactorizado con assets externos
 */

/* ========================================
   CAJA PRINCIPAL DE PUNTOS
   ======================================== */
.objeteca-puntos-box {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.objeteca-puntos-box h3 {
    margin: 0 0 15px 0;
    color: #2271b1;
    font-size: 20px;
    font-weight: 600;
}

/* ========================================
   NÚMEROS Y LABELS DE PUNTOS
   ======================================== */
.objeteca-puntos-numero {
    font-size: 48px;
    font-weight: bold;
    color: #2271b1;
    display: block;
    margin: 10px 0;
    line-height: 1.2;
}

.objeteca-puntos-numero-solo {
    font-size: 48px;
    font-weight: bold;
    color: #2271b1;
    display: block;
    margin-bottom: 20px;
    line-height: 1.2;
}

.objeteca-puntos-label {
    font-size: 18px;
    color: #666;
    font-weight: 500;
    margin-top: 10px;
    display: block;
}

/* ========================================
   FORMATO MINI
   ======================================== */
.objeteca-puntos-mini {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f0f0;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    color: #1d2327;
    border: 1px solid #ddd;
}

.objeteca-puntos-mini .dashicons {
    color: #f39c12;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ========================================
   MODO MÍNIMO (NUEVO)
   ======================================== */
.objeteca-puntos-minimo {
    text-align: center;
    margin: 20px 0;
}

.objeteca-btn-historial {
    padding: 10px 20px;
    margin-top: 15px;
    cursor: pointer;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.objeteca-btn-historial:hover {
    background: #135e96;
    color: white;
}

.objeteca-btn-historial:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ========================================
   HISTORIAL DE PUNTOS
   ======================================== */
.objeteca-historial-toggle {
    margin-top: 15px;
}

.objeteca-historial-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.objeteca-historial-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
}

.objeteca-historial-table th,
.objeteca-historial-table td {
    padding: 5px 0; /* Solo padding vertical, sin padding lateral */
    text-align: left;
    border: none; /* Eliminar todos los bordes primero */
    vertical-align: middle;
}

/* Solo líneas horizontales entre filas */
.objeteca-historial-table tr {
    border-bottom: 1px dotted #000;
}

/* Quitar línea de la última fila */
.objeteca-historial-table tr:last-child {
    border-bottom: none;
}

.objeteca-historial-table th {
    font-weight: bold;
    color: #1d2327;
    font-size: .9rem;
}

.objeteca-historial-table td {
    font-size: .9rem;
    color: #1d2327;
}

/* Asegurar que no hay efectos del tema */
.objeteca-historial-table tbody tr {
    background: transparent !important;
}

.objeteca-historial-table tbody tr:hover td {
    background: transparent !important;
}

/* Eliminar todos los fondos */
.objeteca-historial-table tr:nth-child(even),
.objeteca-historial-table tr:hover {
    background: transparent;
}

/* AÑADIR AQUÍ - Forzar eliminación de TODOS los fondos */
.objeteca-historial-table,
.objeteca-historial-table thead,
.objeteca-historial-table tbody,
.objeteca-historial-table tr,
.objeteca-historial-table th,
.objeteca-historial-table td {
    background: transparent !important;
    background-color: transparent !important;
}

/* Específicamente para filas pares e impares */
.objeteca-historial-table tbody tr:nth-child(odd),
.objeteca-historial-table tbody tr:nth-child(even),
.objeteca-historial-table tbody tr:hover,
.objeteca-historial-table tr.even,
.objeteca-historial-table tr.odd,
.objeteca-historial-table tr.alt {
    background: transparent !important;
    background-color: transparent !important;
}

/* ========================================
   COLORES DE PUNTOS
   ======================================== */
.objeteca-puntos-positivo {
    color: #28a745;
    font-weight: bold;
}

.objeteca-puntos-negativo {
    color: #dc3545;
    font-weight: bold;
}

/* ========================================
   ENLACES EN HISTORIAL
   ======================================== */
.objeteca-historial-table a {
    color: #2271b1;
    text-decoration: none;
    font-size: 12px;
    padding: 2px 8px;
    background: #e7f3ff;
    border-radius: 3px;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.objeteca-historial-table a:hover {
    background: #2271b1;
    color: white;
    text-decoration: none;
}

/* ========================================
   LOADING Y ESTADOS
   ======================================== */
.objeteca-historial-loading {
    text-align: center;
    padding: 20px;
    color: #646970;
    font-style: italic;
}

.objeteca-historial-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 4px;
    margin: 10px 0;
}

.objeteca-historial-empty {
    text-align: center;
    padding: 30px;
    color: #646970;
    font-style: italic;
    background: #fafafa;
    border-radius: 4px;
}

/* ========================================
   ANIMACIONES
   ======================================== */
.objeteca-historial-container {
    transition: all 0.3s ease;
    overflow: hidden;
}

.objeteca-historial-fade-in {
    animation: objetecaFadeIn 0.4s ease-out;
}

@keyframes objetecaFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.objeteca-btn-historial {
    transition: all 0.2s ease;
}

.objeteca-btn-historial.loading {
    opacity: 0.7;
    cursor: wait;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .objeteca-puntos-numero,
    .objeteca-puntos-numero-solo {
        font-size: 36px;
    }
    
    .objeteca-puntos-label {
        font-size: 16px;
    }
    
    .objeteca-puntos-box {
        padding: 15px;
        margin: 15px 0;
    }
    
    .objeteca-historial-table {
        font-size: .9rem;
    }
    
    .objeteca-historial-table th,
    .objeteca-historial-table td {
        padding: 8px 6px;
    }
    
    .objeteca-historial-table th {
        font-size: .9rem;
    }
    
    /* Ocultar columna fecha en móvil muy pequeño */
    @media (max-width: 480px) {
        .objeteca-historial-table th:first-child,
        .objeteca-historial-table td:first-child {
            display: none;
        }
    }
}

@media (max-width: 600px) {
    .objeteca-puntos-minimo {
        margin: 15px;
    }
    
    .objeteca-btn-historial {
        padding: 12px 20px;
        font-size: 15px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .objeteca-historial-container,
    .objeteca-btn-historial,
    .objeteca-historial-table a {
        transition: none;
    }
    
    .objeteca-historial-fade-in {
        animation: none;
    }
}

/* Focus visible para mejor accesibilidad */
.objeteca-btn-historial:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.objeteca-historial-table a:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

/* ========================================
   UTILIDADES
   ======================================== */
.objeteca-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;
}

/* Evitar salto de layout durante carga */
.objeteca-puntos-box,
.objeteca-puntos-minimo {
    min-height: 100px;
}

.objeteca-historial-container[style*="display: none"] {
    height: 0;
    overflow: hidden;
}

/* Estados de carga */
.objeteca-display-loading {
    opacity: 0.6;
    pointer-events: none;
}

.objeteca-display-error {
    border-color: #dc3545;
    background: #fff5f5;
}

.objeteca-display-success {
    border-color: #28a745;
    background: #f8fff9;
}