﻿/* claims-cards.css - Claims cards alternate view */

/* ========== Claims Cards View Styles ========== */
/* Card/tile view container + header are kept VISUALLY IDENTICAL to the
   list view's .claims-table-container / .claims-table-header so the top of
   the data region looks the same in both modes (same beige #F4F0E9 band,
   same card chrome). These rules live here (not claims.css) because
   claims-cards.css loads later and is the authoritative source for the
   card view — editing it in claims.css alone got overridden. */
.claims-cards-container {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e5e1da;
}

.claims-cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #F4F0E9;
    border-radius: 1rem 1rem 0 0;
}

.claims-cards-header h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #166534;
    line-height: 1.3;
}

.claims-cards-grid {
    display: grid;
    /* Auto-fill fits as many 340px+ columns as fit — prevents overflow when
       sidebar is expanded and lets the grid reflow responsively at every
       width instead of snapping between fixed breakpoints. */
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
    padding: 1rem;
}
@media (max-width: 900px) { .claims-cards-grid { grid-template-columns: 1fr; } }

.claim-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 14px rgba(0,0,0,0.05);
    border: 1px solid #e2e5e9;
    overflow: visible;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.claim-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(30, 99, 50,0.12), 0 4px 12px rgba(0,0,0,0.08);
}

/* Status accent — top + left are real borders on the SAME box, so they
   always meet cleanly at the rounded corner. Solid color (no gradient)
   keeps the corner color consistent. Right/bottom stay muted. */
.claim-card.status-funded {
    background: linear-gradient(145deg, #eff5f1 0%, #e2ede6 100%);
    border-color: #cfe0d5;
    border-top: 4px solid #1e6332;
    border-left: 4px solid #1e6332;
}

.claim-card.status-in-process {
    background: linear-gradient(145deg, #faf6ef 0%, #f3ecdf 100%);
    border-color: #e8dcc4;
    border-top: 4px solid #c19a6b;
    border-left: 4px solid #c19a6b;
}

.claim-card.status-closed {
    background: linear-gradient(145deg, #f3f5f5 0%, #e6e9e9 100%);
    border-color: #d3d9d8;
    border-top: 4px solid #475453;
    border-left: 4px solid #475453;
}

.claim-card.status-withdrawn {
    background: linear-gradient(145deg, #fdecec 0%, #f9dede 100%);
    border-color: #f3c4c4;
    border-top: 4px solid #db0000;
    border-left: 4px solid #db0000;
}

.claim-card-header {
    padding: 1rem 1rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.claim-card-id {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-family: 'SF Mono', monospace;
}

.claim-card-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.claim-card-status.funded {
    background: linear-gradient(135deg, #e7f0ea, #d6e6dc);
    color: #1e6332;
}

.claim-card-status.in-process {
    background: linear-gradient(135deg, #f6efe4, #ecdcc2);
    color: #8a6536;
}

.claim-card-status.closed {
    background: linear-gradient(135deg, #eceeef, #dde1e1);
    color: #475453;
}

.claim-card-status.withdrawn {
    background: linear-gradient(135deg, #fbe9e9, #f6d6d6);
    color: #b00000;
}

.claim-card-body {
    padding: 0 1rem 0.75rem;
    display: flex;
    gap: 1rem;
    flex: 1;
}

.claim-card-info {
    flex: 1;
    min-width: 0;
}

.claim-card-ledger {
    width: 110px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    padding: 0.5rem;
    border: 1px dashed rgba(0,0,0,0.1);
}

.claim-ledger-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.7rem;
}

.claim-ledger-row:not(:last-child) {
    border-bottom: 1px dashed #e5e7eb;
}

.claim-ledger-label {
    color: #6b7280;
}

.claim-ledger-value {
    font-weight: 600;
    font-family: 'SF Mono', monospace;
    font-size: 0.75rem;
}

.claim-ledger-row.gross .claim-ledger-value {
    color: #374151;
}

.claim-ledger-row.fp .claim-ledger-value {
    color: #1E6332;
}

.claim-ledger-row.fee .claim-ledger-label,
.claim-ledger-row.fee .claim-ledger-value,
.claim-ledger-row.ckded .claim-ledger-label,
.claim-ledger-row.ckded .claim-ledger-value {
    color: #4b5563;
}

.claim-ledger-row.net {
    border-top: 2px solid #1E6332;
    border-bottom: none;
    margin-top: 0.25rem;
    padding-top: 0.35rem;
}

.claim-ledger-row.net .claim-ledger-label {
    color: #1E6332;
    font-weight: 600;
}

.claim-ledger-row.net .claim-ledger-value {
    color: #1E6332;
    font-size: 0.85rem;
    font-weight: 700;
}

.claim-card-decedent {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.claim-card-decedent i {
    color: #6b7280;
    font-size: 0.8rem;
}

.claim-card-info-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.claim-card-info-row i {
    width: 14px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.7rem;
}

.claim-card-info-row strong {
    color: #374151;
}

.claim-card-policies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.claim-card-policy-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: #ffffff;
    border: 1px solid rgba(22, 101, 52, 0.18);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #166534;
    max-width: 100%;
}

.claim-card-policy-chip .ic-badge {
    gap: 7px;
    line-height: 1.2;
}

.claim-card-policy-chip .ic-logo {
    height: 44px;
    min-width: 56px;
    max-width: 100px;
}

.claim-card-policy-chip .ic-logo-fallback {
    font-size: 22px;
    color: #86efac;
}

.claim-card-policy-chip i {
    font-size: 0.55rem;
}

.claim-card-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 8px;
    margin-top: 0.75rem;
}

.claim-card-amount-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.claim-card-amount-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1E6332;
}

.claim-card-footer {
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.claim-card-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.claim-card-btn.view {
    background: #1E6332;
    color: #fff;
}

.claim-card-btn.view:hover {
    background: #214A3E;
}

.claim-card-btn.message {
    background: #3b82f6;
    color: #fff;
}

.claim-card-btn.message:hover {
    background: #2563eb;
}

.claim-card-btn.docs {
    background: #f3f4f6;
    color: #374151;
}

.claim-card-btn.docs:hover {
    background: #e5e7eb;
}

/* Dynamic Message Button States for Cards */
.claim-card-btn.claim-card-msg-new {
    background: #f3f4f6;
    color: #6b7280;
}

.claim-card-btn.claim-card-msg-new:hover {
    background: #e5e7eb;
    color: #374151;
}

.claim-card-btn.claim-card-msg-active {
    background: #3b82f6;
    color: #fff;
}

.claim-card-btn.claim-card-msg-active:hover {
    background: #2563eb;
}

.claim-card-btn.claim-card-msg-unread {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    position: relative;
    animation: claim-card-pulse 2s infinite;
}

.claim-card-btn.claim-card-msg-unread:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

@keyframes claim-card-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}

.claim-card-msg-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-bounce 0.5s ease;
}

@keyframes badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Claim Status Step Indicator for Cards */
.claim-card-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.5);
    border-top: 1px dashed rgba(0,0,0,0.1);
}

.claim-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.claim-step-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 1;
}

.claim-step.pending .claim-step-dot {
    background: #f3f4f6;
    color: #9ca3af;
    border: 2px solid #d1d5db;
}

.claim-step.current .claim-step-dot {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: 2px solid #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.claim-step.completed .claim-step-dot {
    background: linear-gradient(135deg, #18A74B, #2F8542);
    color: #fff;
    border: 2px solid #18A74B;
}

.claim-step-label {
    font-size: 0.55rem;
    font-weight: 500;
    margin-top: 0.25rem;
    text-align: center;
}

.claim-step.pending .claim-step-label {
    color: #9ca3af;
}

.claim-step.current .claim-step-label {
    color: #3b82f6;
    font-weight: 600;
}

.claim-step.completed .claim-step-label {
    color: #2F8542;
}

.claim-step-date {
    font-size: 0.65rem;
    color: #6b7280;
    text-align: center;
    line-height: 1;
    margin-top: 1px;
    white-space: nowrap;
}

.claim-step.current .claim-step-date {
    color: #3b82f6;
    font-weight: 500;
}

.claim-step.completed .claim-step-date {
    color: #2F8542;
}

.claim-step-connector {
    position: absolute;
    top: 10px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.claim-step:last-child .claim-step-connector {
    display: none;
}

.claim-step.completed .claim-step-connector {
    background: linear-gradient(90deg, #18A74B, #2F8542);
}

.claim-step.current .claim-step-connector {
    background: linear-gradient(90deg, #3b82f6 50%, #e5e7eb 50%);
}

.claim-step-biz-days {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    color: #6b7280;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0 4px;
    line-height: 14px;
    border-radius: 7px;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
    z-index: 1;
}

.claim-step.completed .claim-step-biz-days {
    color: #2F8542;
    border-color: #E8DFD0;
}

/* Withdrawn claims: 2-step tracker */
.withdrawn-steps {
    justify-content: center;
    gap: 0;
}

.claim-step.current.withdrawn .claim-step-dot {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #fff !important;
    border: 2px solid #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.claim-step.current.withdrawn .claim-step-label {
    color: #dc2626 !important;
    font-weight: 600;
}

.claim-step.current.withdrawn .claim-step-date {
    color: #dc2626 !important;
}

/* Connector between Processing → Withdrawn */
.withdrawn-steps .claim-step.completed .claim-step-connector {
    background: linear-gradient(90deg, #18A74B, #ef4444);
}

/* Claim Card Inline Financial Calculation */
.claim-card-calc {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.5rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 8px;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.claim-calc-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0.5rem;
}

.claim-calc-label {
    font-size: 0.55rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.15rem;
}

.claim-calc-value {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', monospace;
}

.claim-calc-item.gross .claim-calc-value {
    color: #374151;
}

.claim-calc-item.fee .claim-calc-value {
    color: #dc2626;
}

.claim-calc-item.net .claim-calc-value {
    color: #1E6332;
    font-size: 0.95rem;
    font-weight: 700;
}

.claim-calc-operator {
    font-size: 0.9rem;
    font-weight: 600;
    color: #9ca3af;
    padding: 0 0.15rem;
}

.claim-calc-operator.minus {
    color: #dc2626;
}

.claim-calc-operator.equals {
    color: #1E6332;
}

/* AI Anomaly Badge for Claim Cards */
.claim-card-ai-alert {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 3px solid #fff;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    animation: ai-alert-glow 2s infinite;
}

.claim-card-ai-alert:hover {
    transform: translateX(-50%) scale(1.08);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
}

.claim-card-ai-alert i {
    font-size: 0.85rem;
    animation: ai-robot-bounce 1s infinite;
}

@keyframes ai-alert-glow {
    0%, 100% { box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4), 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4), 0 0 0 6px rgba(245, 158, 11, 0); }
}

@keyframes ai-robot-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.claim-card-ai-alert.critical {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
    animation: ai-alert-critical 1.5s infinite;
}

.claim-card-ai-alert.critical i {
    animation: ai-robot-shake 0.5s infinite;
}

@keyframes ai-alert-critical {
    0%, 100% { box-shadow: 0 2px 8px rgba(220, 38, 38, 0.5), 0 0 0 0 rgba(220, 38, 38, 0.5); }
    50% { box-shadow: 0 2px 8px rgba(220, 38, 38, 0.5), 0 0 0 8px rgba(220, 38, 38, 0); }
}

@keyframes ai-robot-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.claim-card-ai-alert.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    animation: none;
}

.claim-card-ai-alert.info i {
    animation: none;
}

/* Cards with AI alerts - no margin to keep grid alignment */
.claim-card.has-ai-alert .claim-card-header {
    padding-top: 0.75rem;
}

/* AI Alert Tooltip - appears BELOW the badge */
.claim-card-ai-alert .ai-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 12px;
    padding: 0.85rem 1rem;
    background: linear-gradient(145deg, #1f2937, #111827);
    color: #fff;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
    text-shadow: none;
    min-width: 240px;
    max-width: 300px;
    white-space: normal;
    text-align: left;
    line-height: 1.5;
    pointer-events: none;
}

/* Arrow pointing UP to the badge */
.claim-card-ai-alert .ai-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-bottom-color: #1f2937;
}

.claim-card-ai-alert:hover .ai-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(4px);
    pointer-events: auto;
}

.ai-tooltip-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.ai-tooltip-title i {
    font-size: 1rem;
}

.ai-tooltip-content {
    color: #d1d5db;
}

.ai-tooltip-action {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #60a5fa;
    font-size: 0.7rem;
}

.ai-tooltip-action i {
    margin-right: 0.25rem;
}
