/*
 * wisнblower - WishToKnow Component CSS
 * Canvas, UI, Question-Input, Answer-Display, WTK-spezifische Styles
 */

/* ===== WTK BODY OVERRIDES ===== */
/* Higher specificity than base.css without !important */
body.wtk-page {
    background: black;
    overflow: hidden;
    margin: 0;
    padding: 0;
    height: 100vh;
    color: white;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    -webkit-user-select: none;
    user-select: none;
    line-height: 1.6;
}

/* ===== WTK CANVAS ===== */
#canvas {
    position: absolute;
    top: 0;
    left: 0;
    background: radial-gradient(circle, #001122, #000011);
    width: 100%;
    height: 100%;
}

/* ===== WTK UI CONTAINER ===== */
.ui {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    width: 100%;
    max-width: 270px;
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 1000px;
    pointer-events: none;
}

/* ===== WTK QUESTION INPUT ===== */
.question-input {
    width: 100%;
    max-width: 270px;
    min-height: 40px;
    max-height: 120px;
    padding: 15px;
    background: rgba(0,0,0,0.8);
    border: 2px solid transparent;
    border-radius: 25px;
    color: #00CCFF;
    font-size: 1rem;
    text-align: center;
    outline: none;
    margin-bottom: 15px;
    resize: none;
    overflow-y: hidden;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    pointer-events: auto;
    z-index: 20;
}

.question-input:focus {
    border-color: #00CCFF;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.5);
}

.question-input::placeholder {
    color: rgba(0, 204, 255, 0.6);
}

.question-input.scrollable {
    overflow-y: auto;
}

.question-input.gathering {
    pointer-events: none;
    animation: border-build 0.1s ease-out forwards;
}

/* Increased specificity: body.wtk-page prefix ensures this overrides base styles */
body.wtk-page .question-input.plasma-ready {
    border-color: #FF00FF;
    box-shadow: 0 0 30px rgba(255,0,255,0.8);
    animation: plasma-pulse 1s infinite;
}

@keyframes border-build {
    from { border-color: transparent; }
    to { border-color: #00CCFF; }
}

@keyframes plasma-pulse {
    0%, 100% { 
        box-shadow: 0 0 30px rgba(255,0,255,0.8);
        border-color: #FF00FF;
    }
    50% { 
        box-shadow: 0 0 50px rgba(255,0,255,1);
        border-color: #FF44FF;
    }
}

/* ===== WTK INSTRUCTIONS ===== */
.instructions {
    color: rgba(0,204,255,0.7);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: auto;
    margin-top: 10px;
}

.instructions.visible {
    opacity: 1;
}

/* ===== WTK ANSWER DISPLAY ===== */
.answer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 300;
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease, transform 0.3s ease;
    z-index: 5;
    text-align: center;
    width: 80%;
    max-width: 600px;
    padding: 30px;
    border-radius: 20px;
    text-shadow:
        0 0 8px rgba(255,255,255,0.9),
        0 0 20px rgba(0,221,255,0.7),
        0 0 40px rgba(100,255,255,0.3);
    animation: ethereal-float 4s ease-in-out infinite;
}

@keyframes ethereal-float {
    0%, 100% { 
        transform: translate(-50%, -50%) translateY(0px);
    }
    50% { 
        transform: translate(-50%, -50%) translateY(-8px);
    }
}

body.wtk-page .answer.materializing {
    opacity: 1;
    pointer-events: none;
    animation: 
        ethereal-float 4s ease-in-out infinite,
        text-glow-animation 3s ease-in-out infinite;
}

@keyframes text-glow-animation {
    0%, 100% { 
        text-shadow: 
            0 0 8px rgba(255,255,255,0.9),
            0 0 20px rgba(0,221,255,0.7),
            0 0 40px rgba(100,255,255,0.3);
    }
    50% { 
        text-shadow: 
            0 0 12px rgba(255,255,255,1),
            0 0 25px rgba(0,221,255,0.9),
            0 0 50px rgba(100,255,255,0.4);
    }
}

/* ===== WTK SOUND TOGGLE ===== */
.sound-toggle {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50px);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    color: white;
    font-size: 1.4rem;
    text-align: center;
}

.sound-toggle:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: rgba(0, 255, 255, 0.5);
    transform: translateY(-50px) scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.sound-toggle:focus {
    outline: 3px solid #00CCFF;
    outline-offset: 2px;
}

.sound-toggle.muted {
    opacity: 0.5;
}

.sound-toggle.disabled {
    color: #666;
    border-color: #666;
}

.sound-toggle.disabled:hover {
    background: rgba(102,102,102,0.2);
    border-color: #888;
    color: #888;
    transform: translateY(-50px);
}

/* ===== WTK RESPONSIVE ===== */
@media (max-width: 768px) {
    .ui {
        max-width: 90%;
        padding: 0 20px;
    }
    
    .question-input {
        max-width: 100%;
        font-size: 0.9rem;
    }
    
    .answer {
        font-size: 1.5rem;
        width: 90%;
        padding: 20px;
    }
    
    .sound-toggle {
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 450px) {
    .sound-toggle {
        top: calc(37%);
        right: 50%;
        transform: translateX(50%) translateY(-50%);
    }
    
    .sound-toggle:hover {
        background: rgba(0, 255, 255, 0.2);
        border-color: rgba(0, 255, 255, 0.5);
        transform: translateX(50%) translateY(-50%) scale(1.1);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    }
    
    .sound-toggle:focus {
        outline: 3px solid #00CCFF;
        outline-offset: 2px;
        transform: translateX(50%) translateY(-50%);
    }
    
    .sound-toggle.disabled:hover {
        background: rgba(102,102,102,0.2);
        border-color: #888;
        color: #888;
        transform: translateX(50%) translateY(-50%);
    }
}

@media (max-height: 600px) {
    .answer {
        font-size: 1.4rem;
        padding: 15px;
    }
    
    .ui {
        max-width: 250px;
    }
}

/* ===== WTK ACCESSIBILITY ===== */
/* !important is JUSTIFIED here: Accessibility override must take precedence */
@media (prefers-reduced-motion: reduce) {
    .answer,
    .question-input,
    .sound-toggle {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    
    @keyframes ethereal-float {
        0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
    }
    
    @keyframes text-glow-animation {
        0%, 100% { 
            text-shadow: 
                0 0 8px rgba(255,255,255,0.9),
                0 0 20px rgba(0,221,255,0.7),
                0 0 40px rgba(100,255,255,0.3);
        }
    }
}

@media (forced-colors: active) {
    .question-input {
        border: 2px solid ButtonText;
        background: ButtonFace;
        color: ButtonText;
    }
    
    .answer {
        color: CanvasText;
        text-shadow: none;
    }
    
    .sound-toggle {
        border: 1px solid ButtonText;
        color: ButtonText;
    }
}

/* Increased specificity for .hidden state to override base .sound-toggle styles */
body.wtk-page .sound-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50px) scale(0.8);
    transition: all 0.5s ease;
}

@media (max-width: 450px) {
    body.wtk-page .sound-toggle.hidden {
        transform: translateX(50%) translateY(-50%) scale(0.8);
    }
}