/* Cosmic Messages Form - Clean & Working */

/* Floating Message Particles */
.cosmic-particle {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(100, 200, 255, 0.4));
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6), 0 0 20px rgba(100, 200, 255, 0.3);
    cursor: pointer;
    z-index: 5000;
    transition: all 0.3s ease;
    animation: particle-pulse 3s ease-in-out infinite;
    pointer-events: auto;
}

/* Make sure particle can contain positioned tooltip */
.cosmic-particle {
    position: fixed !important;
}

@keyframes particle-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.cosmic-particle:hover {
    transform: scale(1.8);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 40px rgba(100, 200, 255, 0.6);
}

/* Cosmic Tooltip - Interstellar Style (Desktop Only) */
.cosmic-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(10, 15, 25, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 6px 14px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 400;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    pointer-events: none !important;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(255, 255, 255, 0.05);
    z-index: 50000;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Tooltip arrow */
.cosmic-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.2);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Subtle dust inside tooltip */
.cosmic-tooltip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 15% 25%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(0.5px 0.5px at 45% 60%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(0.5px 0.5px at 75% 35%, rgba(255, 255, 255, 0.35), transparent),
        radial-gradient(1px 1px at 85% 70%, rgba(255, 255, 255, 0.25), transparent),
        radial-gradient(0.5px 0.5px at 30% 80%, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% 200%;
    animation: tooltip-dust 15s linear infinite;
    opacity: 0.6;
    pointer-events: none;
    border-radius: 3px;
    z-index: -1;
}

@keyframes tooltip-dust {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 200%; }
}

/* Desktop only - show tooltip on hover */
@media (min-width: 769px) {
    .cosmic-particle:hover .cosmic-tooltip {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mobile - hide tooltip completely */
@media (max-width: 768px) {
    .cosmic-tooltip {
        display: none;
    }

    /* Make particles larger and easier to tap on mobile */
    .cosmic-particle {
        width: 18px !important;
        height: 18px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(100, 200, 255, 0.3);
        cursor: pointer !important;
        pointer-events: auto !important;
    }

    .cosmic-particle:active {
        transform: scale(1.5) !important;
        box-shadow: 0 0 25px rgba(255, 255, 255, 1), 0 0 50px rgba(100, 200, 255, 0.8) !important;
    }
}

@media (max-width: 480px) {
    .cosmic-particle {
        width: 20px !important;
        height: 20px !important;
    }
}

/* Submit Button - Bottom Left */
#submit-message-btn-v2 {
    position: fixed;
    bottom: -80px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(200, 100, 20, 0.9), rgba(150, 50, 10, 0.9));
    border: 2px solid rgba(255, 158, 74, 0.7);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2500;
    box-shadow: 0 8px 32px rgba(255, 158, 74, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    touch-action: manipulation;
    opacity: 0;
    transition: bottom 0.4s ease, opacity 0.4s ease;
}

#submit-message-btn-v2.show {
    bottom: 30px;
    opacity: 1;
    pointer-events: auto;
    animation: gentle-bounce 2s ease-in-out infinite;
}

@keyframes gentle-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

#submit-message-btn-v2:hover {
    background: linear-gradient(135deg, rgba(220, 120, 40, 1), rgba(170, 70, 30, 1)) !important;
    border-color: rgba(255, 158, 74, 1) !important;
    transform: translateY(-5px) scale(1.05) !important;
    box-shadow: 0 15px 50px rgba(255, 158, 74, 0.6) !important;
}

#submit-message-btn-v2:active {
    transform: scale(0.95) !important;
}

@media (max-width: 768px) {
    #submit-message-btn-v2 {
        width: 55px !important;
        height: 55px !important;
        font-size: 1.3rem !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(255, 158, 74, 0.3) !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }

    #submit-message-btn-v2.show {
        bottom: 20px !important;
    }

    #submit-message-btn-v2:hover {
        transform: translateY(0) !important;
    }

    #submit-message-btn-v2:active {
        transform: scale(0.95) !important;
        opacity: 0.9 !important;
    }
}

/* Modal Overlay - FIXED: pointer-events none, let children handle clicks */
.cosmos-modal-v2 {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.93);
    z-index: 99999998 !important;
    overflow-y: auto;
    padding: 15px;
    box-sizing: border-box;
}

.cosmos-modal-v2.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Container - MUST have pointer-events auto */
.cosmos-form-container-v2 {
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(5, 10, 25, 0.98), rgba(15, 25, 45, 0.98));
    border: 2px solid rgba(100, 200, 255, 0.6);
    border-radius: 16px;
    padding: 25px 20px;
    position: relative;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.9);
    pointer-events: auto !important;
    z-index: 99999999 !important;
    margin: auto;
}

/* Close Button - MUST be clickable */
.cosmos-close-v2 {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    width: 35px !important;
    height: 35px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    font-size: 1.3rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    z-index: 100000000 !important;
}

.cosmos-close-v2:active {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: rotate(90deg) !important;
}

/* Header */
.cosmos-form-header-v2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #64c8ff;
    text-align: center;
    margin: 0 0 8px 0;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(100, 200, 255, 0.5);
}

.cosmos-form-subtitle-v2 {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin: 0 0 20px 0;
}

/* Form - MUST be interactive */
.cosmos-form-v2 {
    display: block;
    pointer-events: auto !important;
}

.cosmos-field-v2 {
    margin-bottom: 15px;
    pointer-events: auto !important;
}

.cosmos-label-v2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

/* Input Fields - MUST be clickable and typeable */
.cosmos-input-v2,
.cosmos-textarea-v2 {
    width: 100% !important;
    padding: 10px 12px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 2px solid rgba(100, 200, 255, 0.4) !important;
    border-radius: 8px !important;
    color: white !important;
    font-size: 0.95rem !important;
    font-family: 'Georgia', serif !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
}

.cosmos-input-v2::placeholder,
.cosmos-textarea-v2::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.cosmos-input-v2:focus,
.cosmos-textarea-v2:focus {
    outline: none !important;
    border-color: rgba(100, 200, 255, 0.9) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 20px rgba(100, 200, 255, 0.3) !important;
}

.cosmos-textarea-v2 {
    min-height: 100px;
    resize: vertical;
    max-height: 250px;
}

/* Character Counter */
.cosmos-char-count-v2 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
    margin-top: 5px;
}

/* Submit Button - MUST be clickable */
.cosmos-submit-v2 {
    width: 100% !important;
    padding: 12px !important;
    background: linear-gradient(135deg, rgba(20, 100, 200, 0.85), rgba(10, 50, 150, 0.85)) !important;
    border: 2px solid rgba(74, 158, 255, 0.6) !important;
    border-radius: 10px !important;
    color: white !important;
    font-family: 'Orbitron', sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    margin-top: 10px !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.cosmos-submit-v2:active {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 30px rgba(74, 158, 255, 0.5) !important;
}

.cosmos-submit-v2:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Message Display */
.cosmos-message-v2 {
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.cosmos-message-v2.success {
    background: rgba(100, 200, 255, 0.2);
    border: 1px solid rgba(100, 200, 255, 0.5);
    color: #64c8ff;
}

.cosmos-message-v2.error {
    background: rgba(255, 82, 82, 0.2);
    border: 1px solid rgba(255, 82, 82, 0.5);
    color: #ff5252;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #submit-message-btn-v2 {
        width: 55px !important;
        height: 55px !important;
        bottom: 20px !important;
        left: 20px !important;
        font-size: 1.3rem !important;
    }

    .cosmos-modal-v2 {
        padding: 10px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .cosmos-form-container-v2 {
        padding: 20px 15px;
        max-height: 85vh;
        border-radius: 12px;
    }

    .cosmos-form-header-v2 {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }

    .cosmos-form-subtitle-v2 {
        font-size: 0.8rem;
        margin-bottom: 15px;
    }

    .cosmos-field-v2 {
        margin-bottom: 12px;
    }

    .cosmos-label-v2 {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    /* Mobile inputs - 16px to prevent iOS zoom */
    .cosmos-input-v2,
    .cosmos-textarea-v2 {
        font-size: 16px !important;
        padding: 10px 12px !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        user-select: text !important;
        -webkit-user-select: text !important;
    }

    .cosmos-textarea-v2 {
        min-height: 80px;
    }

    .cosmos-close-v2 {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 1.2rem !important;
    }

    .cosmos-form-container-v2 {
        pointer-events: auto !important;
    }

    .cosmos-submit-v2 {
        padding: 12px !important;
        font-size: 0.9rem !important;
        letter-spacing: 1px !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
}

@media (max-width: 480px) {
    .cosmos-form-container-v2 {
        padding: 18px 12px;
    }

    .cosmos-form-header-v2 {
        font-size: 1.2rem;
    }

    .cosmos-form-subtitle-v2 {
        font-size: 0.75rem;
    }
}


/* Message Viewer Modal - Beautiful Cosmic Design (Deep Blue/Teal) */
.cosmos-message-viewer-container {
    max-width: 700px;
    width: 100%;
    background: linear-gradient(135deg, rgba(5, 15, 25, 0.95), rgba(10, 25, 40, 0.95));
    border: 3px solid rgba(0, 150, 200, 0.6);
    border-radius: 25px;
    padding: 50px;
    position: relative;
    box-shadow:
        0 30px 100px rgba(0, 150, 200, 0.4),
        0 0 60px rgba(0, 200, 255, 0.2),
        inset 0 0 80px rgba(0, 150, 200, 0.1);
    pointer-events: auto !important;
    z-index: 99999999 !important;
    overflow: hidden;
    animation: message-viewer-appear 0.4s ease-out;
}

@keyframes message-viewer-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animated starfield background inside message viewer */
.cosmos-message-viewer-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent),
        radial-gradient(1px 1px at 15% 90%, white, transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    opacity: 0.4;
    animation: stars-drift 30s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes stars-drift {
    0%, 100% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
}

.cosmos-message-viewer-container > * {
    position: relative;
    z-index: 1;
}

.cosmos-message-viewer-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    background: linear-gradient(135deg, #00d9ff, #0096c8, #64c8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin: 0 0 15px 0;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 700;
    filter: drop-shadow(0 0 20px rgba(0, 150, 200, 0.6));
    animation: header-glow 3s ease-in-out infinite;
}

@keyframes header-glow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(0, 150, 200, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(0, 150, 200, 0.9));
    }
}

.cosmos-message-viewer-content {
    margin-top: 40px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 150, 200, 0.3);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.cosmos-message-viewer-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #64c8ff;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow:
        0 0 10px rgba(100, 200, 255, 0.8),
        0 0 20px rgba(100, 200, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cosmos-message-viewer-name::before {
    content: '✨';
    font-size: 1.2rem;
    animation: sparkle 2s ease-in-out infinite;
}

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

.cosmos-message-viewer-date {
    font-size: 0.9rem;
    color: rgba(0, 180, 220, 0.9);
    margin-bottom: 25px;
    font-style: italic;
    font-weight: 600;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cosmos-message-viewer-date::before {
    content: '🕐';
    font-size: 0.9rem;
}

.cosmos-message-viewer-text {
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 2;
    padding: 25px;
    background: linear-gradient(135deg, rgba(0, 150, 200, 0.1), rgba(100, 200, 255, 0.1));
    border: 2px solid rgba(100, 200, 255, 0.4);
    border-left: 5px solid rgba(0, 150, 200, 0.8);
    border-radius: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow:
        inset 0 0 30px rgba(0, 150, 200, 0.1),
        0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.cosmos-message-viewer-text::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 5rem;
    color: rgba(0, 150, 200, 0.2);
    font-family: Georgia, serif;
    line-height: 1;
}

.cosmos-message-viewer-text::after {
    content: '"';
    position: absolute;
    bottom: -30px;
    right: 20px;
    font-size: 5rem;
    color: rgba(0, 150, 200, 0.2);
    font-family: Georgia, serif;
    line-height: 1;
}

/* Custom close button for message viewer */
#cosmic-message-viewer .cosmos-close-v2 {
    background: linear-gradient(135deg, rgba(0, 150, 200, 0.3), rgba(100, 200, 255, 0.3)) !important;
    border: 2px solid rgba(0, 150, 200, 0.6) !important;
    box-shadow: 0 0 20px rgba(0, 150, 200, 0.4);
    transition: all 0.3s ease !important;
}

#cosmic-message-viewer .cosmos-close-v2:hover {
    background: linear-gradient(135deg, rgba(0, 150, 200, 0.6), rgba(100, 200, 255, 0.6)) !important;
    box-shadow: 0 0 30px rgba(0, 150, 200, 0.8);
    transform: rotate(90deg) scale(1.1) !important;
}

/* Reply Button */
.cosmos-reply-btn {
    margin-top: 30px;
    width: 100%;
    padding: 15px 25px;
    background: linear-gradient(135deg, rgba(100, 200, 255, 0.2), rgba(0, 150, 200, 0.2));
    border: 2px solid rgba(100, 200, 255, 0.4);
    border-radius: 12px;
    color: #64c8ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    box-shadow: 0 5px 20px rgba(100, 200, 255, 0.3);
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.cosmos-reply-btn:hover {
    background: linear-gradient(135deg, rgba(100, 200, 255, 0.3), rgba(0, 150, 200, 0.3));
    border-color: rgba(100, 200, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(100, 200, 255, 0.5);
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.8);
}

.cosmos-reply-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .cosmos-reply-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .cosmos-reply-btn:hover {
        transform: none;
    }

    .cosmos-reply-btn:active {
        transform: scale(0.98);
    }
}

@media (max-width: 768px) {
    .cosmos-message-viewer-container {
        padding: 35px 25px;
        max-width: 95%;
    }

    .cosmos-message-viewer-header {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .cosmos-message-viewer-content {
        padding: 20px;
    }

    .cosmos-message-viewer-name {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }

    .cosmos-message-viewer-date {
        font-size: 0.8rem;
    }

    .cosmos-message-viewer-text {
        font-size: 1rem;
        padding: 20px;
        line-height: 1.7;
    }

    .cosmos-message-viewer-text::before,
    .cosmos-message-viewer-text::after {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .cosmos-message-viewer-container {
        padding: 25px 20px;
    }

    .cosmos-message-viewer-header {
        font-size: 1.3rem;
        letter-spacing: 1.5px;
    }

    .cosmos-message-viewer-content {
        padding: 15px;
    }

    .cosmos-message-viewer-name {
        font-size: 1.1rem;
    }

    .cosmos-message-viewer-text {
        font-size: 0.95rem;
        padding: 18px;
    }
}
