/**
 * LOYALTY POINTS SYSTEM - CSS STYLES
 * Estilos para sistema de puntos de lealtad
 */

/* ========================================
   TOGGLE SWITCH - Tipo de Cliente
   ======================================== */

.toggle-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
}

.toggle-label {
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s, font-weight 0.3s;
    font-size: 0.95rem;
}

.toggle-label.active {
    color: var(--primary);
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary);
    transition: 0.3s;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.toggle-slider {
    background-color: var(--warning);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

input:checked+.toggle-slider:before {
    transform: translateX(30px);
}

.form-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* ========================================
   PREMIUM GOLDEN BUTTON - USAR PUNTOS
   ======================================== */

.btn-use-points {
    width: 100%;
    margin-top: 0.8rem;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;

    /* Golden Gradient */
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    color: #1a1a2e;
    box-shadow:
        0 4px 15px rgba(255, 215, 0, 0.4),
        0 0 20px rgba(255, 215, 0, 0.2);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.btn-use-points::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.btn-use-points:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, #FFED4E 0%, #FFB347 50%, #FF8C00 100%);
}

.btn-use-points:active {
    transform: translateY(0);
    box-shadow:
        0 2px 10px rgba(255, 215, 0, 0.4),
        0 0 15px rgba(255, 215, 0, 0.2);
}

.btn-use-points i {
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Estado cuando los puntos están aplicados */
.btn-use-points.points-applied {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow:
        0 4px 15px rgba(76, 175, 80, 0.4),
        0 0 20px rgba(76, 175, 80, 0.2);
}

.btn-use-points.points-applied::before {
    animation: none;
}

.btn-use-points:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ======================================== */

/* ========================================
   LOYALTY BADGES - POS
   ======================================== */

.client-loyalty-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.1));
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    margin-bottom: 1rem;
}

.loyalty-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.loyalty-badge i {
    font-size: 1.1rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ========================================
   POINTS CONFIGURATION - Productos
   ======================================== */

.loyalty-config {
    background: rgba(139, 92, 246, 0.05);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    margin-top: 1rem;
}

.loyalty-config h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.loyalty-config label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.loyalty-config input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.loyalty-config select {
    flex: 1;
    max-width: 200px;
}

/* ========================================
   MODAL DE CANJE - Redeem Points
   ======================================== */

#redeem-points-modal .points-summary {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.1));
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.available-points {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.available-points span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.conversion-rate {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
    margin-top: 0.5rem;
}

.redemption-preview {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 1.1rem;
}

.redemption-preview strong {
    color: var(--success);
    font-size: 1.3rem;
}

.redemption-limits {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.redemption-limits small {
    color: var(--warning);
    line-height: 1.6;
}

/* ========================================
   POINTS EARNED NOTIFICATION
   ======================================== */

.points-earned-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--success), #10b981);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
    z-index: 10000;
    animation: slideInRight 0.5s ease-out;
    max-width: 350px;
}

.points-earned-notification i {
    font-size: 1.5rem;
    margin-right: 0.8rem;
    animation: bounce 1s infinite;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   HISTORIAL DE PUNTOS - Table
   ======================================== */

.points-history-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.points-history-filters select,
.points-history-filters input {
    flex: 1;
    min-width: 200px;
}

.transaction-row {
    transition: background 0.2s;
}

.transaction-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.transaction-type-earned {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid var(--success);
}

.transaction-type-redeemed {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger);
}

.transaction-type-expired {
    background: rgba(100, 100, 100, 0.1);
    border-left: 3px solid var(--text-muted);
    opacity: 0.7;
}

.transaction-type-welcome_bonus {
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid var(--warning);
}

.transaction-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-earned {
    background: var(--success);
    color: white;
}

.badge-redeemed {
    background: var(--danger);
    color: white;
}

.badge-expired {
    background: var(--text-muted);
    color: white;
}

.badge-bonus {
    background: var(--warning);
    color: white;
}

.expiration-warning {
    color: var(--warning);
    font-weight: 600;
}

.expiration-ok {
    color: var(--text-muted);
}

/* ========================================
   PUNTOS STATS - Dashboard
   ======================================== */

.loyalty-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.loyalty-stat-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.1));
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    text-align: center;
}

.loyalty-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.loyalty-stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .client-loyalty-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-switch-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .points-history-filters {
        flex-direction: column;
    }

    .points-history-filters select,
    .points-history-filters input {
        width: 100%;
        min-width: auto;
    }
}

/* ========================================
   LOYALTY BLOCK - Client Management
   ======================================== */

.loyalty-block-control {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
}

.loyalty-block-control.blocked {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.loyalty-block-control label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}

.loyalty-block-control input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.loyalty-block-control small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-style: italic;
}

.loyalty-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.loyalty-status-badge.active {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.loyalty-status-badge.blocked {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.loyalty-status-badge.ineligible {
    background: rgba(100, 100, 100, 0.2);
    color: var(--text-muted);
}