/**
 * Voice Typing CSS - Modern Blob Animation
 * Tamil Voice Recognition with Google Cloud Speech-to-Text
 */

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING VOICE BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.voice-toggle-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333ea 0%, #c026d3 50%, #ec4899 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
}

.voice-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(147, 51, 234, 0.6);
}

.voice-toggle-btn svg {
    width: 24px;
    height: 24px;
    color: white;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.voice-toggle-btn.recording {
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.7);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(236, 72, 153, 0);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   VOICE PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.voice-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 100%);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.voice-panel.open {
    right: 0;
}

.voice-panel-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.voice-panel-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-panel-title svg {
    width: 24px;
    height: 24px;
    color: #c026d3;
}

.voice-panel-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.voice-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BLOB ANIMATION CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.voice-animation-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

/* Animated Blob Background */
.voice-blob {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
            rgba(192, 38, 211, 0.6) 0%,
            rgba(147, 51, 234, 0.4) 40%,
            rgba(236, 72, 153, 0.2) 70%,
            transparent 100%);
    filter: blur(30px);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.voice-blob.active {
    opacity: 1;
    animation: blob-morph 3s ease-in-out infinite;
}

@keyframes blob-morph {

    0%,
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        transform: scale(1) rotate(0deg);
    }

    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
        transform: scale(1.1) rotate(90deg);
    }

    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
        transform: scale(0.95) rotate(180deg);
    }

    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
        transform: scale(1.05) rotate(270deg);
    }
}

/* Avatar Container */
.voice-avatar {
    position: relative;
    z-index: 10;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(192, 38, 211, 0.5);
    box-shadow: 0 0 40px rgba(192, 38, 211, 0.4);
    transition: all 0.3s ease;
}

.voice-avatar.active {
    border-color: rgba(236, 72, 153, 0.8);
    box-shadow: 0 0 60px rgba(236, 72, 153, 0.6);
    animation: avatar-pulse 1.5s ease-in-out infinite;
}

@keyframes avatar-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.voice-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Floating Particles */
.voice-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c026d3, #ec4899);
    opacity: 0;
    transition: opacity 0.3s;
}

.particles-active .particle {
    opacity: 1;
    animation: float-particle 3s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 30%;
    right: 20%;
    animation-delay: 0.5s;
}

.particle:nth-child(3) {
    bottom: 25%;
    left: 25%;
    animation-delay: 1s;
}

.particle:nth-child(4) {
    bottom: 35%;
    right: 15%;
    animation-delay: 1.5s;
}

.particle:nth-child(5) {
    top: 45%;
    left: 10%;
    animation-delay: 2s;
}

.particle:nth-child(6) {
    top: 50%;
    right: 10%;
    animation-delay: 2.5s;
}

@keyframes float-particle {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }

    25% {
        transform: translate(10px, -15px) scale(1.2);
        opacity: 1;
    }

    50% {
        transform: translate(-5px, -25px) scale(0.8);
        opacity: 0.6;
    }

    75% {
        transform: translate(15px, -10px) scale(1.1);
        opacity: 0.9;
    }
}

/* Mic Icon in center (fallback if no avatar) */
.voice-mic-icon {
    position: relative;
    z-index: 10;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333ea, #c026d3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-mic-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS AND TEXT
   ═══════════════════════════════════════════════════════════════════════════ */

.voice-status {
    margin-top: 30px;
    text-align: center;
    z-index: 10;
}

.voice-status-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 8px;
}

.voice-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 13px;
    color: white;
}

.voice-status-indicator.recording {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.recording .status-dot {
    background: #ef4444;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Live Transcript */
.voice-transcript {
    margin-top: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    width: 100%;
    max-width: 300px;
}

.voice-transcript-text {
    color: white;
    font-size: 16px;
    line-height: 1.5;
    font-family: 'Noto Sans Tamil', sans-serif;
}

.voice-transcript-placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTROLS
   ═══════════════════════════════════════════════════════════════════════════ */

.voice-controls {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    justify-content: center;
}

.voice-btn {
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-btn-primary {
    background: linear-gradient(135deg, #9333ea, #c026d3);
    color: white;
}

.voice-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
}

.voice-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.voice-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.voice-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.voice-btn-stop {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Insert button */
.voice-btn-insert {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */

.voice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    transition: all 0.3s ease;
}

.voice-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media screen and (max-width: 768px) {
    .voice-panel {
        width: 100%;
        right: -100%;
    }

    .voice-toggle-btn {
        bottom: 140px;
        width: 48px;
        height: 48px;
    }

    .voice-avatar {
        width: 100px;
        height: 100px;
    }

    .voice-blob {
        width: 200px;
        height: 200px;
    }
}
