/* ── AI Import Plugin ──────────────────────────────────────────── */

/* Trigger button */
.ai-import-trigger {
    margin-bottom: 12px;
}

/* AI modal z-index (normal, no stacking needed) */
#aiImportModal {
    z-index: 1055;
}

/* Drop zone */
#ai-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
    user-select: none;
}
#ai-drop-zone:hover,
#ai-drop-zone.dragover {
    border-color: #007bff;
    background: #f0f6ff;
}
.ai-drop-icon {
    font-size: 2.8rem;
    margin-bottom: 8px;
}
.ai-drop-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    color: #333;
}
.ai-drop-sub {
    font-size: 0.85rem;
    color: #888;
}
.ai-file-name {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #007bff;
    font-weight: 500;
}

/* Text input — visible resize handle */
#ai-text-input {
    resize: vertical;
    min-height: 100px;
}

/* Confidence bar */
#ai-confidence-bar {
    transition: width 0.4s ease;
}

/* Client / doc cards */
.border-left-primary { border-left: 4px solid #007bff !important; }
.border-left-info    { border-left: 4px solid #17a2b8 !important; }

/* AI button in create modal footer */
.ai-import-create-btn {
    flex-shrink: 0;
}

/* Floating action button — mobile only (hidden on md+) */
.ai-import-fab {
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 1040;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.ai-import-fab svg {
    width: 22px;
    height: 22px;
}

/* ── Mobile fixes ─────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* Use dynamic viewport height (dvh) so iOS Safari's URL bar
       doesn't hide the footer buttons */
    #aiImportModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100dvh;
    }
    #aiImportModal .modal-content {
        min-height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    #aiImportModal .modal-body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 20px;
    }
    #aiImportModal .modal-footer {
        flex-shrink: 0;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    /* Prevent items table from blocking vertical scroll */
    #ai-items-section .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Confidence bar: stack on small screens */
    #ai-results > .d-flex.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 6px;
    }

    /* Drop zone: smaller padding */
    #ai-drop-zone {
        padding: 20px 14px;
    }
    .ai-drop-icon {
        font-size: 2rem;
    }

    /* Footer buttons: don't overflow */
    #aiImportModal .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    #aiImportModal .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* Backdrop when AI modal opens on top of create modal */
body.modal-open .modal-backdrop + .modal-backdrop {
    z-index: 1060;
}


/* ── Voice input mic button ─────────────────────────────────────── */
#ai-mic-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
#ai-mic-btn .feather {
    width: 14px;
    height: 14px;
}
.ai-mic-pulse {
    animation: aiMicPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
}
@keyframes aiMicPulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
#ai-mic-status {
    margin-top: 4px;
    font-size: 0.85em;
}


