/* ============================================
   NEXORA IA - EMAIL NOTIFICATION SYSTEM
   ============================================ */

/* Badge de notificación en el header */
.notification-badge {
    position: fixed;
    top: 20px;
    right: 360px; /* Ajustado para no tapar Login y Registrarse */
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.6),
                0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    transform: translateY(-100px) scale(0.5);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification-badge.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.notification-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.8),
                0 6px 25px rgba(0, 0, 0, 0.4);
}

/* Icono del sobre */
.notification-badge svg {
    width: 28px;
    height: 28px;
    stroke: #ffffff;
    stroke-width: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Indicador numérico pulsante */
.notification-count {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0a0a0f;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* Modal overlay para la carta */
.mail-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.mail-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Contenedor de la carta */
.mail-container {
    position: relative;
    width: 90%;
    max-width: 650px;
    transform: scale(0.8) rotateX(20deg);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mail-modal-overlay.active .mail-container {
    transform: scale(1) rotateX(0deg);
    opacity: 1;
}

/* Sobre exterior */
.envelope {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(245, 158, 11, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

/* Detalles del sobre */
.envelope::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, 
                rgba(255, 255, 255, 0.1) 0%,
                transparent 100%);
    pointer-events: none;
}

/* Flap del sobre (tapa) */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform-origin: top center;
    transform: rotateX(0deg);
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 3;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.mail-container.opened .envelope-flap {
    transform: rotateX(-180deg);
}

/* Carta interior */
.letter {
    position: absolute;
    top: 15%;
    left: 5%;
    right: 5%;
    bottom: 5%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16182e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 2.5rem;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s;
    z-index: 2;
    overflow-y: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05),
                0 10px 40px rgba(0, 0, 0, 0.5);
    
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.4) transparent;
}

.letter::-webkit-scrollbar {
    width: 6px;
}

.letter::-webkit-scrollbar-track {
    background: transparent;
}

.letter::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.4);
    border-radius: 10px;
}

.mail-container.opened .letter {
    transform: translateY(0);
}

/* Botón de cerrar */
.mail-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
}

.mail-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.mail-close svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Contenido de la carta */
.letter-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.letter-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.letter-icon svg {
    width: 30px;
    height: 30px;
    stroke: white;
    stroke-width: 2;
}

.letter-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.letter-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Cuerpo del mensaje */
.letter-body {
    color: #e5e5e5;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.letter-body p {
    margin-bottom: 1.2rem;
}

.letter-body strong {
    color: #f59e0b;
    font-weight: 600;
}

.letter-body .highlight {
    display: block;
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* Lista de beneficios */
.benefits-list {
    margin: 1.5rem 0;
    padding-left: 0;
    list-style: none;
}

.benefits-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding-left: 0;
}

.benefits-list li::before {
    content: '→';
    color: #f59e0b;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Stats highlight */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* CTA Section */
.letter-cta {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.cta-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.btn-cotizar {
    display: inline-block;
    padding: 1.2rem 3rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4),
                0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-cotizar:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.6),
                0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Animación de entrada del badge */
@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateX(100px) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateX(-10px) scale(1.1);
    }
    80% {
        transform: translateX(5px) scale(0.95);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .notification-badge {
        right: 280px; /* Ajuste para tablets */
    }
}

@media (max-width: 768px) {
    .notification-badge {
        top: 15px;
        right: 15px; /* En móvil vuelve a la esquina */
        width: 45px;
        height: 45px;
    }
    
    .notification-badge svg {
        width: 24px;
        height: 24px;
    }
    
    .mail-container {
        width: 95%;
    }
    
    .letter {
        padding: 1.5rem;
    }
    
    .letter-title {
        font-size: 1.4rem;
    }
    
    .letter-body {
        font-size: 0.95rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-cotizar {
        padding: 1rem 2rem;
        font-size: 1rem;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .letter-icon {
        width: 50px;
        height: 50px;
    }
    
    .letter-icon svg {
        width: 24px;
        height: 24px;
    }
}