/* ============================================
   WEBCHAT - Diseño Moderno Profesional
   ============================================ */

:root {
    /* Colores Lilac/Morado - Consistente con login */
    --webchat-primary: #6a1b9a;
    --webchat-primary-dark: #4a148c;
    --webchat-primary-light: #9c27b0;
    --webchat-secondary: #8e24aa;
    --webchat-accent: #ab47bc;
    
    /* Fondos y superficies - App móvil */
    --webchat-bg: #f5f5f5;
    --webchat-surface: #ffffff;
    --webchat-surface-dark: #1a1a1a;
    
    /* Textos */
    --webchat-text: #1a1a1a;
    --webchat-text-secondary: #6b7280;
    --webchat-text-muted: #9ca3af;
    
    /* Bordes */
    --webchat-border: #e5e7eb;
    --webchat-border-light: #f3f4f6;
    
    /* Estados */
    --webchat-success: #10b981;
    --webchat-danger: #ef4444;
    --webchat-warning: #f59e0b;
    --webchat-info: #3b82f6;
    
    /* Sombras - App móvil */
    --webchat-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --webchat-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --webchat-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --webchat-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --webchat-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
    --webchat-shadow-lilac: 0 8px 24px rgba(106, 27, 154, 0.3);
    
    /* Bordes redondeados */
    --webchat-radius: 12px;
    --webchat-radius-sm: 8px;
    --webchat-radius-lg: 16px;
    --webchat-radius-xl: 24px;
    
    /* Gradientes */
    --webchat-gradient: linear-gradient(135deg, #6a1b9a 0%, #8e24aa 50%, #ab47bc 100%);
    
    /* Animación timing */
    --webchat-transition-fast: 0.15s;
    --webchat-transition-normal: 0.3s;
    --webchat-transition-slow: 0.5s;
    --webchat-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   ANIMACIONES GLOBALES
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

* {
    box-sizing: border-box;
}

body.webchat {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--webchat-bg);
    color: var(--webchat-text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    overflow-x: hidden;
}

.webchat-shell {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: var(--webchat-bg);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px var(--webchat-border) inset;
}

/* ============================================
   HEADER
   ============================================ */

.webchat-header {
    background: #ffffff;
    border-bottom: 1px solid var(--webchat-border);
    padding: env(safe-area-inset-top, 0) 16px 12px;
    padding-top: max(env(safe-area-inset-top, 0), 12px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s var(--webchat-ease);
    animation: fadeIn 0.4s var(--webchat-ease);
}

.webchat-header-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.webchat-user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.webchat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--webchat-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(106, 27, 154, 0.3), 0 2px 8px rgba(106, 27, 154, 0.15);
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.webchat-avatar::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(106, 27, 154, 0.4), rgba(171, 71, 188, 0.4));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.webchat-avatar:hover::before {
    opacity: 1;
}

.webchat-user-info {
    flex: 1;
    min-width: 0;
}

.webchat-user-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--webchat-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--webchat-text) 0%, var(--webchat-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.webchat-user-details {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--webchat-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.webchat-separator {
    color: var(--webchat-text-muted);
}

.webchat-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    width: 100%;
    justify-content: flex-end;
}

.webchat-logout-form {
    margin: 0;
    padding: 0;
    display: contents;
}

.webchat-icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(245, 245, 250, 1) 0%, rgba(240, 240, 245, 1) 100%);
    color: var(--webchat-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.webchat-icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: var(--webchat-gradient);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.webchat-icon-btn svg {
    position: relative;
    z-index: 1;
    transition: all 0.25s ease;
}

.webchat-icon-btn:hover {
    background: linear-gradient(135deg, rgba(106, 27, 154, 0.1) 0%, rgba(142, 36, 170, 0.08) 100%);
    color: var(--webchat-primary);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.webchat-icon-btn:hover::before {
    opacity: 0.05;
}

.webchat-icon-btn:active {
    transform: scale(0.95);
    background: rgba(106, 27, 154, 0.15);
    box-shadow: 0 2px 6px rgba(106, 27, 154, 0.2), inset 0 2px 4px rgba(106, 27, 154, 0.1);
}

/* Botón de acción del header con texto */
.webchat-header-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(245, 245, 250, 1) 0%, rgba(240, 240, 245, 1) 100%);
    color: var(--webchat-text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
    min-height: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.webchat-header-action-btn svg {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.25s ease;
    width: 16px;
    height: 16px;
}

.webchat-header-action-btn span {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.webchat-header-action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: var(--webchat-gradient);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.webchat-header-action-btn:hover {
    background: linear-gradient(135deg, rgba(106, 27, 154, 0.1) 0%, rgba(142, 36, 170, 0.08) 100%);
    color: var(--webchat-primary);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.webchat-header-action-btn:hover::before {
    opacity: 0.05;
}

.webchat-header-action-btn:active {
    transform: scale(0.95);
    background: rgba(106, 27, 154, 0.15);
    box-shadow: 0 2px 6px rgba(106, 27, 154, 0.2), inset 0 2px 4px rgba(106, 27, 154, 0.1);
}

.webchat-notifications-btn {
    position: relative;
}

.webchat-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    border: 2px solid var(--webchat-surface);
    line-height: 1;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Stats Grid */
.webchat-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.webchat-stat-card {
    background: #ffffff;
    border: 1px solid var(--webchat-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s var(--webchat-ease);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: scaleIn 0.4s var(--webchat-ease) backwards;
}

.webchat-stat-card:nth-child(1) {
    animation-delay: 0.05s;
}

.webchat-stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.webchat-stat-card:nth-child(3) {
    animation-delay: 0.15s;
}

.webchat-stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--webchat-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.webchat-stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--webchat-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.webchat-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(106, 27, 154, 0.3);
    box-shadow: 0 8px 20px rgba(106, 27, 154, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.webchat-stat-card:hover::before {
    opacity: 0.03;
}

.webchat-stat-card:hover::after {
    opacity: 1;
}

.webchat-stat-card:active {
    transform: scale(0.97);
    border-color: var(--webchat-primary);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.2);
}

.webchat-stat-card:active::after {
    opacity: 1;
}

.webchat-stat-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    position: relative;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.webchat-stat-card:hover .webchat-stat-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(106, 27, 154, 0.3));
}

.webchat-stat-content {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 2;
}

.webchat-stat-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--webchat-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
    transition: color 0.3s ease;
}

.webchat-stat-card:hover .webchat-stat-label {
    color: var(--webchat-primary);
}

.webchat-stat-value {
    display: block;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--webchat-text) 0%, var(--webchat-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -0.6px;
}

/* Quick Actions */
.webchat-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.webchat-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.webchat-action-btn svg {
    flex-shrink: 0;
}

.webchat-action-primary {
    background: var(--webchat-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
}

.webchat-action-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.25);
}

.webchat-action-primary.copied {
    background: linear-gradient(135deg, var(--webchat-success), #059669);
}

.webchat-action-secondary {
    background: #ffffff;
    color: var(--webchat-text);
    border: 1px solid var(--webchat-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.webchat-action-secondary:active {
    transform: scale(0.98);
    background: var(--webchat-bg);
    border-color: var(--webchat-primary);
}

.webchat-referral-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(106, 27, 154, 0.12), rgba(142, 36, 170, 0.1));
    border: 1px solid rgba(106, 27, 154, 0.2);
    border-radius: 16px;
    margin-bottom: 12px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(106, 27, 154, 0.12);
    transition: all 0.3s ease;
}

.webchat-referral-banner:hover {
    box-shadow: 0 8px 24px rgba(106, 27, 154, 0.2);
    transform: translateY(-2px);
}

.webchat-referral-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--webchat-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(106, 27, 154, 0.35);
    flex-shrink: 0;
}

.webchat-referral-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.webchat-referral-copy h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--webchat-text);
    line-height: 1.3;
}

.webchat-referral-copy span {
    font-size: 0.9rem;
    color: var(--webchat-text-secondary);
    line-height: 1.4;
}

.webchat-referral-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    color: var(--webchat-text-muted);
    margin: 0;
    font-weight: 700;
}

.webchat-referral-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #6a1b9a 0%, #8e24aa 100%);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
    flex-shrink: 0;
}

.webchat-referral-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(106, 27, 154, 0.4);
    background: linear-gradient(135deg, #7c3aed 0%, #9c27b0 100%);
}

.webchat-referral-cta:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.25);
}

.webchat-referral-cta svg {
    transition: transform 0.3s ease;
}

.webchat-referral-cta:hover svg {
    transform: translateX(4px);
}

/* Responsive para móviles */
@media (max-width: 480px) {
    .webchat-referral-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 16px;
    }
    
    .webchat-referral-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    
    .webchat-referral-copy {
        width: 100%;
    }
    
    .webchat-referral-copy h2 {
        font-size: 1.05rem;
    }
    
    .webchat-referral-copy span {
        font-size: 0.85rem;
    }
    
    .webchat-referral-label {
        font-size: 0.7rem;
    }
    
    .webchat-referral-cta {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 0.9rem;
    }
}

/* ============================================
   BIRTHDAY BANNER
   ============================================ */

.webchat-birthday-banner {
    position: relative;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border-radius: 14px;
    padding: 0;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.25);
}

/* Solo en desktop: cuando hay dos beneficios, mostrarlos lado a lado */
@media (min-width: 769px) {
    /* Cambiar el contenedor a flexbox cuando hay ambos banners */
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referred-benefit-banner) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 20px !important;
    }
    
    /* Ambos banners ocupan 50% menos el gap */
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referred-benefit-banner) .webchat-birthday-banner,
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referred-benefit-banner) .webchat-referred-benefit-banner {
        flex: 0 0 calc(50% - 10px) !important;
        margin-bottom: 0 !important;
    }
}

.webchat-birthday-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    opacity: 0.6;
    animation: patternFloat 20s ease-in-out infinite;
}

.webchat-birthday-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    flex-wrap: wrap;
    z-index: 1;
}


.webchat-birthday-icon-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webchat-birthday-icon {
    font-size: 44px;
    line-height: 1;
    animation: birthdayBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.webchat-birthday-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.webchat-birthday-sparkles .sparkle {
    position: absolute;
    font-size: 18px;
    opacity: 0;
    animation: sparkleFloat 3s ease-in-out infinite;
}

.webchat-birthday-sparkles .sparkle-1 {
    top: -8px;
    right: -8px;
    animation-delay: 0s;
}

.webchat-birthday-sparkles .sparkle-2 {
    bottom: -8px;
    left: -8px;
    animation-delay: 1s;
}

.webchat-birthday-sparkles .sparkle-3 {
    top: 50%;
    right: -12px;
    animation-delay: 2s;
}

.webchat-birthday-text {
    flex: 1;
    min-width: 200px;
}

/* Ajustes cuando está en el grid */
.webchat-benefits-grid .webchat-birthday-text {
    min-width: 0;
    width: 100%;
}

.webchat-birthday-label {
    margin: 0 0 4px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.webchat-birthday-name {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.webchat-birthday-reward-title {
    margin: 0 0 4px;
    color: rgba(255, 255, 255, 0.98);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.webchat-birthday-reward-desc {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.webchat-birthday-reward-value {
    margin: 8px 0 0;
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 6px 14px;
}

.webchat-birthday-reward-value span {
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.2px;
}

/* Badge de caducidad en la parte superior del banner */
.webchat-birthday-expiry-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.webchat-birthday-expiry-badge svg {
    flex-shrink: 0;
    animation: clockTick 2s ease-in-out infinite;
}

.webchat-birthday-expiry-badge span {
    white-space: nowrap;
    letter-spacing: 0.2px;
}

@keyframes clockTick {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

/* Responsive para móviles */
@media (max-width: 480px) {
    .webchat-birthday-expiry-badge {
        top: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .webchat-birthday-expiry-badge svg {
        width: 12px;
        height: 12px;
    }
}

.webchat-birthday-message {
    margin: 0;
    color: rgba(255, 255, 255, 0.98);
    font-size: 16px;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.webchat-birthday-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: #e91e63;
    padding: 14px 26px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
}

.webchat-birthday-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(233, 30, 99, 0.1), transparent);
    transition: left 0.5s;
}

.webchat-birthday-cta:hover::before,
.webchat-birthday-cta:active::before {
    left: 100%;
}

.webchat-birthday-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.webchat-birthday-cta:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.webchat-birthday-cta svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.webchat-birthday-cta:hover svg {
    transform: translateX(4px);
}

/* ============================================
   REFERRED BENEFIT BANNER
   ============================================ */

.webchat-referred-benefit-banner {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #8b5cf6 100%);
    border-radius: 20px;
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(118, 75, 162, 0.35), 0 4px 16px rgba(118, 75, 162, 0.2);
    animation: referredBenefitGlow 3s ease-in-out infinite;
}

/* Cuando está dentro del grid, quitar el margin-bottom */
.webchat-benefits-grid .webchat-referred-benefit-banner {
    margin-bottom: 0;
}

.webchat-referred-benefit-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    opacity: 0.6;
    animation: patternFloat 20s ease-in-out infinite;
}

.webchat-referred-benefit-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    flex-wrap: wrap;
    z-index: 1;
}

/* Ajustes cuando está en el grid */
.webchat-benefits-grid .webchat-referred-benefit-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

@media (min-width: 768px) {
    .webchat-benefits-grid .webchat-referred-benefit-content {
        flex-direction: row;
        align-items: center;
    }
}

.webchat-referred-benefit-icon-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webchat-referred-benefit-icon {
    font-size: 52px;
    line-height: 1;
    animation: referredBenefitBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.webchat-referred-benefit-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.webchat-referred-benefit-sparkles .sparkle {
    position: absolute;
    font-size: 18px;
    opacity: 0;
    animation: sparkleFloat 3s ease-in-out infinite;
}

.webchat-referred-benefit-sparkles .sparkle-1 {
    top: -8px;
    right: -8px;
    animation-delay: 0s;
}

.webchat-referred-benefit-sparkles .sparkle-2 {
    bottom: -8px;
    left: -8px;
    animation-delay: 1s;
}

.webchat-referred-benefit-sparkles .sparkle-3 {
    top: 50%;
    right: -12px;
    animation-delay: 2s;
}

.webchat-referred-benefit-text {
    flex: 1;
    min-width: 200px;
}

/* Ajustes cuando está en el grid */
.webchat-benefits-grid .webchat-referred-benefit-text {
    min-width: 0;
    width: 100%;
}

.webchat-referred-benefit-label {
    margin: 0 0 6px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.webchat-referred-benefit-name {
    margin: 0 0 10px;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.webchat-referred-benefit-reward-title {
    margin: 0 0 6px;
    color: rgba(255, 255, 255, 0.98);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.webchat-referred-benefit-reward-desc {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.webchat-referred-benefit-reward-value {
    margin: 12px 0 0;
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 8px 16px;
}

.webchat-referred-benefit-reward-value span {
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.2px;
}

.webchat-referred-benefit-expiry {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 6px 14px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 600;
}

.webchat-referred-benefit-expiry svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.webchat-referred-benefit-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: #764ba2;
    padding: 14px 26px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
}


.webchat-referred-benefit-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(118, 75, 162, 0.1), transparent);
    transition: left 0.5s;
}

.webchat-referred-benefit-cta:hover::before,
.webchat-referred-benefit-cta:active::before {
    left: 100%;
}

.webchat-referred-benefit-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.webchat-referred-benefit-cta:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.webchat-referred-benefit-cta svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.webchat-referred-benefit-cta:hover svg {
    transform: translateX(4px);
}

@keyframes referredBenefitGlow {
    0%, 100% {
        box-shadow: 0 12px 32px rgba(118, 75, 162, 0.35), 0 4px 16px rgba(118, 75, 162, 0.2);
    }
    50% {
        box-shadow: 0 16px 40px rgba(118, 75, 162, 0.45), 0 6px 20px rgba(118, 75, 162, 0.3);
    }
}

@keyframes referredBenefitBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(-5deg);
    }
    75% {
        transform: translateY(-8px) rotate(5deg);
    }
}

/* Animations */
@keyframes birthdayGlow {
    0%, 100% {
        box-shadow: 0 12px 32px rgba(233, 30, 99, 0.35), 0 4px 16px rgba(233, 30, 99, 0.2);
    }
    50% {
        box-shadow: 0 16px 40px rgba(233, 30, 99, 0.45), 0 6px 20px rgba(233, 30, 99, 0.3);
    }
}

@keyframes birthdayBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(-5deg);
    }
    75% {
        transform: translateY(-8px) rotate(5deg);
    }
}

@keyframes sparkleFloat {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

@keyframes patternFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(10px, -10px) scale(1.05);
    }
    66% {
        transform: translate(-10px, 10px) scale(0.95);
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .webchat-birthday-content {
        padding: 16px;
        gap: 14px;
    }
    
    .webchat-birthday-icon-wrapper {
        width: 56px;
        height: 56px;
    }
    
    .webchat-birthday-icon {
        font-size: 40px;
    }
    
    .webchat-birthday-name {
        font-size: 18px;
    }
    
    .webchat-birthday-cta {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }
}

/* ============================================
   TOAST NOTIFICATIONS - NOTIFICACIONES EN TIEMPO REAL
   ============================================ */

.webchat-toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--webchat-surface);
    border: 1px solid var(--webchat-border);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 380px;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

.webchat-toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.webchat-toast-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--webchat-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--webchat-border);
}

.webchat-toast-content {
    flex: 1;
    min-width: 0;
}

.webchat-toast-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--webchat-text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.webchat-toast-message {
    font-size: 13px;
    color: var(--webchat-text-secondary);
    margin: 0;
    line-height: 1.4;
}

.webchat-toast-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--webchat-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.webchat-toast-close:hover {
    background: var(--webchat-bg);
    color: var(--webchat-text);
}

/* Animación de pulso para badges y iconos */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Contenedor de alertas de cuenta */
.webchat-account-alerts-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.webchat-main {
    flex: 1;
    padding: 10px 12px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.webchat-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Cards */
.webchat-card {
    background: #ffffff;
    border: 1px solid var(--webchat-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s var(--webchat-ease);
    position: relative;
    overflow: visible;
    animation: fadeInUp 0.5s var(--webchat-ease) backwards;
}

.webchat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.webchat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.webchat-card:nth-child(4) {
    animation-delay: 0.3s;
}

.webchat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--webchat-gradient);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 18px 18px 0 0;
}

.webchat-card:active {
    transform: scale(0.99);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-color: var(--webchat-primary);
}

.webchat-card:active::before {
    opacity: 1;
}

.webchat-card-header {
    margin-bottom: 14px;
}

/* Ocultar el header del card de membresías en desktop */
@media (min-width: 769px) {
    .webchat-memberships-section .webchat-card-header {
        display: none;
    }
    
    .webchat-memberships-section .webchat-card {
        padding-top: 24px;
    }
}

.webchat-card-title-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.webchat-card-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s ease;
}

.webchat-card:hover .webchat-card-icon {
    transform: scale(1.05);
}

.webchat-card-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--webchat-text) 0%, var(--webchat-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.webchat-card-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--webchat-text-secondary);
    line-height: 1.4;
    font-weight: 500;
}

/* Benefits Grid */
.webchat-benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.webchat-benefit {
    background: var(--webchat-bg);
    border: 1px solid var(--webchat-border);
    border-radius: var(--webchat-radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

.webchat-benefit:hover {
    border-color: var(--webchat-primary-light);
    box-shadow: var(--webchat-shadow-sm);
}

.webchat-benefit.unlocked {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.04));
    border-color: var(--webchat-success);
}

.webchat-benefit.claimed {
    background: var(--webchat-bg);
    border-color: var(--webchat-border);
    opacity: 0.7;
}

.webchat-benefit strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--webchat-text);
    line-height: 1.3;
}

.webchat-benefit span {
    font-size: 12px;
    color: var(--webchat-text-secondary);
    line-height: 1.4;
}

.webchat-benefit small {
    font-size: 11px;
    color: var(--webchat-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.webchat-benefit button {
    margin-top: 4px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: var(--webchat-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.webchat-benefit button:hover {
    background: var(--webchat-primary-dark);
    transform: translateY(-1px);
}

/* Account Items */
.webchat-account-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.webchat-account-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
    transition: all 0.3s var(--webchat-ease);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.5s var(--webchat-ease) backwards;
    width: 100%;
    box-sizing: border-box;
}

.webchat-account-item:nth-child(1) {
    animation-delay: 0.1s;
}

.webchat-account-item:nth-child(2) {
    animation-delay: 0.2s;
}

.webchat-account-item:nth-child(3) {
    animation-delay: 0.3s;
}

.webchat-account-item:nth-child(4) {
    animation-delay: 0.4s;
}

.webchat-account-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.webchat-account-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--webchat-gradient);
    border-radius: 16px 0 0 16px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

/* Estados de vencimiento - Colores más sutiles */
.webchat-account-item.expiry-safe::before {
    background: #10b981;
    opacity: 0.6;
}

.webchat-account-item.expiry-safe {
    border-color: rgba(16, 185, 129, 0.2);
}

.webchat-account-item.expiry-warning::before {
    background: #fbbf24;
    opacity: 0.6;
}

.webchat-account-item.expiry-warning {
    border-color: rgba(251, 191, 36, 0.2);
}

.webchat-account-item.expiry-urgent::before {
    background: #f97316;
    opacity: 0.7;
}

.webchat-account-item.expiry-urgent {
    border-color: rgba(249, 115, 22, 0.25);
}

.webchat-account-item.expiry-critical::before {
    background: #ef4444;
    opacity: 0.8;
}

.webchat-account-item.expiry-critical {
    border-color: rgba(239, 68, 68, 0.3);
    border-left-width: 4px;
}

.webchat-account-item.expiry-expired::before {
    background: #6b7280;
    opacity: 0.5;
}

.webchat-account-item.expiry-expired {
    border-color: rgba(107, 114, 128, 0.2);
    opacity: 0.85;
}

@keyframes criticalPulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3), 0 2px 6px rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 8px 28px rgba(239, 68, 68, 0.4), 0 4px 10px rgba(239, 68, 68, 0.3);
    }
}

@keyframes criticalGlow {
    0%, 100% {
        box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
    }
    50% {
        box-shadow: 0 0 24px rgba(239, 68, 68, 0.8);
    }
}

.webchat-account-item:active {
    border-color: var(--webchat-primary);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.15);
    transform: scale(0.99);
}

.webchat-account-item:active::before {
    opacity: 1;
}

.webchat-account-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.webchat-account-item-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--webchat-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.webchat-account-item:hover .webchat-account-item-header::after {
    width: 120px;
}

.webchat-account-item-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--webchat-text);
    flex: 1;
    min-width: 0;
    letter-spacing: -0.3px;
}

.webchat-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.webchat-badge-combo {
    background: linear-gradient(135deg, rgba(106, 27, 154, 0.2), rgba(142, 36, 170, 0.15));
    color: var(--webchat-primary-dark);
    border: 1.5px solid rgba(106, 27, 154, 0.3);
}

.webchat-badge-combo:hover {
    background: linear-gradient(135deg, rgba(106, 27, 154, 0.25), rgba(142, 36, 170, 0.2));
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(106, 27, 154, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.webchat-badge-individual {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.15));
    color: #065f46;
    border: 1.5px solid rgba(16, 185, 129, 0.3);
}

.webchat-badge-individual:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.2));
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.webchat-badge-status {
    background: rgba(59, 130, 246, 0.1);
    color: var(--webchat-info);
}

.webchat-account-item-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 16px;
}

.webchat-account-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
    transition: none;
    position: relative;
}

.webchat-account-field:last-child {
    border-bottom: none;
}

.webchat-account-field:hover {
    background: transparent;
    border-color: #e5e7eb;
}

.webchat-account-field:active {
    background: #e5e7eb;
    border-color: var(--webchat-primary);
    transform: scale(0.98);
}

.webchat-account-field label {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.webchat-account-field label::before {
    display: none;
}

/* Campo de vencimiento con estilos especiales */
/* Campo de vencimiento sin grid-column */
.webchat-account-field.expiry-field {
    position: relative;
}

@keyframes criticalDotPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Valor de vencimiento con badge */
.webchat-account-value.expiry-value {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.expiry-date {
    font-weight: 600;
    color: var(--webchat-text);
}

.expiry-days-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.expiry-days-badge svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.expiry-badge-safe {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.1));
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.expiry-badge-warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.15));
    color: #92400e;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

.expiry-badge-urgent {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.15));
    color: #9a3412;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.expiry-badge-critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.2));
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.expiry-badge-expired {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.2), rgba(75, 85, 99, 0.15));
    color: #374151;
    border: 1px solid rgba(107, 114, 128, 0.4);
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 3px 12px rgba(239, 68, 68, 0.4);
    }
}

.webchat-account-value {
    font-size: 15px;
    font-weight: 500;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
    word-break: break-word;
    min-height: 24px;
    padding: 0;
    background: none;
    border: none;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    letter-spacing: 0.3px;
}

.webchat-account-value-highlight {
    color: var(--webchat-success);
    font-weight: 600;
}

/* Estilos para campos de contraseña */
.webchat-account-field.password-field .webchat-account-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 16px;
    letter-spacing: 2px;
}

/* Alertas de eventos mejoradas */
.webchat-account-alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideDown 0.3s ease-out;
}

.webchat-account-alert:not(.seen) {
    background: rgba(245, 158, 11, 0.25);
    border-left-color: #f59e0b;
    color: #78350f;
    font-weight: 700;
}

.webchat-account-alert.seen {
    background: rgba(16, 185, 129, 0.25);
    border-left-color: #10b981;
    color: #065f46;
    font-weight: 700;
}

.webchat-account-alert svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

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

/* Mejora para valores vacíos */
.webchat-account-value:empty::before,
.webchat-account-value:has-text("—") {
    color: var(--webchat-text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Campo especial para correo y contraseña */
.webchat-account-field.email-field,
.webchat-account-field.password-field {
    background: #f9fafb;
    border-color: var(--webchat-border);
}

.webchat-account-field.email-field:active,
.webchat-account-field.password-field:active {
    background: #e5e7eb;
    border-color: var(--webchat-primary);
}

/* Botón toggle password */
.webchat-toggle-password-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(106, 27, 154, 0.08);
    color: var(--webchat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.webchat-toggle-password-btn svg {
    width: 16px;
    height: 16px;
}

.webchat-toggle-password-btn:active {
    background: var(--webchat-primary);
    color: #ffffff;
    transform: scale(0.92);
}

.webchat-account-value .password-text {
    flex: 1;
    min-width: 0;
    word-break: break-all;
}

.webchat-copy-field-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(106, 27, 154, 0.08);
    color: var(--webchat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    margin-left: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.webchat-copy-field-btn svg {
    width: 16px;
    height: 16px;
}

.webchat-copy-field-btn:active {
    background: var(--webchat-primary);
    color: #ffffff;
    transform: scale(0.92);
}

.webchat-copy-field-btn.copied {
    background: var(--webchat-success);
    color: #ffffff;
}

.webchat-copy-field-btn.copied svg {
    transform: scale(1.1);
}

.webchat-account-item-actions {
    display: flex;
    gap: 12px;
    padding-top: 18px;
    border-top: 2px solid var(--webchat-border-light);
}

.webchat-account-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    white-space: nowrap;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.webchat-account-action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.webchat-account-action-btn svg {
    flex-shrink: 0;
}

.webchat-account-action-primary {
    background: var(--webchat-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.25);
}

.webchat-account-action-primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.2);
}

.webchat-account-action-secondary {
    background: var(--webchat-surface);
    color: var(--webchat-text);
    border: 1.5px solid var(--webchat-border);
}

.webchat-account-action-secondary:active {
    transform: scale(0.96);
    background: var(--webchat-bg);
    border-color: var(--webchat-primary);
}

/* Alert List */
.webchat-alert-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.webchat-alert-item {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--webchat-radius);
    padding: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.webchat-alert-item strong {
    display: block;
    font-weight: 700;
    color: var(--webchat-warning);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.webchat-alert-item span,
.webchat-alert-item small {
    display: block;
    color: var(--webchat-text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

/* Empty State */
.webchat-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--webchat-text-muted);
    font-size: 14px;
    border: 2px dashed var(--webchat-border);
    border-radius: var(--webchat-radius);
    background: var(--webchat-bg);
}

/* ============================================
   TABBAR
   ============================================ */

.webchat-tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-top: 1px solid var(--webchat-border);
    padding: 6px 2px max(6px, env(safe-area-inset-bottom));
    display: flex;
    gap: 1px;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    min-height: 64px;
    max-height: 72px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.webchat-tabbar a,
.webchat-tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--webchat-text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px;
    max-height: 60px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.webchat-tabbar a:active,
.webchat-tabbar button:active {
    transform: scale(0.95);
    background: rgba(106, 27, 154, 0.08);
}

.webchat-tabbar a.active {
    color: var(--webchat-primary);
    background: rgba(106, 27, 154, 0.1);
}

.webchat-tab-icon-wrapper {
    position: relative;
    display: inline-block;
    line-height: 1;
}

.webchat-tab-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s ease;
    display: block;
    width: 20px;
    height: 20px;
}

.webchat-tabbar a.active .webchat-tab-icon,
.webchat-tabbar button.active .webchat-tab-icon {
    transform: scale(1.1);
}

/* Botón de modo oscuro en tabbar - usa los mismos estilos que los demás items */
.webchat-tabbar button.webchat-dark-mode-toggle,
.webchat-tabbar button.webchat-tab-link-dark-mode,
.webchat-tabbar a.webchat-dark-mode-menu-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--webchat-text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px;
    max-height: 60px;
    font-family: inherit;
    width: auto;
    text-decoration: none;
}

.webchat-tabbar button.webchat-dark-mode-toggle:active,
.webchat-tabbar button.webchat-tab-link-dark-mode:active,
.webchat-tabbar a.webchat-dark-mode-menu-item:active {
    transform: scale(0.95);
    background: rgba(106, 27, 154, 0.08);
}

.webchat-tabbar button.webchat-dark-mode-toggle .webchat-tab-icon,
.webchat-tabbar button.webchat-tab-link-dark-mode .webchat-tab-icon,
.webchat-tabbar a.webchat-dark-mode-menu-item .webchat-tab-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
    font-size: 20px;
    line-height: 1;
}

.webchat-tabbar button.webchat-dark-mode-toggle .webchat-tab-icon svg,
.webchat-tabbar button.webchat-tab-link-dark-mode .webchat-tab-icon svg,
.webchat-tabbar a.webchat-dark-mode-menu-item .webchat-tab-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

body.webchat-dark-mode .webchat-tabbar button.webchat-dark-mode-toggle,
body.webchat-dark-mode .webchat-tabbar button.webchat-tab-link-dark-mode,
body.webchat-dark-mode .webchat-tabbar a.webchat-dark-mode-menu-item {
    color: var(--webchat-dark-text-secondary, #9090a0);
}

body.webchat-dark-mode .webchat-tabbar button.webchat-dark-mode-toggle:active,
body.webchat-dark-mode .webchat-tabbar button.webchat-tab-link-dark-mode:active,
body.webchat-dark-mode .webchat-tabbar a.webchat-dark-mode-menu-item:active {
    background: rgba(139, 92, 246, 0.15);
}

/* ============================================
   SIDEBAR - Menu Lateral (Desktop)
   ============================================ */

.webchat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    border-right: 1px solid var(--webchat-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header del sidebar con info de usuario */
.webchat-sidebar-header {
    padding: 28px 20px;
    border-bottom: 1px solid var(--webchat-border);
    flex-shrink: 0;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.webchat-sidebar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.webchat-sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.webchat-sidebar-user-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--webchat-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.webchat-sidebar-user-details {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--webchat-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.webchat-sidebar-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.webchat-sidebar-action-btn {
    flex: 1;
    padding: 11px 12px;
    border: 1px solid var(--webchat-border);
    border-radius: 11px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--webchat-text-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.webchat-sidebar-action-btn svg {
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.webchat-sidebar-action-btn span {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.webchat-sidebar-action-btn:hover {
    background: rgba(106, 27, 154, 0.08);
    border-color: var(--webchat-primary);
    color: var(--webchat-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(106, 27, 154, 0.15);
}

.webchat-sidebar-action-btn:hover svg {
    transform: scale(1.1);
}

.webchat-sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.webchat-sidebar-logout-btn span {
    font-size: 13px;
    font-weight: 600;
}

/* Stats compactos en sidebar */
.webchat-sidebar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
    flex-shrink: 0;
}

.webchat-sidebar-stat {
    text-align: center;
    padding: 12px 8px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 11px;
    border: 1px solid var(--webchat-border);
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.webchat-sidebar-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(106, 27, 154, 0.12);
    border-color: rgba(106, 27, 154, 0.3);
}

.webchat-sidebar-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--webchat-primary);
    line-height: 1;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.webchat-sidebar-stat-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--webchat-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navegación del sidebar */
.webchat-sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(106, 27, 154, 0.3) transparent;
}

.webchat-sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.webchat-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.webchat-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(106, 27, 154, 0.3);
    border-radius: 3px;
}

.webchat-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(106, 27, 154, 0.5);
}

.webchat-sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: var(--webchat-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-right: 3px solid transparent;
    position: relative;
    border-radius: 0 12px 12px 0;
    margin-right: 8px;
}

.webchat-sidebar-nav-item:hover {
    background: rgba(106, 27, 154, 0.08);
    color: var(--webchat-primary);
    transform: translateX(2px);
}

.webchat-sidebar-nav-item:hover .webchat-sidebar-nav-icon svg {
    transform: scale(1.1);
}

.webchat-sidebar-nav-item.active {
    background: linear-gradient(90deg, rgba(106, 27, 154, 0.12) 0%, rgba(106, 27, 154, 0.06) 100%);
    color: var(--webchat-primary);
    border-right-color: var(--webchat-primary);
    font-weight: 700;
}

.webchat-sidebar-nav-item.active .webchat-sidebar-nav-icon svg {
    stroke-width: 2.5;
}

.webchat-sidebar-nav-icon {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.webchat-sidebar-nav-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    transition: all 0.2s ease;
}

.webchat-nav-badge {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: #ef4444;
    color: #ffffff;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.webchat-sidebar-nav-item {
    position: relative;
}

/* Botones de acción en sidebar (solo desktop) */
.webchat-sidebar-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding: 0;
    flex-shrink: 0;
}

.webchat-sidebar-btn {
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.webchat-sidebar-btn-primary {
    background: var(--webchat-gradient);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
}

.webchat-sidebar-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 27, 154, 0.45);
    filter: brightness(1.05);
}

.webchat-sidebar-btn-primary svg {
    transition: transform 0.25s ease;
}

.webchat-sidebar-btn-primary:hover svg {
    transform: scale(1.1);
}

.webchat-sidebar-btn-secondary {
    background: #f9fafb;
    color: var(--webchat-text);
    border: 1px solid var(--webchat-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.webchat-sidebar-btn-secondary:hover {
    background: rgba(106, 27, 154, 0.08);
    border-color: var(--webchat-primary);
    color: var(--webchat-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(106, 27, 154, 0.15);
}

.webchat-sidebar-btn-secondary svg {
    transition: transform 0.25s ease;
}

.webchat-sidebar-btn-secondary:hover svg {
    transform: scale(1.1);
}

.webchat-sidebar-chat-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    padding: 0 6px;
}

/* Footer del sidebar con botón de modo oscuro */
.webchat-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--webchat-border);
    margin-top: auto;
    flex-shrink: 0;
    background: #ffffff;
}

.webchat-sidebar-dark-mode-toggle {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--webchat-border);
    border-radius: 11px;
    background: #ffffff;
    color: var(--webchat-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.webchat-sidebar-dark-mode-toggle:hover {
    background: rgba(106, 27, 154, 0.08);
    border-color: var(--webchat-primary);
    color: var(--webchat-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(106, 27, 154, 0.15);
}

.webchat-sidebar-dark-mode-toggle:hover svg {
    transform: rotate(15deg) scale(1.1);
}

.webchat-sidebar-dark-mode-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    position: relative;
}

.webchat-sidebar-dark-mode-icon-wrapper .sun-icon,
.webchat-sidebar-dark-mode-icon-wrapper .moon-icon {
    position: absolute;
    width: 18px;
    height: 18px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.webchat-sidebar-dark-mode-icon-wrapper .moon-icon {
    display: none;
}

body.webchat-dark-mode .webchat-sidebar-dark-mode-icon-wrapper .sun-icon {
    display: none;
}

body.webchat-dark-mode .webchat-sidebar-dark-mode-icon-wrapper .moon-icon {
    display: block;
}

.webchat-sidebar-dark-mode-toggle svg {
    transition: all 0.3s ease;
}

/* Ocultar botones sidebar en mobile */
@media (max-width: 768px) {
    .webchat-sidebar-quick-actions {
        display: none;
    }
    
    .webchat-sidebar-footer {
        display: none;
    }
}

/* Avatar Toggle para Mobile */
.webchat-avatar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    background: var(--webchat-gradient);
    border: none;
    border-radius: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.webchat-avatar-toggle-inner {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.webchat-avatar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(106, 27, 154, 0.5);
}

.webchat-avatar-toggle:active {
    transform: scale(0.95);
}

/* Ocultar hamburguesa antigua */
.webchat-sidebar-toggle {
    display: none !important;
}

.webchat-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.webchat-sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Mobile: sidebar completamente oculto */
@media (max-width: 768px) {
    .webchat-sidebar {
        display: none !important;
    }
    
    .webchat-sidebar-overlay {
        display: none !important;
    }
    
    .webchat-avatar-toggle {
        display: none !important;
    }
    
    /* OCULTAR top section en mobile - info ya está en header */
    .webchat-top-section {
        display: none !important;
    }
    
    /* OCULTAR botones quick-actions en mobile - están en tabbar */
    .webchat-quick-actions {
        display: none !important;
    }
    
    /* Header sin espacio para avatar toggle */
    .webchat-header {
        padding-left: 16px;
        padding-right: 16px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    /* Mejorar spacing mobile tipo app nativa - más compacto */
    .webchat-middle-section {
        gap: 10px;
        margin-bottom: 12px;
        padding: 0;
    }
    
    .webchat-memberships-section {
        margin-top: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .webchat-memberships-section .webchat-card {
        width: 100%;
        border-radius: 14px;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .webchat-account-item {
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .webchat-main {
        padding-top: 8px;
        padding-bottom: 80px; /* Espacio para tabbar */
        padding-left: 12px;
        padding-right: 12px;
        box-sizing: border-box;
    }
    
    /* Tabbar responsive para diferentes tamaños móviles */
    .webchat-tabbar {
        gap: 1px;
        padding: 4px 2px max(4px, env(safe-area-inset-bottom));
    }
    
    .webchat-tabbar a,
    .webchat-tabbar button {
        padding: 4px 1px;
        font-size: 9px;
        min-height: 50px;
        max-height: 58px;
    }
    
    .webchat-tab-icon {
        font-size: 18px;
    }
    
    /* En pantallas muy pequeñas (menos de 360px) */
    @media (max-width: 360px) {
        .webchat-tabbar {
            gap: 0;
            padding: 3px 1px max(3px, env(safe-area-inset-bottom));
        }
        
        .webchat-tabbar a,
        .webchat-tabbar button {
            padding: 3px 0;
            font-size: 8px;
            min-height: 48px;
            max-height: 56px;
        }
        
        .webchat-tab-icon {
            font-size: 16px;
        }
    }
    
    /* En pantallas medianas móviles (375px - 414px) */
    @media (min-width: 375px) and (max-width: 414px) {
        .webchat-tabbar {
            gap: 2px;
            padding: 5px 3px max(5px, env(safe-area-inset-bottom));
        }
        
        .webchat-tabbar a,
        .webchat-tabbar button {
            padding: 5px 2px;
            font-size: 10px;
        }
    }
    
    /* Botones más grandes y táctiles en mobile */
    .webchat-action-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 12px;
        font-weight: 600;
    }
    
    /* Cards con espaciado optimizado */
    .webchat-card {
        padding: 16px;
        border-radius: 14px;
        margin-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    /* Stats cards optimizadas */
    .webchat-stat-card {
        padding: 12px;
        border-radius: 12px;
    }
    
    /* Mejor contraste y espaciado en mobile */
    .webchat-user-name {
        font-size: 18px;
        font-weight: 700;
        margin-bottom: 2px;
    }
    
    .webchat-user-details {
        font-size: 13px;
    }
    
    /* Header actions más táctiles */
    .webchat-icon-btn {
        min-width: 44px;
        min-height: 44px;
        border-radius: 12px;
    }
    
    /* Ajustar botones del header con texto en mobile */
    .webchat-header-action-btn {
        padding: 10px 14px;
        font-size: 13px;
        gap: 6px;
        min-height: 42px;
    }
    
    .webchat-header-action-btn svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .webchat-header-action-btn span {
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* Ajustar acciones del header en mobile - organizadas debajo */
    .webchat-header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .webchat-user-section {
        width: 100%;
    }
    
    .webchat-header-actions {
        gap: 8px;
        flex-wrap: nowrap;
        width: 100%;
        justify-content: space-between;
    }
    
    .webchat-header-action-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
        max-width: calc(50% - 4px);
    }
    
    /* Profile mobile optimizado */
    .webchat-profile-main {
        padding: 14px;
    }
    
    .webchat-profile-content .webchat-card {
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 16px;
    }
}

/* Layout Sections - Nueva Estructura */
.webchat-top-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.webchat-middle-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.webchat-memberships-section {
    display: block;
    width: 100%;
}

.webchat-memberships-section .webchat-card {
    width: 100%;
    margin-bottom: 0;
}

/* Account list como grid horizontal */
.webchat-account-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* Desktop: shell con margen para sidebar */
@media (min-width: 769px) {
    /* Sidebar responsive - se achica cuando la pantalla se reduce */
    .webchat-sidebar {
        width: 280px;
        transition: width 0.3s ease;
    }
    
    .webchat-shell {
        margin-left: 280px;
        width: calc(100% - 280px);
        max-width: none;
        box-shadow: none;
        transition: margin-left 0.3s ease, width 0.3s ease;
        position: relative;
        overflow-x: hidden;
    }
    
    /* Cuando la pantalla es más pequeña (769px - 1023px), hacer sidebar más estrecho */
    @media (max-width: 1023px) {
        .webchat-sidebar {
            width: 260px;
        }
        
        .webchat-shell {
            margin-left: 260px;
            width: calc(100% - 260px);
            max-width: none;
        }
        
        /* Ajustar padding y tamaños en sidebar más estrecho */
        .webchat-sidebar-header {
            padding: 20px 16px;
        }
        
        .webchat-sidebar-user-name {
            font-size: 15px;
        }
        
        .webchat-sidebar-user-details {
            font-size: 11px;
        }
        
        .webchat-sidebar-action-btn {
            padding: 8px;
            font-size: 11px;
        }
        
        .webchat-sidebar-action-btn span {
            font-size: 11px;
        }
        
        .webchat-sidebar-nav-item {
            padding: 12px 16px;
            font-size: 13px;
        }
        
        .webchat-sidebar-btn {
            font-size: 12px;
            padding: 10px 14px;
        }
        
        .webchat-sidebar-footer {
            padding: 14px 16px;
        }
        
        .webchat-sidebar-dark-mode-toggle {
            padding: 10px 14px;
            font-size: 12px;
        }
    }
    
    /* En pantallas muy pequeñas de desktop (769px - 900px), hacer sidebar aún más compacto */
    @media (max-width: 900px) {
        .webchat-sidebar {
            width: 240px;
        }
        
        .webchat-shell {
            margin-left: 240px;
            width: calc(100% - 240px);
            max-width: none;
        }
        
        .webchat-sidebar-header {
            padding: 18px 14px;
        }
        
        .webchat-sidebar-user-name {
            font-size: 14px;
        }
        
        .webchat-sidebar-user-details {
            font-size: 10px;
        }
        
        .webchat-sidebar-stat-value {
            font-size: 16px;
        }
        
        .webchat-sidebar-stat-label {
            font-size: 8px;
        }
        
        .webchat-sidebar-nav-item {
            padding: 10px 14px;
            font-size: 12px;
        }
        
        .webchat-sidebar-btn {
            font-size: 11px;
            padding: 9px 12px;
        }
    }
    
    /* Ocultar header y tabbar originales en desktop */
    .webchat-header {
        display: none !important;
    }
    
    .webchat-tabbar {
        display: none !important;
    }
    
    /* OCULTAR sección superior en desktop (ya está en sidebar) */
    .webchat-top-section {
        display: none !important;
    }
    
    /* Main con estructura profesional y organizada */
    .webchat-main {
        padding: 48px 56px;
        padding-bottom: 100px;
        width: 100%;
        max-width: 100%;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 40px;
        background: var(--webchat-bg);
        box-sizing: border-box;
    }
    
    /* Sección media - banners organizados profesionalmente */
    .webchat-middle-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        margin-bottom: 0;
        width: 100%;
        padding: 0;
    }
    
    /* Birthday banner y referred benefit banner */
    .webchat-birthday-banner,
    .webchat-referred-benefit-banner {
        grid-column: auto;
        margin-bottom: 0;
        min-height: 180px;
    }
    
    /* Referral banner */
    .webchat-referral-banner {
        grid-column: 1 / -1;
        margin-bottom: 0;
        width: 100%;
    }
    
    /* Cuando hay ambos banners, distribuir en 2 columnas */
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referred-benefit-banner) {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }
    
    /* Cuando hay referral banner también, reorganizar layout */
    .webchat-middle-section:has(.webchat-referral-banner) {
        grid-template-columns: 1fr 1fr;
    }
    
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referral-banner):not(:has(.webchat-referred-benefit-banner)) {
        grid-template-columns: 1fr 1fr;
    }
    
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referred-benefit-banner):has(.webchat-referral-banner) {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    
    .webchat-middle-section:has(.webchat-birthday-banner):has(.webchat-referred-benefit-banner):has(.webchat-referral-banner) .webchat-referral-banner {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    /* Memberships section - diseño profesional */
    .webchat-memberships-section {
        display: block;
        width: 100%;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    .webchat-memberships-section .webchat-card {
        width: 100%;
        max-width: 100%;
        padding: 36px;
        background: #ffffff;
        border: 1px solid var(--webchat-border);
        border-radius: 24px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
        box-sizing: border-box;
        margin-bottom: 0;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .webchat-memberships-section .webchat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
    
    /* Memberships list en grid organizado profesionalmente */
    .webchat-account-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
        width: 100%;
        padding: 0;
    }
    
    /* Cards generales mejoradas y profesionales */
    .webchat-card {
        padding: 36px;
        border-radius: 24px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
        margin-bottom: 0;
        border: 1px solid var(--webchat-border);
        background: #ffffff;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .webchat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
    
    .webchat-card-title {
        font-size: 26px;
        margin-bottom: 24px;
        font-weight: 700;
        color: var(--webchat-text);
        letter-spacing: -0.5px;
        line-height: 1.2;
    }
    
    /* Account items mejorados profesionalmente */
    .webchat-account-item {
        padding: 32px;
        border-radius: 20px;
        margin-bottom: 0;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        border: 1px solid var(--webchat-border);
        background: #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }
    
    .webchat-account-item:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(106, 27, 154, 0.15);
        border-color: rgba(106, 27, 154, 0.3);
    }
    
    /* Banners mejorados y profesionales */
    .webchat-birthday-banner,
    .webchat-referred-benefit-banner {
        border-radius: 24px;
        overflow: hidden;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .webchat-birthday-banner:hover,
    .webchat-referred-benefit-banner:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.12);
    }
    
    .webchat-referral-banner {
        border-radius: 24px;
        overflow: hidden;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        box-shadow: 0 6px 24px rgba(106, 27, 154, 0.15);
        padding: 24px;
    }
    
    .webchat-referral-banner:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 32px rgba(106, 27, 154, 0.25);
    }
    
    /* Mejorar contenido de banners en desktop */
    .webchat-birthday-content,
    .webchat-referred-benefit-content {
        padding: 24px 28px;
    }
    
    .webchat-birthday-icon-wrapper {
        width: 72px;
        height: 72px;
    }
    
    .webchat-birthday-icon {
        font-size: 52px;
    }
    
    .webchat-birthday-name {
        font-size: 24px;
    }
    
    .webchat-referral-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .webchat-referral-copy h2 {
        font-size: 18px;
    }
    
    .webchat-referral-copy span {
        font-size: 14px;
    }
    
    /* Mejor organización de secciones */
    .webchat-section {
        margin-bottom: 0;
    }
    
    /* Espaciado profesional entre secciones */
    .webchat-main > *:not(:last-child) {
        margin-bottom: 0;
    }
    
    /* Mejoras para pantallas grandes */
    @media (min-width: 1400px) {
        .webchat-main {
            padding: 48px 64px;
            padding-bottom: 100px;
            max-width: 1600px;
            margin: 0 auto;
        }
        
        .webchat-account-list {
            grid-template-columns: repeat(3, 1fr);
            gap: 32px;
        }
        
        .webchat-middle-section {
            gap: 32px;
        }
    }
    
    /* Cards con mejor diseño profesional */
    .webchat-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .webchat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }
}

@media (min-width: 1024px) {
    /* Main container profesional */
    .webchat-main {
        max-width: 1600px;
        padding: 40px 60px;
        padding-bottom: 80px;
    }
    
    /* Middle section con mejor espaciado */
    .webchat-middle-section {
        gap: 28px;
        grid-template-columns: 1fr 1fr;
    }
    
    /* Grid 2 columnas para accounts en desktop medio */
    .webchat-account-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }
    
    /* Cards con más espacio */
    .webchat-card {
        padding: 32px;
    }
    
    .webchat-memberships-section .webchat-card {
        padding: 32px;
    }
    
    .webchat-account-item {
        padding: 28px;
    }
}

@media (min-width: 1400px) {
    /* Main container optimizado para pantallas grandes */
    .webchat-main {
        max-width: 1800px;
        padding: 48px 80px;
        padding-bottom: 100px;
    }
    
    /* 3 columnas en pantallas muy grandes para accounts */
    .webchat-account-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }
    
    /* Middle section puede usar 3 columnas si hay espacio */
    .webchat-middle-section {
        gap: 32px;
    }
    
    /* Cards más espaciosas en pantallas grandes */
    .webchat-card {
        padding: 36px;
    }
    
    .webchat-memberships-section .webchat-card {
        padding: 36px;
    }
}

/* ============================================
   PROFILE PAGE - Desktop Layout
   ============================================ */

@media (min-width: 769px) {
    /* Main de profile ocupa todo */
    .webchat-main.webchat-profile-main {
        max-width: 100% !important;
        width: 100%;
        padding: 32px 48px !important;
    }
    
    /* Section de profile en grid 2 columnas */
    .webchat-section.webchat-profile-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        max-width: 1600px;
        margin: 0 auto;
    }
    
    .webchat-profile-info-card,
    .webchat-profile-password-card {
        height: 100%;
        margin-bottom: 0;
    }
}

@media (min-width: 1024px) {
    .webchat-main.webchat-profile-main {
        padding: 40px 60px !important;
    }
    
    .webchat-section.webchat-profile-content {
        gap: 40px;
        max-width: 1800px;
    }
}

/* ============================================
   CHAT PAGE - Desktop Layout
   ============================================ */

@media (min-width: 769px) {
    /* Chat main aprovecha todo */
    .webchat-chat-main {
        max-width: 100%;
        padding: 32px 48px;
    }
    
    /* Ocultar header original en desktop */
    .webchat-chat-header {
        display: none;
    }
    
    /* Chats en grid 2 columnas */
    .webchat-chats-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        max-width: 1600px;
        margin: 0 auto;
    }
    
    .webchat-active-chats {
        grid-column: 1;
    }
    
    .webchat-closed-chats {
        grid-column: 2;
    }
}

@media (min-width: 1024px) {
    .webchat-chat-main {
        padding: 40px 60px;
    }
    
    .webchat-chats-wrapper {
        gap: 40px;
        max-width: 1800px;
    }
}

/* Asegurar que section no tenga conflictos */
.webchat-section.webchat-profile-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Asegurar que todas las cards sean visibles */
.webchat-profile-content .webchat-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (min-width: 769px) {
    /* Profile section en GRID 2 columnas */
    section.webchat-section.webchat-profile-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-auto-flow: column !important;
        gap: 32px !important;
        align-items: start;
        max-width: 1600px;
        margin: 0 auto;
    }
    
    /* Asegurar visibilidad y posicionamiento de ambas cards */
    .webchat-profile-content .webchat-profile-info-card {
        grid-column: 1 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }
    
    .webchat-profile-content .webchat-profile-password-card {
        grid-column: 2 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }

    /* Refuerzo de grid para cualquier sección de profile */
    .webchat-profile-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 32px !important;
        align-items: start;
    }
}

/* ============================================
   FOOTER
   ============================================ */

.webchat-footer {
    text-align: center;
    padding: 16px 20px;
    font-size: 12px;
    color: var(--webchat-text-muted);
    border-top: 1px solid var(--webchat-border);
    background: var(--webchat-surface);
}

/* ============================================
   AUTH PAGES
   ============================================ */

.webchat-auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.webchat-card {
    max-width: 420px;
}

.webchat-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.webchat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--webchat-text);
}

.webchat-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--webchat-border);
    border-radius: var(--webchat-radius);
    font-size: 15px;
    font-family: inherit;
    background: var(--webchat-surface);
    color: var(--webchat-text);
    transition: all 0.2s ease;
}

.webchat-input:focus {
    outline: none;
    border-color: var(--webchat-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.webchat-button {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--webchat-radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.webchat-button-primary {
    background: linear-gradient(135deg, var(--webchat-primary), var(--webchat-primary-dark));
    color: #ffffff;
    box-shadow: var(--webchat-shadow);
}

.webchat-button-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--webchat-shadow-md);
}

.webchat-button-primary:active {
    transform: translateY(0);
}

.webchat-button-secondary {
    background: var(--webchat-surface);
    color: var(--webchat-text);
    border: 1px solid var(--webchat-border);
}

.webchat-button-secondary:hover {
    background: var(--webchat-bg);
}

.webchat-alert {
    padding: 12px 16px;
    border-radius: var(--webchat-radius);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.webchat-alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--webchat-success);
}

.webchat-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--webchat-danger);
}

.webchat-alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--webchat-info);
}

.webchat-link {
    color: var(--webchat-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.webchat-link:hover {
    color: var(--webchat-primary-dark);
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
    .webchat-header {
        padding: 12px 16px 16px;
        padding-top: max(env(safe-area-inset-top, 0), 16px);
    }

    .webchat-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
        border-radius: 14px;
    }

    .webchat-user-name {
        font-size: 17px;
    }

    .webchat-user-details {
        font-size: 12px;
    }

    .webchat-icon-btn {
        width: 40px;
        height: 40px;
    }
    
    /* Botones del header con texto en mobile */
    .webchat-header-action-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px;
        gap: 6px;
    }
    
    .webchat-header-action-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .webchat-header-action-btn span {
        font-size: 12px;
    }
    
    /* Ajustar acciones del header en mobile */
    .webchat-header-actions {
        gap: 6px;
        flex-wrap: wrap;
    }

    .webchat-main {
        padding: 12px;
        padding-bottom: 80px;
    }

    .webchat-card {
        padding: 14px;
        border-radius: 14px;
    }

    .webchat-card-title {
        font-size: 17px;
    }

    .webchat-card-subtitle {
        font-size: 12px;
    }

    .webchat-stats-grid {
        gap: 8px;
    }

    .webchat-stat-card {
        padding: 10px;
        border-radius: 12px;
    }

    .webchat-stat-icon {
        font-size: 20px;
    }

    .webchat-stat-label {
        font-size: 9px;
    }

    .webchat-stat-value {
        font-size: 16px;
    }

    .webchat-quick-actions {
        flex-direction: column;
    }

    .webchat-action-btn {
        width: 100%;
    }

    .webchat-account-item {
        padding: 16px;
        border-radius: 16px;
    }

    .webchat-account-item-title {
        font-size: 17px;
    }

    .webchat-account-item-body {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .webchat-account-field {
        padding: 10px;
    }
    
    /* En mobile, vence no necesita grid-column full */
    .webchat-account-field.expiry-field {
        grid-column: auto;
    }

    .webchat-account-item-actions {
        flex-direction: column;
    }

    .webchat-account-action-btn {
        width: 100%;
        padding: 12px;
    }

    .webchat-badge {
        padding: 5px 10px;
        font-size: 10px;
    }

    .webchat-benefits-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .webchat-notifications-panel {
        max-width: 100%;
    }
}

/* Responsive enhancements */
@media (min-width: 481px) {
    .webchat-shell {
        box-shadow: 0 0 0 1px var(--webchat-border);
    }
    
    .webchat-account-item:hover {
        transform: translateY(-3px);
    }
}

/* Este media query se movió arriba para evitar conflictos - ver @media (min-width: 769px) */

@media (min-width: 1024px) {
    /* Layout mejorado y profesional para desktop grande */
    .webchat-main {
        max-width: 1600px;
        padding: 40px 60px;
        padding-bottom: 80px;
    }
    
    /* Middle section con mejor distribución */
    .webchat-middle-section {
        gap: 28px;
    }
    
    /* Grid de accounts mejorado */
    .webchat-account-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }
    
    /* Cards más espaciosas */
    .webchat-card {
        padding: 32px;
    }
    
    .webchat-memberships-section .webchat-card {
        padding: 32px;
    }
    
    .webchat-account-item {
        padding: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   NOTIFICATIONS PANEL
   ============================================ */

.webchat-notifications-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.webchat-notifications-overlay.active {
    opacity: 1;
    visibility: visible;
}

.webchat-notifications-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--webchat-surface);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.webchat-notifications-panel.active {
    right: 0;
}

.webchat-notifications-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--webchat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--webchat-surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.webchat-notifications-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--webchat-text);
}

.webchat-notifications-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--webchat-radius);
    background: var(--webchat-bg);
    color: var(--webchat-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.webchat-notifications-close:hover {
    background: var(--webchat-border);
    color: var(--webchat-text);
}

.webchat-notifications-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.webchat-notifications-list {
    display: flex;
    flex-direction: column;
}

.webchat-notification-item {
    display: flex;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--webchat-border);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: var(--webchat-surface);
}

.webchat-notification-item:hover {
    background: var(--webchat-bg);
}

/* Notificaciones NO VISTAS - diseño más destacado */
.webchat-notification-item.unread {
    background: rgba(106, 27, 154, 0.08);
    border-left: 5px solid var(--webchat-primary);
    padding-left: 17px;
    font-weight: 500;
}

.webchat-notification-item.unread:hover {
    background: rgba(106, 27, 154, 0.12);
}

/* Notificaciones VISTAS - diseño más sutil */
.webchat-notification-item:not(.unread) {
    background: var(--webchat-surface);
    opacity: 0.75;
    border-left: 1px solid var(--webchat-border);
}

.webchat-notification-item:not(.unread):hover {
    background: var(--webchat-bg);
    opacity: 1;
}

.webchat-notification-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--webchat-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--webchat-primary);
    flex-shrink: 0;
    border: 1.5px solid var(--webchat-border);
}

.webchat-notification-item.unread .webchat-notification-icon {
    background: rgba(106, 27, 154, 0.15);
    border-color: var(--webchat-primary);
    border-width: 2px;
    color: var(--webchat-primary);
}

/* Iconos para notificaciones vistas - más sutiles */
.webchat-notification-item:not(.unread) .webchat-notification-icon {
    background: var(--webchat-bg);
    border-color: var(--webchat-border);
    opacity: 0.7;
}

.webchat-notification-body {
    flex: 1;
    min-width: 0;
    position: relative;
}

.webchat-notification-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--webchat-text);
    margin-bottom: 6px;
    line-height: 1.4;
}

/* Títulos más destacados para notificaciones no vistas */
.webchat-notification-item.unread .webchat-notification-title {
    font-weight: 700;
    color: var(--webchat-text);
}

/* Títulos más sutiles para notificaciones vistas */
.webchat-notification-item:not(.unread) .webchat-notification-title {
    font-weight: 500;
    color: var(--webchat-text-secondary);
}

.webchat-notification-time {
    font-size: 12px;
    color: var(--webchat-text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.webchat-notification-details {
    font-size: 13px;
    color: var(--webchat-text-secondary);
    line-height: 1.5;
    margin-top: 6px;
}

.webchat-notification-description {
    font-size: 13px;
    color: var(--webchat-text-secondary);
    line-height: 1.5;
    margin-top: 8px;
    word-wrap: break-word;
}

.webchat-notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--webchat-primary);
    box-shadow: 0 0 0 2px var(--webchat-surface);
}

.webchat-notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--webchat-text-muted);
}

.webchat-notifications-empty svg {
    color: var(--webchat-text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.webchat-notifications-empty p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.webchat-notifications-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--webchat-text-muted);
    font-size: 14px;
}

.webchat-notifications-error {
    padding: 40px 20px;
    text-align: center;
    color: #ef4444;
    font-size: 14px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin: 20px;
}

/* Modal de permisos de notificaciones */
.webchat-notification-permission-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.webchat-notification-permission-content {
    background: var(--webchat-surface);
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.webchat-notification-permission-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #6f42c1 0%, #9333ea 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.webchat-notification-permission-content h3 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--webchat-text);
}

.webchat-notification-permission-content p {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--webchat-text-secondary);
}

.webchat-notification-permission-actions {
    display: flex;
    gap: 12px;
}

.webchat-notification-permission-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.webchat-notification-permission-deny {
    background: var(--webchat-bg);
    color: var(--webchat-text-secondary);
    border: 1px solid var(--webchat-border);
}

.webchat-notification-permission-deny:hover {
    background: var(--webchat-border);
}

.webchat-notification-permission-allow {
    background: linear-gradient(135deg, #6f42c1 0%, #9333ea 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

.webchat-notification-permission-allow:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.webchat-dashboard {
    background: var(--webchat-bg);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background: rgba(99, 102, 241, 0.2);
    color: var(--webchat-text);
}

/* Profile Section Styles */
.webchat-profile-section {
    margin-top: 8px;
}

.webchat-profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.webchat-form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--webchat-text-muted);
    font-style: italic;
}

.webchat-tab-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--webchat-radius);
    text-decoration: none;
    color: var(--webchat-text-muted);
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
}

.webchat-tab-link:hover {
    background: var(--webchat-bg);
    color: var(--webchat-text);
}

.webchat-tab-link.active {
    color: var(--webchat-primary);
    background: rgba(99, 102, 241, 0.08);
}

.webchat-tab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    padding: 0;
    border: 2px solid var(--webchat-surface, #ffffff);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    z-index: 10;
    line-height: 1;
    min-width: 18px;
    flex-shrink: 0;
}

/* Si el número es mayor a 9, hacer la bolita un poco más grande pero mantenerla circular */
.webchat-tab-badge:not([data-count="1"]):not([data-count="2"]):not([data-count="3"]):not([data-count="4"]):not([data-count="5"]):not([data-count="6"]):not([data-count="7"]):not([data-count="8"]):not([data-count="9"]) {
    width: 20px;
    height: 20px;
    min-width: 20px;
    font-size: 9px;
    padding: 0 2px;
    border-radius: 10px;
}

/* ============================================
   MODAL DE DETALLES DE EVENTO
   ============================================ */

.webchat-event-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.webchat-event-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.webchat-event-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.webchat-event-modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 24px;
    padding: 0;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.webchat-event-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.2);
}

.webchat-event-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.webchat-event-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.webchat-event-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.webchat-event-modal-close:active {
    transform: scale(0.95);
}

.webchat-event-modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
    color: #ffffff;
}

/* Ocultar modal en móvil */
@media (max-width: 768px) {
    .webchat-event-modal {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .webchat-event-modal.active {
        display: none !important;
    }
}
