/* Badge Component Styles */

/* Base badge styles — muted tinted backgrounds with darker text.
   Matches the .doctype-tag aesthetic used on the polished document_type_list page. */
.badge,
.document-type-badge,
.document-subtype-badge,
.processing-stage-badge,
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    line-height: 1.4;
    border: 1px solid transparent;
}

/* Document Type Badge — neutral grey */
.document-type-badge {
    background: #f3f4f6;
    color: #4b5563;
}

/* Document Subtype Badge — softer neutral, distinct from the type badge */
.document-subtype-badge {
    background: #f9fafb;
    color: #6b7280;
    border-color: #e5e7eb;
}

/* ============================================================
   Processing Stage Badges
   Cool blue family — denotes pipeline progress, not alarming.
   ============================================================ */
.processing-stage-badge {
    background: rgba(0, 176, 244, 0.10);
    color: #0083b3;
}

.processing-stage-badge.stage-pending {
    /* Pending = neutral grey, not amber — it just means "not started" */
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
}

.processing-stage-badge.stage-processing-extracting-text,
.processing-stage-badge.stage-processing-classifying,
.processing-stage-badge.stage-processing-extracting-fields,
.processing-stage-badge.stage-processing-standardizing,
.processing-stage-badge.stage-processing-linking-entities {
    background: rgba(0, 176, 244, 0.10);
    color: #0083b3;
}

/* "Saved to Drive" — green-ish, almost done */
.processing-stage-badge.stage-processing-saving-to-drive {
    background: rgba(17, 183, 107, 0.12);
    color: #0a9558;
}

/* Completed pipeline stage — solid muted green */
.processing-stage-badge.stage-completed {
    background: rgba(17, 183, 107, 0.15);
    color: #0a8c53;
}

/* ============================================================
   Status Badges
   Semantic tints — calm where it can be, urgent where it must be.
   ============================================================ */
.status-badge {
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
}

.status-badge.status-pending {
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
}

.status-badge.status-processing {
    background: rgba(0, 176, 244, 0.10);
    color: #0083b3;
}

.status-badge.status-completed {
    background: rgba(17, 183, 107, 0.15);
    color: #0a8c53;
}

.status-badge.status-failed {
    background: rgba(250, 67, 98, 0.10);
    color: #c0254a;
}

/* Password required — amber, action-needed but not alarming */
.status-badge.status-password_required {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.35);
    cursor: pointer;
}

/* badge-- variant used by status_badge.html component */
.badge--password_required {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge--password_required::before {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    content: '\f023'; /* fa-lock */
    margin-right: 4px;
}

/* Special badges */
.password-protected {
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.30);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.unlocked-status {
    background: rgba(17, 183, 107, 0.12);
    color: #0a8c53;
    border: 1px solid rgba(17, 183, 107, 0.30);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* PDF Modified Warning Badge — orange tint, action-needed */
.pdf-modified-badge {
    background: rgba(255, 107, 53, 0.12);
    color: #c2410c;
    border: 1px solid rgba(255, 107, 53, 0.30);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
    cursor: help;
}

/* ============================================================
   Badge Hover — each badge highlights individually on hover.
   Subtle lift + deepened tint + soft shadow, palette-agnostic so
   it works on every badge variant without per-colour rules.
   ============================================================ */
.badge,
.document-type-badge,
.document-subtype-badge,
.processing-stage-badge,
.status-badge,
.password-protected,
.unlocked-status,
.fraud-flag-badge,
.fraud-flag-badge-inline,
.pdf-modified-badge,
.badge-stored-only {
    transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.badge:hover,
.document-type-badge:hover,
.document-subtype-badge:hover,
.processing-stage-badge:hover,
.status-badge:hover,
.password-protected:hover,
.unlocked-status:hover,
.fraud-flag-badge:hover,
.fraud-flag-badge-inline:hover,
.pdf-modified-badge:hover,
.badge-stored-only:hover {
    filter: brightness(0.96);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* ========================================
   FRAUD FLAG BADGES (Task 153)
   ======================================== */

/* Base fraud flag badge styling — colour-neutral; severity set by modifier (#330) */
.fraud-flag-badge,
.fraud-flag-badge-inline {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
    background: rgba(160, 160, 160, 0.10);
    color: #666666;
    border: 1px solid rgba(160, 160, 160, 0.25);
    cursor: help;
}

/* Inline badge (job list) - compact version */
.fraud-flag-badge-inline {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
}

/* ---- Severity modifiers (#330) ---- */

/* Red — high likelihood of fraud */
.fraud-flag-badge--red,
.fraud-flag-badge-inline--red {
    background: rgba(224, 80, 80, 0.12);
    color: #e05050;
    border-color: rgba(224, 80, 80, 0.30);
}

/* Yellow — suspicious / needs review */
.fraud-flag-badge--yellow,
.fraud-flag-badge-inline--yellow {
    background: rgba(230, 170, 40, 0.14);
    color: #d9a123;
    border-color: rgba(230, 170, 40, 0.35);
}

/* Green — no concern */
.fraud-flag-badge--green,
.fraud-flag-badge-inline--green {
    background: rgba(76, 175, 80, 0.12);
    color: #2e7d32;
    border-color: rgba(76, 175, 80, 0.30);
}

/* Fraud section styling */
.fraud-indicators-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 8px;
}

.fraud-section-title {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #e65100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fraud-icon {
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
}

.fraud-icon svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
}

/* Flag icon inside the fraud flag badge — inherits the badge text colour */
.fraud-flag-badge-icon {
    width: 0.85em;
    height: 0.85em;
    fill: currentColor;
    vertical-align: -0.12em;
    margin-right: 0.3em;
}

.fraud-flags-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fraud-flag-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.fraud-flag-description {
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
    flex: 1;
}

/* ---- Staff fraud review / clear (#343) ---- */

/* Cleared (false-positive) panel — neutral green tint, not alarming */
.fraud-indicators-section--cleared {
    background: rgba(76, 175, 80, 0.08);
    border-color: rgba(76, 175, 80, 0.3);
}

.fraud-section-title--cleared {
    color: #2e7d32;
}

.fraud-review-meta {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #555;
}

.fraud-review-note {
    margin: 0 0 0.75rem 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid rgba(76, 175, 80, 0.5);
    background: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    color: #444;
    white-space: pre-wrap;
}

.fraud-review-original {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.fraud-review-original summary {
    cursor: pointer;
    color: #666;
    margin-bottom: 0.5rem;
}

.fraud-review-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.fraud-review-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fraud-review-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}

.fraud-review-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font: inherit;
    font-size: 0.875rem;
    resize: vertical;
}

.fraud-review-form-actions {
    display: flex;
    gap: 0.5rem;
}

.fraud-review-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.fraud-review-error {
    margin: 0.25rem 0 0 0;
    color: #c62828;
    font-size: 0.85rem;
}

/* Stored Only badge — neutral grey tint */
.badge-stored-only {
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
    border: 1px solid rgba(107, 114, 128, 0.25);
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* ========================================
   DEAL STAGE BADGES -- AUTOCOMPLETE VARIANT
   ======================================== */

/* Compact pill shown after the deal name in autocomplete suggestions */
.stage-badge--autocomplete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-left: 8px;
    vertical-align: middle;
}

.stage-badge--autocomplete::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

/* Per-stage colours — progress from grey (Lead) through blue/purple
   (qualification) to green (active/paid out), red for terminal/dormant. */
.stage-badge--lead {
    background: rgba(156, 163, 175, 0.15);
    color: #6b7280;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.stage-badge--qualified-lead {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.stage-badge--submitted-to-credit {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.stage-badge--approved-by-credit {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.stage-badge--term-sheet-signed {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.stage-badge--paid-out {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.stage-badge--completed {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.25);
}

.stage-badge--dormant {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.stage-badge--dormant-dnq {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .fraud-indicators-section {
        padding: 1rem;
        margin-top: 1rem;
    }

    .fraud-flag-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }

    .fraud-flag-badge-inline {
        font-size: 0.65rem;
        padding: 0.1rem 0.3rem;
    }

    .fraud-section-title {
        font-size: 0.9rem;
    }

    .fraud-flag-description {
        font-size: 0.8rem;
    }
}
