/* ============================================
   KIB Voice Commands Styles
   ============================================ */

/* Voice Toggle Button - Below the accessibility button */
.kib-voice-toggle {
    position: fixed;
    top: calc(50% + 110px);
    bottom: auto;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
    z-index: 9998;
    transition: all 0.3s ease;
}

.kib-voice-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(124, 58, 237, 0.55);
}

.kib-voice-toggle:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.kib-voice-toggle i {
    font-size: 24px;
    color: #fff;
}

.kib-voice-toggle.listening {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    animation: pulse-voice 1.2s ease-in-out infinite;
}

@keyframes pulse-voice {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 32px rgba(239, 68, 68, 0.65);
    }
}

/* Voice Control Panel */
.kib-voice-controls {
    position: fixed;
    top: calc(50% + 110px);
    bottom: auto;
    left: 90px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    padding: 15px 20px;
    width: 340px;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
}

.kib-voice-controls.active {
    display: block;
    opacity: 1;
}

.kib-voice-controls h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kib-voice-close {
    cursor: pointer;
    color: #64748b;
    font-size: 18px;
    transition: color 0.2s;
}

.kib-voice-close:hover {
    color: #1e293b;
}

.kib-voice-hide-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 8px;
}

body.kib-admin-body .kib-voice-hide-btn {
    display: inline-flex;
}

.kib-voice-hide-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.kib-voice-restore-tab {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
    z-index: 9998;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.kib-voice-restore-tab:hover {
    opacity: 1;
    transform: scale(1.1);
}

.kib-voice-restore-tab i {
    font-size: 16px;
    color: #fff;
}

/* Admin section: stack above the audio button, bottom-right */
body.kib-admin-body .kib-voice-toggle {
    top: auto;
    bottom: 160px;
    left: auto;
    right: 20px;
    transform: none;
}

body.kib-admin-body .kib-voice-controls {
    top: auto;
    bottom: 230px;
    left: auto;
    right: 20px;
    transform: none;
}

.kib-voice-mic-btn {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #7c3aed;
    background: #f5f3ff;
    color: #5b21b6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.kib-voice-mic-btn:hover {
    background: #ede9fe;
}

.kib-voice-mic-btn:focus-visible {
    outline: 3px solid #5b21b6;
    outline-offset: 2px;
}

.kib-voice-mic-btn.listening {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

.kib-voice-status {
    margin-top: 12px;
    min-height: 20px;
    font-size: 13px;
    color: #334155;
    padding: 8px 10px;
    background: #f1f5f9;
    border-radius: 6px;
}

.kib-voice-help {
    margin-top: 12px;
    font-size: 13px;
    color: #475569;
}

.kib-voice-help summary {
    cursor: pointer;
    font-weight: 600;
    color: #1e293b;
}

.kib-voice-help ul {
    margin: 10px 0 0;
    padding-left: 18px;
}

.kib-voice-help li {
    margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .kib-voice-toggle {
        top: auto;
        bottom: 90px;
        left: auto;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .kib-voice-toggle i {
        font-size: 20px;
    }

    .kib-voice-controls {
        top: auto;
        bottom: 150px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 90%;
        max-width: 340px;
    }
}
