/* ═══════════════════════════════════════════════════
   Voice Command UI Styles
   ═══════════════════════════════════════════════════ */

/* ── Floating Action Button ── */
.voice-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    z-index: 9000;
    overflow: hidden;
    outline: none;
}

.voice-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.65), 0 3px 12px rgba(0, 0, 0, 0.35);
}

.voice-fab:active {
    transform: scale(0.95);
}

.voice-fab.listening {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: voice-fab-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-fab-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.07);
    }
}

/* Ripple effect on the FAB */
.voice-fab-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.voice-fab.listening .voice-fab-ripple {
    animation: voice-ripple 2s ease-out infinite;
}

@keyframes voice-ripple {
    0% {
        transform: scale(0.5);
        opacity: 0.6;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Hidden when not in relevant pages */
.voice-fab.voice-fab-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.7) translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ── Overlay Backdrop ── */
.voice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9100;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.voice-overlay.hidden {
    display: none;
}

/* ── Modal Card ── */
.voice-modal {
    background: #1a1b2e;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 2rem 2.5rem 2rem;
    min-width: 360px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.15);
    animation: voice-modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes voice-modal-in {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* ── Modal Header ── */
.voice-modal-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.voice-modal-mic {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

/* ── Pulse Rings ── */
.voice-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(239, 68, 68, 0.5);
    animation: voice-ring-pulse 2s ease-out infinite;
}

.voice-pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.voice-pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes voice-ring-pulse {
    0% {
        transform: scale(0.6);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.voice-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.02em;
}

.voice-modal-sub {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

/* ── Live Transcript ── */
.voice-transcript {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    font-size: 1rem;
    color: #c7d2fe;
    min-height: 48px;
    font-style: italic;
    margin-bottom: 1.25rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
    word-break: break-word;
}

.voice-transcript:not(:empty) span:not(:empty)~* {
    border-color: rgba(99, 102, 241, 0.5);
}

/* ── Command Hints ── */
.voice-commands-hint {
    margin-bottom: 1.5rem;
}

.voice-hint-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.6rem;
}

.voice-hint-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.voice-hint-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    color: #a5b4fc;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    user-select: none;
}

.voice-hint-chip:hover {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.voice-hint-chip.matched {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.45);
    color: #86efac;
}

/* ── Cancel Button ── */
.voice-cancel-btn {
    width: 100%;
    padding: 0.65rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: 'Inter', sans-serif;
}

.voice-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* ── Toast Notification ── */
.voice-toast {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    background: #1e293b;
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #f1f5f9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 9200;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.voice-toast.hidden {
    display: none;
}

.voice-toast.toast-success {
    border-color: rgba(34, 197, 94, 0.35);
    background: linear-gradient(135deg, #0f2d1a 0%, #1e293b 100%);
    color: #86efac;
}

.voice-toast.toast-error {
    border-color: rgba(239, 68, 68, 0.35);
    background: linear-gradient(135deg, #2d0f0f 0%, #1e293b 100%);
    color: #fca5a5;
}

.voice-toast.toast-warning {
    border-color: rgba(251, 191, 36, 0.35);
    background: linear-gradient(135deg, #2d230f 0%, #1e293b 100%);
    color: #fde68a;
}

.voice-toast.toast-info {
    border-color: rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, #0f1230 0%, #1e293b 100%);
    color: #a5b4fc;
}

.voice-toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ── Voice Unsupported Banner ── */
.voice-unsupported {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e293b;
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fde68a;
    border-radius: 10px;
    padding: 0.75rem 1.1rem;
    font-size: 0.82rem;
    z-index: 9000;
    max-width: 240px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════
   Custom Confirmation Modal (Voice-enabled)
   Replaces native confirm() / alert()
   ═══════════════════════════════════════════════════ */

.custom-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9500;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.custom-confirm-overlay.hidden {
    display: none;
}

.custom-confirm-modal {
    background: #1a1b2e;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 2rem 2.5rem;
    min-width: 340px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.12);
    animation: confirm-modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

@keyframes confirm-modal-in {
    from {
        transform: scale(0.85) translateY(16px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.custom-confirm-icon {
    font-size: 2.8rem;
    margin-bottom: 0.8rem;
    line-height: 1;
}

.custom-confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.6rem;
    letter-spacing: -0.02em;
}

.custom-confirm-message {
    font-size: 0.92rem;
    color: #94a3b8;
    line-height: 1.55;
    margin-bottom: 1.2rem;
    font-family: 'Inter', sans-serif;
}

.custom-confirm-voice-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 1.4rem;
    padding: 0.5rem 0.8rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.voice-mic-hint {
    font-size: 0.9rem;
    animation: mic-hint-pulse 2s ease-in-out infinite;
}

@keyframes mic-hint-pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.custom-confirm-buttons {
    display: flex;
    gap: 0.75rem;
}

.custom-confirm-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Inter', sans-serif;
}

.custom-confirm-btn.cancel-btn {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
}

.custom-confirm-btn.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

.custom-confirm-btn.ok-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.custom-confirm-btn.ok-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.custom-confirm-btn.ok-btn:active {
    transform: translateY(0);
}

/* Alert mode (single OK button) */
.custom-confirm-modal.alert-mode .cancel-btn {
    display: none;
}

.custom-confirm-modal.alert-mode .ok-btn {
    flex: none;
    width: 100%;
}