/* === PROVEN TTS LAYOUT (Based on ElevenLabs/PlayHT Best Practices) === */
/* Single-column workflow optimized for text-to-speech generation */

/* RESET: Remove broken asymmetric layout */
.translate-grid {
    display: block !important;
    /* Remove grid */
    width: 100% !important;
}

/* === PROVEN LAYOUT: VERTICAL FLOW === */
/* Input → Button → Output → Voice → Controls */

.input-pane,
.action-pane,
.output-pane {
    grid-column: unset !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* 1. Source Text - Full Width, Prominent */
.input-pane {
    margin-bottom: 16px !important;
    border: 2px solid rgba(99, 102, 241, 0.2) !important;
}

.input-pane textarea {
    min-height: 180px !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
}

/* 2. Translate Button - Centered, Smaller */
.action-pane {
    text-align: center !important;
    margin: 16px 0 !important;
    padding: 0 !important;
}

.btn-translate-main {
    width: 100px !important;
    height: 100px !important;
    font-size: 0.75rem !important;
}

/* 3. Output Text - Full Width, Clean */
.output-pane {
    margin-bottom: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.output-pane textarea {
    min-height: 150px !important;
    font-size: 0.95rem !important;
}

/* 4. Voice Section - Integrated Below Output */
.tts-section {
    width: 100% !important;
    padding: 20px !important;
    margin-top: 16px !important;
    background: rgba(99, 102, 241, 0.05) !important;
    border: 1px solid rgba(99, 102, 241, 0.2) !important;
    border-radius: 12px !important;
    position: relative !important;
    /* Required for absolute positioning of tooltip */
}

/* Voice Pills - Horizontal Row */
.voice-pills-mini {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin: 12px 0 16px 0 !important;
    justify-content: center !important;
    /* Center pills */
}

.v-pill {
    flex: 0 0 auto !important;
    padding: 10px 18px !important;
    font-size: 0.9rem !important;
}

/* Voice Controls - Clean 3-Column Grid */
.voice-controls-advanced {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 16px !important;
    padding: 16px !important;
    margin: 16px 0 !important;
}

/* 5. Speak Button - Right-Aligned, Prominent */
.btn-speak {
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
    display: block !important;
    padding: 16px 32px !important;
    font-size: 1.05rem !important;
    z-index: 2 !important;
    position: relative !important;
}

/* === TOOLTIP FIX === */
.tts-instruction {
    top: auto !important;
    /* Unset top */
    right: auto !important;
    /* Unset right */
    bottom: 90px !important;
    /* Position closer to the button */
    left: 50% !important;
    transform: translateX(-50%) !important;
    animation: floatHint 2s ease-in-out infinite !important;
    z-index: 100 !important;
    white-space: nowrap !important;
}

/* Fix arrow to point down center */
.tts-instruction::after {
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
}

/* === SPACING OPTIMIZATION === */

.pane-header {
    padding: 10px 16px !important;
    margin-bottom: 10px !important;
}

.pane-footer {
    padding: 10px 16px !important;
    margin-top: 10px !important;
}

/* === RESPONSIVE: MAINTAIN VERTICAL FLOW === */

@media (max-width: 768px) {
    .input-pane textarea {
        min-height: 150px !important;
    }

    .output-pane textarea {
        min-height: 120px !important;
    }

    .voice-controls-advanced {
        grid-template-columns: 1fr !important;
    }

    .v-pill {
        font-size: 0.85rem !important;
        padding: 8px 14px !important;
    }
}

/* === VISUAL HIERARCHY === */

/* Primary: Source Input */
.input-pane {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1) !important;
}

.input-pane:focus-within {
    border-color: rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.2) !important;
}

/* Secondary: Output */
.output-pane {
    background: rgba(255, 255, 255, 0.01) !important;
}

/* Tertiary: Voice Controls */
.tts-section {
    backdrop-filter: blur(10px) !important;
}

/* === ACCESSIBILITY === */

.tts-label {
    text-align: center !important;
    font-size: 0.75rem !important;
    color: rgba(148, 163, 184, 0.9) !important;
    margin-bottom: 8px !important;
    display: block !important;
}

/* Ensure readable contrast */
textarea {
    color: rgba(255, 255, 255, 0.95) !important;
}

textarea::placeholder {
    color: rgba(148, 163, 184, 0.5) !important;
}

/* === CONSISTENT SPACING === */

* {
    box-sizing: border-box !important;
}

.glass-card {
    max-width: 900px !important;
    margin: 0 auto !important;
}

/* Remove all conflicting grid layouts */
.translate-grid>* {
    float: none !important;
    clear: both !important;
}