/**
 * LivendVox - estilos específicos (base: livendi.css)
 */

.vox-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 196, 154, 0.2);
    color: #00C49A;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
}

.header-meta .vox-link {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    text-decoration: none;
}

.header-meta .vox-link:hover {
    color: var(--accent);
}

/* Panel de voz */
.voice-panel {
    background: linear-gradient(135deg, rgba(0, 78, 137, 0.06), rgba(0, 196, 154, 0.08));
    border: 2px solid rgba(0, 78, 137, 0.15);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
}

.voice-panel h3 {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-mic-portal {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10050;
}

.voice-mic-slot {
    min-height: 0;
}

body.vox-mic-float-active .voice-mic-slot {
    min-height: 88px;
}

.voice-mic-slot-hint {
    display: none;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 10px;
}

body.vox-mic-float-active .voice-mic-slot-hint {
    display: block;
}

.voice-mic-dock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

body.vox-mic-float-active .voice-mic-dock.is-floating {
    pointer-events: auto;
    position: fixed;
    z-index: 10051;
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(88px, calc(14px + env(safe-area-inset-bottom, 0px)));
    left: auto;
    top: auto;
    padding: 6px 8px 10px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(0, 78, 137, 0.15);
    touch-action: none;
}

body.vox-mic-float-active .voice-mic-dock.is-floating.has-custom-pos {
    right: auto;
    bottom: auto;
}

.dark-mode body.vox-mic-float-active .voice-mic-dock.is-floating {
    background: rgba(30, 36, 48, 0.96);
    border-color: rgba(255, 255, 255, 0.12);
}

.voice-mic-dock.is-dragging {
    opacity: 0.92;
    box-shadow: 0 12px 40px rgba(0, 78, 137, 0.3);
}

.voice-mic-grip {
    display: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 6px 14px;
    cursor: grab;
    line-height: 1;
    touch-action: none;
}

body.vox-mic-float-active .voice-mic-dock.is-floating .voice-mic-grip {
    display: block;
}

body.vox-mic-float-active .voice-mic-dock.is-floating #voiceStatus {
    display: none;
}

@media (min-width: 1025px) {
    body:not(.vox-mic-float-active) .voice-mic-dock {
        margin-bottom: 14px;
    }
}

#voiceMicWrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#voiceMicWrap.is-recording .voice-mic-ring {
    animation: vox-pulse 1s ease-in-out infinite;
    border-color: var(--primary);
}

@keyframes vox-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

.voice-mic-ring {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 3px solid var(--secondary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dark-mode .voice-mic-ring {
    background: var(--dark-card);
}

#voiceMicBtn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1.75rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.45);
    touch-action: none;
    user-select: none;
}

#voiceMicBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#voiceMicBtn.is-recording {
    background: var(--danger);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

#voiceStatus {
    font-size: 0.88rem;
    color: var(--text-muted);
    text-align: center;
}

.voice-transcript-box {
    min-height: 72px;
    background: #fff;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 1.05rem;
    line-height: 1.45;
    color: var(--text);
}

.dark-mode .voice-transcript-box {
    background: var(--dark-input);
    border-color: rgba(255, 255, 255, 0.15);
}

.voice-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.95rem;
}

.voice-interim {
    color: var(--text-muted);
}

.voice-final {
    color: var(--text);
    font-weight: 500;
}

#voiceParsedPreview {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

#voiceParsedPreview.hidden {
    display: none !important;
}

.parsed-chip {
    background: rgba(0, 196, 154, 0.12);
    border: 1px solid rgba(0, 196, 154, 0.35);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    text-align: center;
}

.parsed-chip span {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.parsed-chip strong {
    font-size: 0.95rem;
    color: var(--secondary);
}

.parsed-confidence {
    grid-column: 1 / -1;
    font-size: 0.8rem;
    margin: 4px 0 0;
    text-align: center;
}

.parsed-confidence.conf-high { color: #2e7d32; }
.parsed-confidence.conf-medium { color: #e65100; }
.parsed-confidence.conf-low { color: #c62828; }

.field-parsed {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(0, 196, 154, 0.25);
}

.voice-unsupported {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.manual-fields-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 16px 0 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Solo la página propia de LivendVox. En la app principal .sale-item es la tarjeta de Ventas. */
body.vox-page .sale-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

body.vox-page .sale-item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.vox-page .sale-item-main span {
    font-size: 0.88rem;
    color: var(--text-light);
}

body.vox-page .sale-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.vox-page .sale-total {
    font-weight: 700;
    color: var(--secondary);
}

body.vox-page .btn-icon-danger {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}

.product-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.stat-box span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-box strong {
    font-size: 1.35rem;
    color: var(--secondary);
}

#summaryStats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.summary-client-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lexicon-stats {
    font-size: 0.82rem;
    color: var(--accent);
    margin: -6px 0 14px;
    line-height: 1.4;
}

.notification.show {
    display: block;
}

.notification {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-hover);
}

.notification.success { background: var(--accent); }
.notification.warning { background: var(--warning); color: #333; }
.notification.error { background: var(--danger); }

.voice-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.voice-examples {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin: 12px 0 0;
    line-height: 1.4;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.card-header-row h2 {
    margin: 0;
}

#clientAutocompleteList,
#productAutocompleteList {
    display: none;
    background: #fff;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#clientAutocompleteList.open,
#productAutocompleteList.open {
    display: block;
}

.dark-mode #clientAutocompleteList,
.dark-mode #productAutocompleteList {
    background: var(--dark-card);
}

#clientAutocompleteList .autocomplete-item,
#productAutocompleteList .autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

#clientAutocompleteList .autocomplete-item:hover,
#productAutocompleteList .autocomplete-item:hover {
    background: rgba(255, 107, 53, 0.1);
}

body.vox-mic-active {
    user-select: none;
    -webkit-user-select: none;
}

/* Guía de entrenamiento colapsable (antes del footer) */
.vox-guide {
    margin: 28px 16px 0;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(160deg, rgba(0, 78, 137, 0.07), rgba(0, 196, 154, 0.1));
    border: 2px solid rgba(0, 78, 137, 0.14);
    border-radius: var(--radius);
    overflow: hidden;
}

.vox-guide-summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
    -webkit-user-select: none;
}

.vox-guide-summary::-webkit-details-marker {
    display: none;
}

.vox-guide-summary-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.vox-guide-summary-title i {
    color: var(--accent);
}

.vox-guide-summary-chevron::before {
    content: '▾';
    font-size: 0.85rem;
    color: var(--text-muted);
    display: inline-block;
    transition: transform 0.2s ease;
}

.vox-guide[open] .vox-guide-summary-chevron::before {
    transform: rotate(180deg);
}

.vox-guide-body {
    padding: 0 18px 18px;
    border-top: 1px solid rgba(0, 78, 137, 0.1);
}

.vox-guide-lead {
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.5;
    margin: 0 0 14px;
}

.vox-guide-lexicon {
    font-size: 0.88rem;
    line-height: 1.45;
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 0 0 16px;
    border-left: 4px solid var(--accent);
    color: var(--text);
}

.dark-mode .vox-guide-lexicon {
    background: rgba(0, 0, 0, 0.2);
}

.vox-guide-lexicon strong {
    color: var(--secondary);
}

.vox-guide-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vox-guide-steps li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.vox-step-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vox-guide-steps strong {
    display: block;
    font-size: 0.92rem;
    color: var(--secondary);
    margin-bottom: 4px;
}

.vox-guide-steps p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.vox-guide-steps em {
    font-style: normal;
    color: var(--text);
    font-weight: 500;
}

.vox-guide-details {
    margin-top: 16px;
    border-top: 1px solid rgba(0, 78, 137, 0.12);
    padding-top: 12px;
}

.vox-guide-details summary {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vox-guide-details summary::-webkit-details-marker {
    display: none;
}

.vox-guide-details summary::after {
    content: '▾';
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.6;
}

.vox-guide-details[open] summary::after {
    transform: rotate(180deg);
}

.vox-guide-phrases {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.vox-guide-phrases li {
    font-size: 0.84rem;
    color: var(--text-muted);
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    line-height: 1.4;
}

.vox-guide-phrases li:last-child {
    border-bottom: none;
}

.vox-guide-phrases span {
    display: inline-block;
    min-width: 7rem;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vox-guide-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 12px 0 0;
    line-height: 1.45;
}

.vox-footer {
    text-align: center;
    padding: 20px 16px 28px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.vox-footer a {
    color: var(--secondary);
    text-decoration: none;
}

.vox-footer a:hover {
    color: var(--primary);
}

@media (min-width: 600px) {
    .vox-guide-body {
        padding: 4px 22px 22px;
    }

    .vox-guide-steps {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

/* LivendVox integrado en Livendix (misma app) */
.sale-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sale-form-head h2 {
    margin: 0;
}

.sale-mode-toggle {
    flex-shrink: 0;
}

.manual-fields-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.header-icon-btn.header-icon-btn--active {
    background: rgba(0, 196, 154, 0.35);
    box-shadow: 0 0 0 2px rgba(0, 196, 154, 0.55);
}

body.livendix-vox-active #salesFormCard {
    border-color: rgba(0, 196, 154, 0.35);
}

.field-parsed {
    outline: 2px solid rgba(0, 196, 154, 0.45);
    outline-offset: 1px;
}
