/* ==========================================================================
   TERMOVA - CONTRACT INBOX & SMART TRIAGE STYLES
   ========================================================================== */

/* Main Inbox View Container */
.inbox-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    gap: 1.5rem;
    background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.95), rgba(10, 15, 30, 0.98));
}

/* ──── Top KPI Stats Bar ──── */
.inbox-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.inbox-stat-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.inbox-stat-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.15);
}

.inbox-stat-info {
    display: flex;
    flex-direction: column;
}

.inbox-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.inbox-stat-val {
    font-size: 1.6rem;
    font-weight: 700;
    color: #f8fafc;
}

.inbox-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon-urgent {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.stat-icon-unreviewed {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.stat-icon-progress {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stat-icon-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ──── Filter & Search Bar ──── */
.inbox-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
}

.inbox-status-tabs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.25rem;
    border-radius: 8px;
}

.inbox-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.inbox-tab-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.inbox-tab-btn.active {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.tab-badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.45rem;
    border-radius: 12px;
    font-size: 0.7rem;
}

.inbox-controls-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inbox-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.inbox-search-input {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.45rem 0.85rem 0.45rem 2rem;
    color: #f1f5f9;
    font-size: 0.82rem;
    outline: none;
    width: 200px;
    transition: all 0.2s ease;
}

.inbox-search-input:focus {
    border-color: #6366f1;
    width: 250px;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.inbox-search-icon {
    position: absolute;
    left: 0.65rem;
    color: #64748b;
    font-size: 0.8rem;
    pointer-events: none;
}

.inbox-select {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    color: #f1f5f9;
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

.inbox-select:focus {
    border-color: #6366f1;
}

.inbox-btn-rules {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.inbox-btn-rules:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #ffffff;
}

/* ──── Bulk Actions Bar ──── */
.inbox-bulk-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.9), rgba(124, 58, 237, 0.9));
    color: #ffffff;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    animation: slideDown 0.2s ease;
}

.inbox-bulk-bar.visible {
    display: flex;
}

.bulk-actions-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bulk-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bulk-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ──── Contract Cards Feed ──── */
.inbox-list-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.inbox-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid #64748b; /* dynamic urgency color */
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.inbox-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.inbox-card.urgency-high {
    border-left-color: #f43f5e;
}

.inbox-card.urgency-med {
    border-left-color: #f59e0b;
}

.inbox-card.urgency-low {
    border-left-color: #10b981;
}

.inbox-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.inbox-card-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.inbox-card-select {
    cursor: pointer;
    accent-color: #6366f1;
    width: 16px;
    height: 16px;
}

.inbox-card-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.inbox-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    line-height: 1.3;
}

.inbox-card-title:hover {
    color: #818cf8;
}

.inbox-card-subtitle {
    font-size: 0.72rem;
    color: #64748b;
    font-family: var(--font-mono, monospace);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 650px;
}

.inbox-type-badge {
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.badge-msa { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-nda { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-sow { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-amendment { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-lease { background: rgba(236, 72, 153, 0.18); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.badge-license { background: rgba(14, 165, 233, 0.18); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-vendor { background: rgba(139, 92, 246, 0.18); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-services { background: rgba(20, 184, 166, 0.18); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.3); }
.badge-employment { background: rgba(249, 115, 22, 0.18); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-other { background: rgba(100, 116, 139, 0.18); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }

.value-highlight {
    color: #38bdf8;
    font-weight: 700;
    background: rgba(14, 165, 233, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(14, 165, 233, 0.25);
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
}

.inbox-card-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Urgency Meter */
.inbox-urgency-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.urgency-pill-high { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.3); }
.urgency-pill-med { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.urgency-pill-low { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Card Body Summary */
.inbox-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-left: 2rem;
}

.inbox-summary-preview {
    font-size: 0.83rem;
    color: #cbd5e1;
    line-height: 1.4;
}

.inbox-summary-bullets {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.inbox-summary-bullets li {
    margin-bottom: 0.2rem;
}

/* Card Bottom Metadata & Actions */
.inbox-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 2rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.inbox-tags-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.inbox-tag-pill {
    background: rgba(51, 65, 85, 0.6);
    color: #94a3b8;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.inbox-tag-pill.urgent { background: rgba(244, 63, 94, 0.2); color: #fda4af; border-color: rgba(244, 63, 94, 0.3); }
.inbox-tag-pill.high-value { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.inbox-tag-pill.requires-legal { background: rgba(245, 158, 11, 0.2); color: #fde68a; border-color: rgba(245, 158, 11, 0.3); }

.inbox-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inbox-action-btn {
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.inbox-action-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #ffffff;
    border-color: rgba(99, 102, 241, 0.4);
}

/* ──── Slide-Over Detail Panel ──── */
.inbox-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.inbox-drawer-overlay.open {
    display: block;
    opacity: 1;
}

.inbox-drawer {
    position: fixed;
    top: 0;
    right: -550px;
    width: 520px;
    max-width: 90vw;
    height: 100%;
    background: #0f172a;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.inbox-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.5);
}

.drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fafc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.drawer-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    transition: all 0.2s ease;
}

.drawer-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.drawer-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #818cf8;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.urgency-breakdown-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.factor-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.factor-pts {
    font-weight: 600;
    color: #818cf8;
}

.drawer-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Animations */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ──── Mobile & Tablet Responsiveness for Inbox ──── */
@media screen and (max-width: 1024px) {
    .inbox-detail-drawer {
        width: 100vw;
        max-width: 100vw;
        right: -100vw;
    }

    .inbox-detail-drawer.open {
        right: 0;
    }
}

@media screen and (max-width: 768px) {
    .inbox-view-container {
        padding: 10px;
        gap: 10px;
    }

    .inbox-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .inbox-stat-card {
        padding: 0.75rem 0.85rem;
    }

    .inbox-stat-val {
        font-size: 1.3rem;
    }

    .inbox-stat-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .inbox-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .inbox-search-box {
        width: 100%;
        max-width: 100%;
    }

    .inbox-status-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .inbox-tab-btn {
        flex-shrink: 0;
        padding: 0.35rem 0.65rem;
        font-size: 0.75rem;
    }

    .inbox-filters-group {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .inbox-select,
    .inbox-btn-rules {
        flex: 1;
        min-width: 120px;
    }

    .inbox-item-card {
        padding: 0.9rem 1rem;
    }

    .inbox-card-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .inbox-card-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 6px;
    }

    .inbox-bulk-bar {
        left: 10px;
        right: 10px;
        transform: none;
        width: calc(100% - 20px);
        flex-direction: column;
        gap: 8px;
        padding: 8px 12px;
    }

    .inbox-rules-modal-content {
        width: 95vw;
        max-width: 95vw;
        padding: 1rem;
    }
}

@media screen and (max-width: 480px) {
    .inbox-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .inbox-card-title {
        font-size: 0.95rem;
    }

    .drawer-title {
        max-width: 220px;
    }

    .drawer-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .drawer-footer button {
        width: 100%;
    }
}
