/* ============================================================
   NORHI Scribe — Dictate + Hide Widgets
   Self-contained, no Tailwind, no CSS variable dependencies.
   Ported from NUAMP source.css lines 1253-1472 (2026-05-14).

   Colors inlined for portability:
     --color-widget-dictate: #7c2d12  (terracotta)
     --color-widget-hide:    #6b7280  (gray)
   ============================================================ */

/* Desktop FAB stack (right edge, vertical) */
#widget-fab-stack {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9990;
    display: flex;
    flex-direction: column;  /* hide on top, dictate on bottom */
    gap: 12px;
    align-items: flex-end;
    transition: opacity 0.25s ease;
}

#widget-fab-stack.widgets-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================================
   HIDE WIDGET BUTTON (top of FAB stack)
   ============================================================ */
.hw-fab {
    position: relative;
    z-index: 9990;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #6b7280;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    box-shadow: 0 4px 16px rgba(107, 114, 128, 0.2);
    opacity: 0.5;  /* ghost at rest */
}
.hw-fab:hover {
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.25);
    opacity: 1;
}

/* ============================================================
   DICTATE WIDGET — direct-to-field voice dictation
   ============================================================ */
.dw-fab {
    position: relative;
    z-index: 9990;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #7c2d12;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    box-shadow: 0 4px 16px rgba(124, 45, 18, 0.25);
}
.dw-fab:hover {
    box-shadow: 0 6px 20px rgba(124, 45, 18, 0.3);
}
.dw-fab.recording {
    /* box-shadow driven by JS audio analyser; no CSS animation */
}
.dw-fab.processing {
    opacity: 0.7;
    cursor: wait;
}
.dw-fab.success-flash {
    background: #16a34a;
    transition: background 0.4s ease;
}

/* Field being targeted for dictation — subtle terracotta outline */
.dictate-target {
    outline: 2px solid #7c2d12 !important;
    outline-offset: 2px;
    transition: outline 0.2s ease;
}

/* Tiny status toast (fixed bottom-center) */
.dw-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 10002;
    background: rgba(45, 47, 51, 0.95);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 320px;
    text-align: center;
}
.dw-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.dw-toast.error {
    background: rgba(185, 28, 28, 0.95);
}

/* ============================================================
   MOBILE DICTATE WIDGET
   Right-side ghost stack — hide button + dictate button
   Only visible on phones/PWA (max-width: 768px)
   Desktop FAB stack is hidden on mobile
   ============================================================ */

#dictate-mobile-mount {
    display: none;  /* shown on mobile via media query below */
    transition: opacity 0.25s ease;
}

.dw-fab-mobile {
    width: 52px;
    height: 52px;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    background: #7c2d12;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(124, 45, 18, 0.35);
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.15s ease;
    touch-action: manipulation;
}
.dw-fab-mobile:active {
    transform: scale(0.95);
    opacity: 1;
}
.dw-fab-mobile.recording,
.dw-fab-mobile.processing,
.dw-fab-mobile.success-flash {
    opacity: 1;
}
.dw-fab-mobile.processing {
    cursor: wait;
}
.dw-fab-mobile.success-flash {
    background: #16a34a;
    transition: background 0.4s ease, opacity 0.2s ease;
}

.hw-fab-mobile {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    background: #6b7280;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(107, 114, 128, 0.25);
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.15s ease;
    touch-action: manipulation;
}
.hw-fab-mobile:active {
    transform: scale(0.95);
    opacity: 1;
}

#dictate-mobile-mount.mobile-widgets-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Mobile layout: show mobile mount, hide desktop stack */
@media (max-width: 768px) {
    #widget-fab-stack {
        display: none !important;
    }
    #dictate-mobile-mount {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: center;
        position: fixed;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 9995;
    }
}
