/**
 * Low Confidence Modal - Redesigned to match CodeIQ/RiQ Modal Excellence
 *
 * Design: Matches the magenta/purple gradient branding from RiQModal
 * - Gradient header: #9a4054 → #c4576a
 * - Professional, polished, attention-grabbing
 * - Reassuring but prominent for critical review
 */

/* ============================================
   MODAL OVERLAY & CONTAINER
   ============================================ */

.low-confidence-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(6px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100000 !important;
    animation: fadeIn 0.25s ease-out !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.low-confidence-modal {
    background: white !important;
    border-radius: 16px !important;
    max-width: 920px !important;
    width: 95% !important;
    max-height: 90vh !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   BRANDED GRADIENT HEADER - Matches RiQ/CodeIQ
   ============================================ */

.low-confidence-modal .codeiq-modal-header {
    background: linear-gradient(135deg, #9a4054 0%, #c4576a 100%) !important;
    padding: 32px 32px 28px 32px !important;
    border-bottom: none !important;
    position: relative !important;
}

/* Header Content Layout */
.low-confidence-modal .codeiq-modal-header::before {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 100%) !important;
}

/* Logo Styling */
.low-confidence-modal .codeiq-modal-header img {
    height: 36px !important;
    width: auto !important;
    margin-bottom: 20px !important;
    filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2)) !important;
}

/* Warning Icon */
.low-confidence-modal .codeiq-modal-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 56px !important;
    height: 56px !important;
    margin: 0 auto 16px auto !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 50% !important;
    backdrop-filter: blur(10px) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

.low-confidence-modal .codeiq-modal-icon svg {
    width: 32px !important;
    height: 32px !important;
    stroke: white !important;
    stroke-width: 2.5 !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2)) !important;
}

/* Title */
.low-confidence-modal .codeiq-modal-title {
    font-size: 28px !important;
    font-weight: 700 !important;
    color: white !important;
    text-align: center !important;
    margin: 0 !important;
    letter-spacing: -0.02em !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

/* Close Button */
.low-confidence-modal .codeiq-modal-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(10px) !important;
}

.low-confidence-modal .codeiq-modal-close:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: rotate(90deg) !important;
}

.low-confidence-modal .codeiq-modal-close svg {
    width: 18px !important;
    height: 18px !important;
}

/* ============================================
   MODAL BODY - Clean & Organized
   ============================================ */

.low-confidence-modal .codeiq-modal-body {
    padding: 0 !important;
    overflow-y: auto !important;
    flex: 1 !important;
    max-height: calc(90vh - 250px) !important;
}

/* Custom Scrollbar */
.low-confidence-modal .codeiq-modal-body::-webkit-scrollbar {
    width: 8px !important;
}

.low-confidence-modal .codeiq-modal-body::-webkit-scrollbar-track {
    background: #f5f2ed !important;
}

.low-confidence-modal .codeiq-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #9a4054 0%, #c4576a 100%) !important;
    border-radius: 4px !important;
}

.low-confidence-modal .codeiq-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #c4576a 0%, #9a4054 100%) !important;
}

/* ============================================
   CONFIDENCE SUMMARY - Enhanced Design
   ============================================ */

.confidence-summary {
    background: linear-gradient(135deg, #fff5fc 0%, #f9f5ff 100%) !important;
    border: 2px solid rgba(196, 87, 106, 0.2) !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    padding: 28px 32px !important;
    margin: 0 !important;
}

.summary-header h4 {
    margin: 0 0 12px 0 !important;
    color: #1a1a1a !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
}

.summary-header h4 svg {
    flex-shrink: 0 !important;
    stroke: #c4576a !important;
}

.summary-header p {
    margin: 0 0 20px 0 !important;
    color: #6b6b6b !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
}

.helpful-tips {
    background: linear-gradient(135deg, #fdf5f7 0%, #fdf5f7 100%) !important;
    border: 1px solid #e9d5ff !important;
    border-radius: 10px !important;
    padding: 14px 18px !important;
    margin-top: 16px !important;
    font-size: 14px !important;
    color: #9a4054 !important;
    line-height: 1.6 !important;
}

/* Confidence Breakdown Pills */
.confidence-breakdown {
    display: flex !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
    flex-wrap: wrap !important;
}

.breakdown-item {
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.breakdown-item.critical {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%) !important;
    color: #dc2626 !important;
    border: 2px solid #fca5a5 !important;
}

.breakdown-item.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    color: #d97706 !important;
    border: 2px solid #fcd34d !important;
}

/* Progress Indicator */
.progress-indicator {
    margin-top: 20px !important;
}

.progress-text {
    font-size: 14px !important;
    color: #3d3d3d !important;
    margin-bottom: 10px !important;
    font-weight: 600 !important;
}

.progress-text #corrected-count {
    color: #c4576a !important;
    font-weight: 700 !important;
}

.remaining-text {
    font-size: 13px !important;
    color: #6b6b6b !important;
    margin-left: 8px !important;
    font-weight: 500 !important;
}

.progress-bar {
    height: 10px !important;
    background: #d4d0c8 !important;
    border-radius: 5px !important;
    overflow: hidden !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.progress-fill {
    height: 100% !important;
    background: linear-gradient(90deg, #9a4054 0%, #c4576a 100%) !important;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 5px !important;
    box-shadow: 0 0 10px rgba(196, 87, 106, 0.4) !important;
}

/* ============================================
   TRANSACTION CARDS - Refined Design
   ============================================ */

.transactions-container {
    padding: 24px 32px !important;
}

.transactions-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    max-height: none !important;
    overflow: visible !important;
}

.transaction-card {
    border: 2px solid #d4d0c8 !important;
    border-radius: 12px !important;
    padding: 20px !important;
    background: white !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
}

.transaction-card::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 5px !important;
    border-radius: 12px 0 0 12px !important;
}

.transaction-card.critical::before {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%) !important;
}

.transaction-card.warning::before {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%) !important;
}

.transaction-card.corrected::before {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
}

.transaction-card:hover {
    border-color: #c4576a !important;
    box-shadow: 0 4px 16px rgba(196, 87, 106, 0.15) !important;
    transform: translateY(-2px) !important;
}

.transaction-card.corrected {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border-color: #86efac !important;
}

/* Transaction Header */
.transaction-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 14px !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
}

.confidence-badge {
    font-size: 11px !important;
    padding: 5px 12px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    color: white !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.confidence-badge.critical {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}

.confidence-badge.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

.confidence-badge.corrected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.amount {
    font-weight: 700 !important;
    font-size: 16px !important;
    font-family: 'SF Mono', monospace !important;
}

.amount.debit {
    color: #dc2626 !important;
}

.amount.credit {
    color: #10b981 !important;
}

/* Transaction Details */
.transaction-details {
    margin-bottom: 14px !important;
}

.description {
    font-weight: 600 !important;
    color: #1a1a1a !important;
    margin-bottom: 6px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.bank-account {
    font-size: 12px !important;
    color: #6b6b6b !important;
}

/* Current Coding Display */
.current-coding {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    background: linear-gradient(135deg, #fdf5f7 0%, #fdf5f7 100%) !important;
    border-radius: 8px !important;
    border: 1px solid #e9d5ff !important;
    font-size: 13px !important;
    margin-bottom: 14px !important;
    flex-wrap: wrap !important;
}

.current-label {
    color: #6b6b6b !important;
    font-weight: 600 !important;
}

.current-account {
    color: #9a4054 !important;
    font-weight: 700 !important;
}

.coding-method {
    color: #999999 !important;
    font-style: italic !important;
    font-size: 12px !important;
}

/* ============================================
   CORRECTION CONTROLS
   ============================================ */

.correction-controls {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
    flex-wrap: wrap !important;
}

.dropdown-container {
    flex: 1 !important;
    min-width: 220px !important;
}

.modal-account-dropdown {
    width: 100% !important;
    padding: 10px 14px !important;
    border: 2px solid #c4c0b8 !important;
    border-radius: 8px !important;
    background: white !important;
    font-size: 14px !important;
    color: #1a1a1a !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
}

.modal-account-dropdown:focus {
    outline: none !important;
    border-color: #c4576a !important;
    box-shadow: 0 0 0 3px rgba(196, 87, 106, 0.1) !important;
}

.modal-account-dropdown:disabled {
    background: #f5f2ed !important;
    color: #999999 !important;
    cursor: not-allowed !important;
}

.action-buttons {
    display: flex !important;
    gap: 8px !important;
}

.apply-btn {
    padding: 10px 20px !important;
    background: linear-gradient(135deg, #9a4054 0%, #c4576a 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 8px rgba(196, 87, 106, 0.25) !important;
}

.apply-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #c4576a 0%, #9a4054 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 14px rgba(196, 87, 106, 0.35) !important;
}

.apply-btn:disabled {
    background: #c4c0b8 !important;
    color: #999999 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Apply to Similar Button */
.similar-actions {
    margin-bottom: 12px !important;
}

.apply-similar-btn {
    width: 100% !important;
    padding: 10px 16px !important;
    background: linear-gradient(135deg, #fdf5f7 0%, #fae8ec 100%) !important;
    color: #9a4054 !important;
    border: 2px solid #e9d5ff !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-weight: 600 !important;
}

.apply-similar-btn:hover {
    background: linear-gradient(135deg, #fae8ec 0%, #e9d5ff 100%) !important;
    border-color: #d8b4fe !important;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2) !important;
}

.similar-pattern {
    font-weight: 700 !important;
}

.similar-count {
    font-weight: 700 !important;
    color: #c4576a !important;
}

/* Learning Feedback */
.learning-feedback {
    padding: 10px 14px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
}

.feedback-content {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.feedback-content.loading {
    background: linear-gradient(135deg, #fdf5f7 0%, #fae8ec 100%) !important;
    color: #9a4054 !important;
    border: 1px solid #e9d5ff !important;
}

.feedback-content.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    color: #059669 !important;
    border: 1px solid #86efac !important;
}

.feedback-content.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%) !important;
    color: #dc2626 !important;
    border: 1px solid #fca5a5 !important;
}

/* Show More Button */
.show-more-container {
    text-align: center !important;
    margin-top: 20px !important;
    padding-top: 20px !important;
    border-top: 2px solid #d4d0c8 !important;
}

.show-more-btn {
    padding: 12px 28px !important;
    background: linear-gradient(135deg, #faf8f5 0%, #f5f2ed 100%) !important;
    color: #3d3d3d !important;
    border: 2px solid #c4c0b8 !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-weight: 600 !important;
}

.show-more-btn:hover {
    background: linear-gradient(135deg, #f5f2ed 0%, #d4d0c8 100%) !important;
    border-color: #c4576a !important;
    color: #c4576a !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(196, 87, 106, 0.15) !important;
}

/* ============================================
   MODAL FOOTER - Branded Buttons
   ============================================ */

.low-confidence-modal .codeiq-modal-footer {
    padding: 20px 32px !important;
    border-top: 2px solid #d4d0c8 !important;
    background: linear-gradient(to top, #faf8f5 0%, #ffffff 100%) !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
}

.low-confidence-modal .codeiq-modal-btn {
    font-size: 15px !important;
    padding: 12px 28px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.2s ease !important;
}

.low-confidence-modal .codeiq-modal-btn-secondary {
    background: white !important;
    color: #6b6b6b !important;
    border: 2px solid #c4c0b8 !important;
}

.low-confidence-modal .codeiq-modal-btn-secondary:hover {
    background: #f5f2ed !important;
    border-color: #999999 !important;
    color: #1a1a1a !important;
}

.low-confidence-modal .codeiq-modal-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.low-confidence-modal .codeiq-modal-btn-primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4) !important;
}

.low-confidence-modal .codeiq-modal-btn svg {
    width: 18px !important;
    height: 18px !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .low-confidence-modal {
        width: 98% !important;
        max-height: 95vh !important;
    }

    .low-confidence-modal .codeiq-modal-header {
        padding: 24px 20px 20px 20px !important;
    }

    .low-confidence-modal .codeiq-modal-title {
        font-size: 22px !important;
    }

    .confidence-summary {
        padding: 20px 20px !important;
    }

    .transactions-container {
        padding: 20px 20px !important;
    }

    .transaction-card {
        padding: 16px !important;
    }

    .low-confidence-modal .codeiq-modal-footer {
        padding: 16px 20px !important;
        flex-direction: column !important;
    }

    .low-confidence-modal .codeiq-modal-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .correction-controls {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .dropdown-container {
        min-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .low-confidence-modal .codeiq-modal-icon {
        width: 48px !important;
        height: 48px !important;
    }

    .low-confidence-modal .codeiq-modal-icon svg {
        width: 28px !important;
        height: 28px !important;
    }

    .low-confidence-modal .codeiq-modal-title {
        font-size: 20px !important;
    }

    .confidence-breakdown {
        flex-direction: column !important;
    }

    .transaction-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}
