/* ================================================
   ONBOARDING BUBBLE - STYLESHEET
    ================================================ */


/* CSS Custom Properties */
:root {
    --onboarding-max-width: 290px;
    --onboarding-mobile-max-width: 280px;
    --onboarding-radius: 10px;
    --onboarding-btn-height: 44px;
    --onboarding-z-index: 100000; /* Vor Social-Sidebar (99000) */
    --onboarding-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ================================================
   BASE STYLES - Desktop
   ================================================ */

.onboarding-bubble {
    position: fixed;
    right: 110px;
    bottom: 35px;
    width: var(--onboarding-max-width);
    max-width: var(--onboarding-max-width);
    
    /* Premium Glassmorphism Design */
    background: var(--glass-bg, rgba(22, 27, 34, 0.97));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--onboarding-radius);
    padding: 16px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    
    /* Z-Index: VOR Social-Sidebar und anderen Floating-Elementen */
    z-index: var(--onboarding-z-index);
    
    /* Initial hidden state */
    opacity: 0;
    transform: translateX(20px) scale(0.95);
    pointer-events: none;
    visibility: hidden;
    
    /* Smooth animation */
    transition: 
        opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        visibility 0.4s;
    
    /* Performance */
    will-change: opacity, transform;
    -webkit-user-select: none;
    user-select: none;
}

.onboarding-bubble.show {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: all;
    visibility: visible;
}

/* Pfeil zum Chat-Button - Desktop */
.onboarding-bubble::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 14px;
    height: 14px;
    background: var(--glass-bg, rgba(22, 27, 34, 0.97));
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ================================================
   CONTENT STYLES
   ================================================ */

.onboarding-bubble-text {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 16px;
    padding-right: 24px;
    text-align: left;
}

.onboarding-bubble-text strong {
    color: #58a6ff;
    font-weight: 600;
}

/* ================================================
   BUTTONS
   ================================================ */

.onboarding-bubble-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.onboarding-bubble-btn {
    height: var(--onboarding-btn-height);
    min-width: 90px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.onboarding-bubble-btn-primary {
    background: var(--glass-bg, rgba(22, 27, 34, 0.95));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.onboarding-bubble-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Hover - nur für Desktop/Maus */
@media (hover: hover) and (pointer: fine) {
    .onboarding-bubble-btn-primary:hover {
        background: var(--glass-bg, rgba(30, 36, 44, 0.98));
        border-color: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
        box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
    }
    
    .onboarding-bubble-btn-secondary:hover {
        background: rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.9);
    }
    
    .onboarding-bubble-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
}

/* Active States - Touch Feedback */
.onboarding-bubble-btn-primary:active {
    transform: scale(0.97);
    background: var(--glass-bg, rgba(35, 42, 52, 0.98));
}

.onboarding-bubble-btn-secondary:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.15);
}

/* ================================================
   CLOSE BUTTON
   ================================================ */

.onboarding-bubble-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.onboarding-bubble-close:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.15);
}

/* ================================================
   TABLET - Portrait (768px - 1024px)
   ================================================ */

@media (max-width: 1024px) {
    .onboarding-bubble {
        right: 95px;
        max-width: 260px;
    }
}

/* ================================================
   MOBILE - Premium Centered Card Design
   ================================================ */

@media (max-width: 768px) {
    .onboarding-bubble {
        /* Rechts neben Chat-Button positioniert */
        position: fixed;
        left: auto !important;
        right: 15px !important;
        bottom: calc(90px + var(--onboarding-safe-bottom));
        transform: translateY(20px) scale(0.95);
        
        /* Originale Größe beibehalten */
        width: var(--onboarding-mobile-max-width);
        max-width: calc(100vw - 30px);
        
        /* Eckiges Design */
        padding: 14px 16px;
        border-radius: var(--onboarding-radius);
        
        /* Schatten */
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    }
    
    .onboarding-bubble.show {
        transform: translateY(0) scale(1);
    }
    
    /* Pfeil nach unten rechts zum FAB */
    .onboarding-bubble::before {
        left: auto;
        right: 20px;
        top: auto;
        bottom: -7px;
        transform: rotate(-135deg);
        width: 12px;
        height: 12px;
    }
    
    /* Text linksbündig */
    .onboarding-bubble-text {
        text-align: left;
        padding-right: 20px;
        padding-top: 0;
        font-size: 13px;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    
    /* Buttons nebeneinander */
    .onboarding-bubble-actions {
        flex-direction: row;
        gap: 8px;
        margin-top: 0;
        justify-content: flex-end;
    }
    
    .onboarding-bubble-btn {
        width: auto;
        height: 38px;
        font-size: 12px;
        border-radius: 6px;
        padding: 0 12px;
    }
    
    /* Close Button */
    .onboarding-bubble-close {
        width: 28px;
        height: 28px;
        top: 4px;
        right: 4px;
        font-size: 16px;
    }
}

/* ================================================
   SMALL MOBILE (< 480px)
   ================================================ */

@media (max-width: 480px) {
    .onboarding-bubble {
        right: 15px !important;
        left: auto !important;
        max-width: calc(100vw - 30px);
        bottom: calc(85px + var(--onboarding-safe-bottom));
        padding: 18px 20px;
    }
    
    .onboarding-bubble-text {
        font-size: 13px;
    }
    
    .onboarding-bubble-btn {
        height: 44px;
        font-size: 13px;
        padding: 0 14px;
    }
}

/* ================================================
   VERY SMALL MOBILE (iPhone SE, etc.)
   ================================================ */

@media (max-width: 375px) {
    .onboarding-bubble {
        right: 10px !important;
        left: auto !important;
        max-width: calc(100vw - 20px);
        padding: 16px 18px;
        bottom: calc(80px + var(--onboarding-safe-bottom));
    }
    
    .onboarding-bubble-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .onboarding-bubble-btn {
        width: 100%;
    }
}

/* ================================================
   LANDSCAPE MODE
   ================================================ */

@media (max-width: 896px) and (orientation: landscape) {
    .onboarding-bubble {
        /* Rechts positioniert im Landscape */
        left: auto;
        right: 100px;
        bottom: 20px;
        transform: translateX(20px) scale(0.95);
        min-width: 260px;
        max-width: 280px;
    }
    
    .onboarding-bubble.show {
        transform: translateX(0) scale(1);
    }
    
    /* Pfeil zeigt nach rechts */
    .onboarding-bubble::before {
        left: auto;
        right: -7px;
        bottom: auto;
        top: 50%;
        transform: translateY(-50%) rotate(45deg);
    }
    
    .onboarding-bubble-text {
        text-align: left;
        padding-right: 24px;
    }
    
    .onboarding-bubble-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .onboarding-bubble-btn {
        width: auto;
        min-width: 100px;
        height: 42px;
    }
}

/* ================================================
   ACCESSIBILITY
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .onboarding-bubble {
        transition: opacity 0.15s ease;
    }
    
    .onboarding-bubble,
    .onboarding-bubble.show {
        transform: none !important;
    }
    
    .onboarding-bubble-btn:active,
    .onboarding-bubble-close:active {
        transform: none;
    }
}

/* Focus States für Keyboard Navigation */
.onboarding-bubble-btn:focus-visible,
.onboarding-bubble-close:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .onboarding-bubble {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .onboarding-bubble-btn {
        border: 2px solid currentColor;
    }
}
