/* ============================================
TCC Portal — Voice Search v1.2
Prefijo propio: tcc-voice-
Corporate Theme: Gold & Navy
============================================ */

/* ─────────────────────────────────────────────
Botón de micrófono en el buscador
───────────────────────────────────────────── */
#tcc-voice-mount {
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.tcc-voice-btn {
    position: relative;
    width: 2.75rem;
    min-width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-light, #334155);
    background: var(--bg-input, #1E293B);
    color: var(--text-muted, #64748B);
    border-radius: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition:
        color 0.25s ease,
        background-color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

/* [CORPORATE] Hover: dorado en lugar de índigo */
.tcc-voice-btn:hover {
    color: var(--accent-gold-hover, #FBBF24);
    border-color: var(--accent-gold-hover, #FBBF24);
    background: var(--bg-hover, #334155);
}

/* [CORPORATE] Focus: glow dorado */
.tcc-voice-btn:focus-visible {
    outline: 2px solid var(--accent-gold-hover, #FBBF24);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.tcc-voice-btn[hidden] {
    display: none !important;
}

/* [CORPORATE] Estado "escuchando": gradiente dorado */
.tcc-voice-btn.is-listening {
    color: #050811;
    background: linear-gradient(
        135deg,
        var(--accent-gold, #F59E0B),
        var(--accent-gold-hover, #FBBF24)
    );
    border-color: transparent;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 4px 18px rgba(245, 158, 11, 0.35);
    animation: tcc-voice-pulse 1.6s ease-out infinite;
}

/* [CORPORATE] Estado "procesando": dorado */
.tcc-voice-btn.is-processing {
    color: var(--accent-gold-hover, #FBBF24);
    cursor: progress;
}

.tcc-voice-btn i {
    pointer-events: none;
}

/* Integración profesional dentro de .input-group */
.input-group > #tcc-voice-mount .tcc-voice-btn {
    height: 100%;
    border-left: 0;
    border-radius: 0;
}

.input-group > #tcc-voice-mount:first-child .tcc-voice-btn {
    border-left: 1px solid var(--border-light, #334155);
    border-radius: var(--radius-md, 12px) 0 0 var(--radius-md, 12px);
}

.input-group > #tcc-voice-mount + .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* [CORPORATE] Pulso dorado en lugar de índigo */
@keyframes tcc-voice-pulse {
    0%, 100% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.28),
            0 0 0 0 rgba(245, 158, 11, 0.45);
    }
    50% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.28),
            0 0 0 7px rgba(245, 158, 11, 0);
    }
}

/* ─────────────────────────────────────────────
Estado discreto bajo el buscador
───────────────────────────────────────────── */
.tcc-voice-status {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.55rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted, #64748B);
    animation: tcc-voice-fade-in 0.22s ease-out both;
}

.tcc-voice-status[hidden] {
    display: none !important;
}

/* [CORPORATE] Tono "listening" en dorado */
.tcc-voice-status[data-tone="listening"] {
    color: var(--accent-gold-hover, #FBBF24);
}

.tcc-voice-status[data-tone="error"] {
    color: #fda4af;
}

.tcc-voice-status[data-tone="info"] {
    color: var(--text-secondary, #94A3B8);
}

@keyframes tcc-voice-fade-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────
Toggle discreto dentro del offcanvas
───────────────────────────────────────────── */
/* [CORPORATE] Borde y fondo dorado sutil */
.tcc-voice-preference {
    flex-shrink: 0;
    margin: 0 0.6rem 0.6rem;
    padding: 0.9rem 1rem 0.85rem;
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: var(--radius-md, 12px);
    background:
        linear-gradient(
            135deg,
            rgba(245, 158, 11, 0.06),
            rgba(251, 191, 36, 0.06)
        );
    position: relative;
    overflow: hidden;
}

/* [CORPORATE] Línea vertical dorada */
.tcc-voice-preference::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.85rem;
    bottom: 0.85rem;
    width: 3px;
    background: linear-gradient(
        to bottom,
        var(--accent-gold, #F59E0B),
        var(--accent-gold-hover, #FBBF24)
    );
    border-radius: 0 3px 3px 0;
}

.tcc-voice-preference__header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary, #F8FAFC);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

/* [CORPORATE] Icono del header en dorado */
.tcc-voice-preference__header i {
    color: var(--accent-gold-hover, #FBBF24);
    font-size: 0.95rem;
}

.tcc-voice-preference__desc {
    font-size: 0.76rem;
    color: var(--text-muted, #64748B);
    line-height: 1.45;
    margin: 0 0 0.75rem;
}

.tcc-voice-preference__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.tcc-voice-preference__label {
    font-size: 0.8rem;
    color: var(--text-secondary, #94A3B8);
}

/* ── Switch pequeño, profesional y discreto ── */
.tcc-voice-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1px solid var(--border-light, #334155);
    background: var(--bg-input, #1E293B);
    cursor: pointer;
    padding: 0;
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

/* [CORPORATE] Focus del switch en dorado */
.tcc-voice-switch:focus-visible {
    outline: 2px solid var(--accent-gold-hover, #FBBF24);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.tcc-voice-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted, #64748B);
    transition:
        left 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.22s ease;
}

/* [CORPORATE] Switch activo: gradiente dorado */
.tcc-voice-switch[aria-checked="true"] {
    background: linear-gradient(
        135deg,
        var(--accent-gold, #F59E0B),
        var(--accent-gold-hover, #FBBF24)
    );
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

/* [CORPORATE] Thumb activo: navy oscuro sobre dorado */
.tcc-voice-switch[aria-checked="true"] .tcc-voice-switch__thumb {
    left: 21px;
    background: #050811;
}

.tcc-voice-switch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─────────────────────────────────────────────
Reduced motion
───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .tcc-voice-btn.is-listening,
    .tcc-voice-status {
        animation: none !important;
    }
    .tcc-voice-btn,
    .tcc-voice-switch,
    .tcc-voice-switch__thumb {
        transition: none !important;
    }
}