/* ============================================================================
   PRESENCE INTERACTION MODULE
   A warm, elegant way for visitors to show they're here
   ============================================================================ */

.presence-module {
    position: fixed;
    top: 90px; /* Below header */
    left: 20px;
    z-index: 900; /* Below nav (1000) but above content */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items horizontally */
    gap: 10px; /* Balanced spacing between text and icon */
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 240px; /* Allow enough width for text to wrap comfortably */
}

/* Responsive positioning */
@media (max-width: 1100px) {
    .presence-module {
        top: 75px; /* Adjusted for smaller header */
        left: 16px;
    }
}

@media (max-width: 767px) {
    .presence-module {
        top: 70px;
        left: 12px;
    }
}

/* Helper text styling */
.presence-helper-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #FFFFFF;
    text-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.9),
        0 1px 4px rgba(0, 0, 0, 0.8);
    padding: 8px 14px; /* Comfortable padding so text doesn't touch edges */
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(255, 179, 71, 0.3);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(255, 179, 71, 0.2);
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    text-align: center; /* Center text alignment */
    line-height: 1.4; /* Comfortable line spacing for wrapped text */
    max-width: 220px; /* Allow enough width for the full message */
    word-wrap: break-word; /* Allow text to wrap naturally */
    /* Removed: white-space: nowrap, overflow: hidden, text-overflow: ellipsis */
}

@media (max-width: 767px) {
    .presence-helper-text {
        font-size: 0.8125rem;
        padding: 7px 12px;
        max-width: 200px; /* Increased to ensure full text is visible on mobile */
    }
}

/* Tapped state helper text */
.presence-module.tapped .presence-helper-text {
    color: #FFD54A;
    border-color: rgba(255, 213, 74, 0.5);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.7),
        0 0 25px rgba(255, 213, 74, 0.3);
}

/* Button styling */
.presence-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    background: linear-gradient(135deg, #7F4BA3, #4A2B5E);
    border: 2px solid rgba(255, 179, 71, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(127, 75, 163, 0.4);
    position: relative;
    overflow: visible;
}

/* Subtle glow halo */
.presence-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(255, 179, 71, 0.3), transparent 70%);
    border-radius: 50%;
    opacity: 0.6;
    animation: gentlePulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes gentlePulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 0.8;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .presence-button::before {
        animation: none;
        opacity: 0.5;
    }
}

.presence-button:hover {
    background: linear-gradient(135deg, #9B5DC9, #5E3674);
    border-color: rgba(255, 179, 71, 0.7);
    transform: scale(1.08);
    box-shadow: 
        0 6px 24px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(255, 179, 71, 0.5);
}

.presence-button:focus {
    outline: 3px solid #FFD700;
    outline-offset: 3px;
}

.presence-button:active {
    transform: scale(0.95);
}

.presence-button:disabled {
    cursor: default;
    opacity: 0.9;
}

.presence-button:disabled:hover {
    transform: none;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(127, 75, 163, 0.4);
}

/* Icon styling */
.presence-icon {
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767px) {
    .presence-icon {
        font-size: 1.375rem;
    }
}

/* Tapped state - star/sparkle */
.presence-icon.tapped {
    animation: starTwinkle 0.6s ease;
}

@keyframes starTwinkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 8px rgba(255, 213, 74, 0.6));
    }
    25% { 
        transform: scale(1.3) rotate(15deg);
        filter: drop-shadow(0 0 16px rgba(255, 213, 74, 0.9));
    }
    50% { 
        transform: scale(0.9) rotate(-10deg);
        filter: drop-shadow(0 0 12px rgba(255, 213, 74, 0.8));
    }
    75% { 
        transform: scale(1.15) rotate(5deg);
        filter: drop-shadow(0 0 14px rgba(255, 213, 74, 0.85));
    }
}

/* Tapped state button styling */
.presence-module.tapped .presence-button {
    background: linear-gradient(135deg, #FFD54A, #FFB347);
    border-color: rgba(255, 213, 74, 0.6);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 35px rgba(255, 213, 74, 0.5);
}

.presence-module.tapped .presence-button::before {
    background: radial-gradient(circle, rgba(255, 213, 74, 0.4), transparent 70%);
}

/* Confirmation animation */
.presence-module.confirming {
    animation: confirmPop 0.6s ease;
}

@keyframes confirmPop {
    0% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(0.95); }
    75% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .presence-module.confirming {
        animation: none;
    }
    
    .presence-icon.tapped {
        animation: none;
    }
}

/* Accessibility enhancements */
.presence-button:focus-visible {
    outline: 3px solid #FFD700;
    outline-offset: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .presence-helper-text {
        background: rgba(0, 0, 0, 0.95);
        border-width: 2px;
    }
    
    .presence-button {
        border-width: 3px;
    }
}

/* Mobile tap target optimization */
@media (hover: none) and (pointer: coarse) {
    .presence-button {
        min-width: 52px;
        min-height: 52px;
    }
}
