/* --- RAPPI STYLE OVERLAY --- */
.rappi-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow: hidden;
    /* Importante para la expansión */
}

.rappi-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* --- EFECTO DE EXPANSIÓN (El círculo que crece) --- */
.rappi-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background-color: #00D664;
    /* Rappi Green */
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    /* Empieza invisible */
    transition: transform 1s cubic-bezier(0.65, 0, 0.45, 1);
    z-index: -1;
    /* Detrás del texto */
}

/* Cuando activamos el modo éxito, el círculo crece 50 veces */
.rappi-overlay.success-mode::before {
    transform: translate(-50%, -50%) scale(50);
}

.rappi-content {
    text-align: center;
    width: 90%;
    max-width: 400px;
    padding: 20px;
    position: relative;
    /* Para estar sobre el fondo verde */
}

/* --- LOADING (Pulsing Circle) --- */
.rappi-loader {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #00D664;
    opacity: 0.6;
    margin: 0 auto 30px;
    animation: rappiPulse 1s infinite ease-in-out;
}

@keyframes rappiPulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* --- TEXTOS --- */
.rappi-title {
    font-size: 24px;
    font-weight: 700;
    color: #2D3A4B;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.rappi-subtitle {
    font-size: 16px;
    color: #8C99A9;
    margin-bottom: 30px;
    line-height: 1.5;
    transition: color 0.3s;
}

/* --- CAMBIO A MODO ÉXITO (Textos Blancos) --- */
.rappi-overlay.success-mode .rappi-title,
.rappi-overlay.success-mode .rappi-subtitle {
    color: #ffffff;
}

/* --- SVG DEL CHECK --- */
.rappi-success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
}

.rappi-circle {
    stroke: #00D664;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.rappi-check {
    stroke: #00D664;
    stroke-width: 4;
    fill: none;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    transform-origin: 50% 50%;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.9s forwards;
}

/* Check en modo éxito (Blanco) */
.rappi-overlay.success-mode .rappi-circle,
.rappi-overlay.success-mode .rappi-check {
    stroke: #ffffff;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

/* --- BOTONES --- */
.btn-rappi {
    background-color: #00D664;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px -10px rgba(0, 214, 100, 0.5);
    transition: all 0.2s;
}

/* Botón en modo éxito (Se invierten los colores: fondo blanco, letra verde) */
.rappi-overlay.success-mode .btn-rappi {
    background-color: #ffffff;
    color: #00D664;
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.2);
}

.btn-rappi.error {
    background-color: #FF441F;
    box-shadow: 0 10px 20px -10px rgba(255, 68, 31, 0.5);
}

.hidden {
    display: none;
}