/**
 * Entity Queue Styles
 * Styling for pending entity confirmation modal
 */

/* =========================================================================
   MODAL CONTAINER
   ========================================================================= */

#entityQueueModal,
#entitySelectModal,
#entityCreateModal,
#entityBatchModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
}

#entityQueueModal .modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

#entityBatchModal .modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

#entitySelectModal .modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#entityCreateModal .modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#entitySelectContent,
#entityBatchContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* =========================================================================
   MODAL HEADER
   ========================================================================= */

.eq-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.eq-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.eq-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.eq-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =========================================================================
   MODAL BODY / CONTENT
   ========================================================================= */

.eq-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#entityQueueContent {
    flex: 1;
    overflow: auto;
    padding: 12px;
}

/* =========================================================================
   LOADING & EMPTY STATES
   ========================================================================= */

.eq-loading,
.eq-error,
.eq-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.eq-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: eq-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes eq-spin {
    to {
        transform: rotate(360deg);
    }
}

.eq-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.eq-empty h3 {
    margin: 0 0 8px;
    color: var(--text-primary);
}

.eq-empty p {
    margin: 0;
}

/* =========================================================================
   TOOLBAR
   ========================================================================= */

.eq-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.eq-stats {
    display: flex;
    gap: 16px;
}

.eq-stat {
    font-size: 13px;
    color: var(--text-secondary);
}

.eq-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eq-filters select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: white;
}

/* =========================================================================
   SECTION HEADERS (Batch Groups vs Individual Items)
   ========================================================================= */

.eq-section {
    margin-bottom: 20px;
}

.eq-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* =========================================================================
   QUEUE LIST - CLICKABLE ITEMS
   ========================================================================= */

.eq-list {
    /* No padding here since sections handle spacing */
}

.eq-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.eq-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.eq-item:active {
    transform: scale(0.995);
}

/* Individual items have dashed border */
.eq-item-individual {
    background: var(--bg-secondary);
    border-style: dashed;
}

.eq-item-main {
    flex: 1;
    min-width: 0;
}

.eq-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

/* Chevron indicator for clickable items */
.eq-item-chevron {
    font-size: 20px;
    color: var(--text-muted);
    margin-left: 12px;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.eq-item:hover .eq-item-chevron {
    color: var(--primary-color);
    transform: translateX(2px);
}

.eq-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}

.eq-type-insurance_company {
    background: var(--info-light);
    color: var(--info-color);
}

.eq-type-lab {
    background: #f3e5f5;
    color: #7b1fa2;
}

.eq-type-specialist {
    background: #e8f5e9;
    color: #388e3c;
}

.eq-type-vendor {
    background: #fff3e0;
    color: #f57c00;
}

.eq-doc-count {
    font-size: 12px;
    color: var(--text-muted);
}

.eq-extracted-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.eq-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.eq-arrow {
    color: var(--text-muted);
}

.eq-suggested-name {
    color: var(--success-color);
    font-weight: 500;
}

.eq-confidence {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.eq-confidence-high {
    background: var(--success-light);
    color: var(--success-dark);
}

.eq-confidence-medium {
    background: var(--warning-muted);
    color: #856404;
}

.eq-confidence-low {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.eq-no-suggestion {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* =========================================================================
   BATCH CONFIRMATION MODAL
   ========================================================================= */

.eq-batch-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.eq-batch-header h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.eq-batch-suggestion {
    font-size: 14px;
    color: var(--success-color);
}

.eq-batch-suggestion strong {
    color: var(--success-dark);
}

.eq-batch-no-suggestion {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* Document list container */
.eq-batch-documents {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
}

.eq-batch-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.eq-selected-count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.eq-document-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 350px;
}

/* Individual document row */
.eq-document-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: background var(--transition-fast);
}

.eq-document-row:hover {
    background: var(--bg-hover);
}

.eq-document-row.selected {
    background: var(--primary-light);
}

/* Checkbox styling */
.eq-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.eq-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.eq-doc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.eq-doc-brief {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eq-doc-filename {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Open document link */
.btn-link {
    background: none;
    border: none;
    color: var(--info-color);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.btn-link:hover {
    background: var(--info-light);
    text-decoration: underline;
}

/* Batch action buttons */
.eq-batch-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.eq-batch-actions button {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.eq-batch-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.eq-batch-actions .btn-success {
    background: var(--success-color);
    color: white;
}

.eq-batch-actions .btn-success:hover:not(:disabled) {
    background: var(--success-dark);
}

.eq-batch-actions .btn-primary {
    background: var(--primary-color);
    color: white;
}

.eq-batch-actions .btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.eq-batch-actions .btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.eq-batch-actions .btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
}

.eq-batch-actions .btn-danger-outline {
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.eq-batch-actions .btn-danger-outline:hover:not(:disabled) {
    background: var(--danger-color);
    color: white;
}

/* =========================================================================
   DOCUMENT LINKS (legacy - keep for backwards compatibility)
   ========================================================================= */

.eq-doc-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.eq-insurer-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.eq-insurer-label::after {
    content: '—';
    margin: 0 8px;
    color: var(--text-muted);
}

.eq-doc-link {
    color: var(--info-color, #3498db);
    text-decoration: none;
    font-size: 13px;
    padding: 2px 6px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 4px;
    transition: background var(--transition-fast);
}

.eq-doc-link:hover {
    background: rgba(52, 152, 219, 0.2);
    text-decoration: underline;
}

.eq-doc-more {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    margin-left: 4px;
}

/* =========================================================================
   MODAL FOOTER
   ========================================================================= */

.eq-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* =========================================================================
   ENTITY SELECT MODAL
   ========================================================================= */

.eq-select-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.eq-select-header p {
    margin: 0 0 12px;
    color: var(--text-secondary);
}

.eq-select-header strong {
    color: var(--text-primary);
}

.eq-select-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 4px;
}

.eq-entity-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

.eq-entity-option {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.eq-entity-option:hover {
    background: var(--primary-light);
}

.eq-entity-name {
    font-size: 14px;
    color: var(--text-primary);
}

.eq-no-entities {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* =========================================================================
   CREATE NEW ENTITY MODAL
   ========================================================================= */

.eq-create-form {
    padding: 20px;
}

.eq-create-form p {
    margin: 0 0 8px;
    color: var(--text-secondary);
}

.eq-create-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.eq-create-form .form-group {
    margin-bottom: 16px;
}

.eq-create-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.eq-create-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    box-sizing: border-box;
}

.eq-create-form .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.eq-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.eq-create-actions button {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.eq-create-actions .btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.eq-create-actions .btn-secondary:hover {
    background: var(--bg-hover);
}

.eq-create-actions .btn-primary {
    background: var(--primary-color);
    color: white;
}

.eq-create-actions .btn-primary:hover {
    background: var(--primary-hover);
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 768px) {
    #entityBatchModal .modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

    .eq-batch-actions {
        flex-direction: column;
    }

    .eq-batch-actions button {
        width: 100%;
    }

    .eq-document-list {
        max-height: 250px;
    }
}

@media (max-width: 640px) {
    .eq-item {
        flex-direction: column;
        align-items: stretch;
    }

    .eq-item-chevron {
        display: none;
    }

    .eq-item-actions {
        margin-left: 0;
        margin-top: 12px;
        justify-content: flex-end;
    }

    .eq-toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .eq-filters {
        justify-content: space-between;
    }

    .eq-doc-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

    .eq-doc-link {
        color: #3498db;
        text-decoration: none;
        font-size: 0.85rem;
        padding: 0.15rem 0.4rem;
        background: rgba(52, 152, 219, 0.1);
        border-radius: 4px;
    }

    .eq-doc-link:hover {
        background: rgba(52, 152, 219, 0.2);
        text-decoration: underline;
    }

    .eq-doc-more {
        color: #7f8c8d;
        font-size: 0.8rem;
        font-style: italic;
    }

    .eq-batch-select-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}