/* =============================================
   Mecha Loyalty Core - Frontend Styles
   ============================================= */

/* Dashboard Mi Cuenta */
.mecha-dashboard {
    margin-top: 20px;
}

.mecha-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.stat-box h3 {
    margin-top: 0;
    font-size: 14px;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 1px;
}

.stat-box .big-number {
    color: #D4AF37;
    font-size: 2.5em;
    display: block;
    font-weight: 700;
    line-height: 1.2;
}

.stat-box.tier .big-number {
    color: #333;
    font-size: 1.5em;
}

.stat-box .label {
    font-size: 0.9em;
    color: #adb5bd;
    display: block;
    margin-top: 5px;
}

/* Barra de Progreso */
.mecha-progress-container {
    margin-bottom: 40px;
    background: #fff;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
}

.progress-bar-bg {
    background: #e9ecef;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    height: 100%;
    transition: width 0.6s ease;
}

/* Tabla Historial */
.mecha-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
}

.mecha-table th {
    background: #f1f1f1;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.mecha-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

/* Responsive */
@media (max-width: 600px) {
    .mecha-stats-grid {
        grid-template-columns: 1fr;
    }

    .mecha-table th,
    .mecha-table td {
        padding: 8px;
        font-size: 13px;
    }

    .mecha-input-group {
        flex-direction: column;
    }

    .mecha-thankyou-box {
        flex-direction: column;
        text-align: center;
    }
}

/* --- ESTILOS DEL CHECKOUT (Caja de Canje Premium) --- */
.mecha-redeem-box {
    background: #ffffff;
    border: 1px solid #e3d8eb;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 25px;
    box-shadow: 0 2px 12px rgba(107, 21, 150, 0.06);
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.mecha-redeem-box:hover {
    box-shadow: 0 3px 14px rgba(107, 21, 150, 0.1);
}

.mecha-redeem-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #faf5fc 0%, #f3eaf8 100%);
    border-bottom: 1px solid #e3d8eb;
}

.mecha-coin-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(107, 21, 150, 0.25));
}

.mecha-redeem-title {
    flex: 1;
    min-width: 0;
}

.mecha-redeem-title h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.mecha-redeem-subtitle {
    font-size: 12px;
    color: #9b7eab;
    display: block;
    margin-top: 2px;
}

.mecha-balance-badge {
    flex-shrink: 0;
    background: #6b1596;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 6px rgba(107, 21, 150, 0.25);
}

.mecha-input-group {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    align-items: stretch;
}

.mecha-input-group input[type="number"] {
    flex: 1;
    border: 2px solid #e3d8eb;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 14px;
    color: #333;
    background: #fdfaff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.mecha-input-group input[type="number"]::-webkit-inner-spin-button,
.mecha-input-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mecha-input-group input[type="number"]:focus {
    border-color: #6b1596;
    box-shadow: 0 0 0 3px rgba(107, 21, 150, 0.1);
}

.mecha-input-group input[type="number"]::placeholder {
    color: #bbb;
    font-weight: 400;
}

.mecha-btn-apply {
    background: #6b1596 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 11px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.mecha-btn-apply:hover {
    background: #551078 !important;
}

.mecha-btn-apply:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.mecha-btn-remove {
    background: transparent !important;
    color: #e74c3c !important;
    border: 2px solid #e74c3c !important;
    border-radius: 8px !important;
    padding: 11px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    white-space: nowrap;
}

.mecha-btn-remove:hover {
    background: #e74c3c !important;
    color: #fff !important;
}

#mecha_redeem_message {
    padding: 0 20px 16px;
    font-size: 13px;
    font-weight: 500;
}

#mecha_redeem_message:empty {
    display: none;
}

/* --- ESTILOS THANK YOU PAGE (Caja de Ganancia) --- */
.mecha-thankyou-box {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px 25px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.mecha-icon-wrap svg {
    display: block;
    filter: drop-shadow(0px 2px 4px rgba(212, 175, 55, 0.4));
}

/* --- ESTILOS BADGE CAMPAÑA EN LOOP --- */
.title-wrapper {
    position: relative;
    /* Para que el absolute del badge se ancle aquí */
}

.mecha-loop-badge-wrap {
    position: absolute;
    right: 5px;
    top: 5%;
    transform: translateY(-50%);
    z-index: 10;
}

.mecha-loop-badge {
    background: linear-gradient(135deg, #6b1596, #9b3dd6);
    color: #fff;
    width: 26px;
    /* Más pequeño para que no rompa el diseño del título */
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(107, 21, 150, 0.3);
    border: 1.5px solid #fff;
    cursor: help;
    transition: transform 0.2s ease;
}

.mecha-loop-badge:hover {
    transform: scale(1.1);
}

.mecha-loop-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #333;
    color: #fff;
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(10px);
}

.mecha-loop-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 12px;
    border-width: 6px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.mecha-loop-badge:hover .mecha-loop-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}