/**
 * Fantasy Draft Board v4.0 - Trading Mode Extensions CSS
 * 
 * Styles for Inbox, Comparison, Clipboard, and JerryGrid Analysis
 * 
 * @version 4.0
 */

/* ============================================
   SUB-VIEW TOGGLE (Build / Inbox / Saved / Compare)
   ============================================ */

.trade-subview-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 0.2rem;
}

.trade-subview-btn {
    padding: 0.4rem 0.75rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 400;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.trade-subview-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.trade-subview-btn.active {
    background: #7c3aed;
    color: white;
    font-weight: 600;
}

.subview-badge {
    background: #ef4444;
    color: white;
    padding: 0.1rem 0.35rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

.subview-badge.saved {
    background: #3b82f6;
}

/* Sub-view container */
.trade-subview-container {
    padding: 1rem;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

/* Expanded row below context header */
.trade-expanded-row {
    background: #1e1e2e;
    border-bottom: 1px solid #3d3d5c;
    padding: 1rem;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toggle button active state (when expanded) */
.context-btn.toggle-btn.active {
    background: #a78bfa;
    color: #1e1b4b;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

.context-btn.toggle-btn.active .badge {
    background: #1e1b4b;
    color: #a78bfa;
}

.context-btn.toggle-btn .badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    margin-left: 0.25rem;
}

/* ============================================
   TRADE INBOX
   ============================================ */

.trade-inbox {
    max-width: 900px;
    margin: 0 auto;
}

/* Overlap Alert */
.inbox-overlap-alert {
    background: #78350f;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inbox-overlap-alert .alert-icon {
    font-size: 1.2rem;
}

.inbox-overlap-alert .alert-content {
    flex: 1;
}

.inbox-overlap-alert .alert-content strong {
    color: #fbbf24;
    display: block;
    font-size: 0.9rem;
}

.inbox-overlap-alert .alert-content span {
    color: #fde68a;
    font-size: 0.8rem;
}

.btn-compare-overlapping {
    background: #f59e0b;
    color: #1f2937;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Filter Bar */
.inbox-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.inbox-filter-btn {
    padding: 0.35rem 0.75rem;
    background: #374151;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.inbox-filter-btn:hover {
    background: #4b5563;
}

.inbox-filter-btn.active {
    background: #7c3aed;
}

.inbox-filter-spacer { flex: 1; }

.btn-compare-selected {
    padding: 0.35rem 0.75rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Offer Cards */
.inbox-offers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.inbox-empty {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.inbox-empty .empty-icon { font-size: 2rem; }

.inbox-offer-card {
    background: #1f2937;
    border-radius: 10px;
    border: 2px solid #374151;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s;
}

.inbox-offer-card:hover {
    border-color: #4b5563;
}

.inbox-offer-card.selected {
    background: #1e3a8a;
    border-color: #3b82f6;
}

.inbox-offer-card.has-overlap {
    border-color: #f59e0b;
}

/* Offer Header */
.offer-header {
    padding: 0.75rem 1rem;
    background: #374151;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inbox-offer-card.selected .offer-header {
    background: #1e40af;
}

.offer-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.offer-checkbox:hover { border-color: #a855f7; }

.offer-checkbox.checked {
    background: #3b82f6;
    border-color: #60a5fa;
}

.offer-from { flex: 1; }
.offer-from strong { font-size: 0.9rem; }
.offer-owner { color: #9ca3af; font-weight: 400; }

.offer-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
}

.offer-badge.competing {
    background: #f59e0b;
    color: #1f2937;
}

.offer-expiry {
    color: #9ca3af;
    font-size: 0.75rem;
}

.offer-expiry.expiring {
    color: #f87171;
    font-weight: 600;
}

/* Offer Content */
.offer-content {
    padding: 1rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.offer-side { flex: 1; }

.offer-side-label {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.offer-side-label.give { color: #ef4444; }
.offer-side-label.receive { color: #10b981; }

.offer-arrow {
    color: #6b7280;
    font-size: 1.5rem;
    padding-top: 1.5rem;
}

.offer-item {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.offer-item.give { background: #374151; }
.offer-item.receive { background: #064e3b; }
.offer-item.overlap-highlight { border: 1px solid #f59e0b; }

.offer-item-pos {
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

.offer-item-name { flex: 1; }

.offer-item-value { font-size: 0.75rem; font-weight: 600; }
.offer-item-value.give { color: #ef4444; }
.offer-item-value.receive { color: #10b981; }

/* Offer Message */
.offer-message {
    padding: 0 1rem 0.75rem;
    font-size: 0.8rem;
    color: #9ca3af;
    font-style: italic;
}

/* Offer JerryGrid Quick Score */
.offer-jerrygrid-quick {
    padding: 0.5rem 1rem;
    background: #1e293b;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.offer-jerrygrid-quick .jg-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.offer-jerrygrid-quick .jg-grade {
    font-weight: 700;
    font-size: 1.1rem;
}

.offer-jerrygrid-quick .jg-score-num {
    font-size: 0.85rem;
    color: #9ca3af;
}

/* Offer Actions */
.offer-actions {
    padding: 0.75rem 1rem;
    background: #111827;
    display: flex;
    gap: 0.5rem;
}

.offer-actions-spacer { flex: 1; }

.offer-action-btn {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
}

.offer-action-btn.accept { background: #10b981; color: white; }
.offer-action-btn.reject { background: #ef4444; color: white; }
.offer-action-btn.counter { background: #6366f1; color: white; }
.offer-action-btn.analyze { background: #374151; color: white; }

/* ============================================
   TRADE COMPARISON PANEL
   ============================================ */

.trade-comparison-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.comparison-modal {
    position: relative;
    background: #111827;
    border-radius: 12px;
    width: 95vw;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.comparison-header {
    padding: 1rem 1.5rem;
    background: #1f2937;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #374151;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comparison-header h2 { margin: 0; font-size: 1.2rem; }

.comparison-close {
    background: #374151;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

/* Comparison Cards */
.comparison-cards {
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
}

.comparison-card {
    background: #1f2937;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #374151;
}

.comparison-card-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-option-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.card-trade-name {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.card-type-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.card-type-badge.inbox { background: #f59e0b; color: #1f2937; }
.card-type-badge.saved { background: #3b82f6; color: white; }

.card-remove-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
}

.comparison-card-body { padding: 1rem; }

.card-section { margin-bottom: 0.75rem; }

.card-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.card-section-label.give { color: #ef4444; }
.card-section-label.receive { color: #10b981; }

.card-asset {
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-asset.give { background: #374151; }
.card-asset.receive { background: #064e3b; }

.asset-pos {
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
}

/* Score section */
.comparison-card-score {
    padding: 1rem;
    background: #111827;
    border-top: 1px solid #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.comparison-card-score.loading {
    justify-content: center;
}

/* Add card */
.comparison-add-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-style: dashed !important;
    cursor: pointer;
    min-height: 300px;
    transition: background 0.15s;
}

.comparison-add-card:hover {
    background: #1f2937;
}

.add-card-icon { font-size: 2rem; color: #6b7280; }
.add-card-text { font-size: 0.9rem; color: #9ca3af; }
.add-card-sources { font-size: 0.75rem; color: #6b7280; margin-top: 0.5rem; }

/* ============================================
   JERRYGRID COMPARISON TABLE
   ============================================ */

.jg-comparison-table {
    padding: 0 1.5rem 1.5rem;
}

.jg-table-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-size: 1rem;
}

.jg-logo {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-weight: 800;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

.jg-logo-large {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-weight: 800;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 1.2rem;
    font-family: monospace;
}

.jg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.jg-table th {
    text-align: center;
    padding: 0.6rem;
    color: #9ca3af;
    border-bottom: 2px solid #374151;
    font-weight: 500;
}

.jg-th-factor { text-align: left; }

.jg-table td {
    padding: 0.6rem;
    border-bottom: 1px solid #1f2937;
}

.jg-td-factor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jg-factor-icon { font-size: 1rem; }
.jg-factor-label { font-weight: 500; }
.jg-td-weight { text-align: center; color: #6b7280; font-size: 0.75rem; }
.jg-td-value { text-align: center; }

.jg-td-value.winner {
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
}

.jg-td-winner { text-align: center; }

.jg-winner-badge {
    background: #10b981;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.jg-row-overall {
    background: #1f2937;
}

.jg-row-overall td {
    border-bottom: 2px solid #374151;
    font-weight: 600;
    font-size: 0.95rem;
}

.jg-pending {
    color: #6b7280;
}

/* Recommendation */
.jg-recommendation {
    margin: 0 1.5rem 1.5rem;
    padding: 1rem;
    background: #064e3b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.jg-recommendation.loading {
    background: #1f2937;
    justify-content: center;
}

.jg-rec-icon { font-size: 1.5rem; }

.jg-rec-content { flex: 1; }

.jg-rec-title {
    font-weight: 600;
    color: #4ade80;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.jg-rec-text {
    font-size: 0.85rem;
    color: #d1fae5;
}

/* ============================================
   JERRYGRID FULL ANALYSIS PANEL
   ============================================ */

.jerrygrid-panel {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jg-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.jg-panel-content {
    position: relative;
    background: #111827;
    border-radius: 16px;
    width: 95vw;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

/* Panel Header */
.jg-panel-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #4c1d95, #7c3aed);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.jg-panel-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.jg-panel-branding h2 {
    margin: 0;
    font-size: 1.2rem;
}

.jg-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.jg-panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

/* Hero Section */
.jg-hero {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    background: #1f2937;
}

.jg-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    color: #10b981;
}

.jg-score-ring.td { color: #10b981; }
.jg-score-ring.accept { color: #3b82f6; }
.jg-score-ring.neutral { color: #f59e0b; }
.jg-score-ring.reject { color: #ef4444; }
.jg-score-ring.fumble { color: #ef4444; }

.jg-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

.jg-ring-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.jg-ring-grade {
    font-size: 1.8rem;
    font-weight: 800;
}

.jg-ring-score {
    font-size: 0.85rem;
    color: #9ca3af;
}

.jg-hero-verdict {
    text-align: center;
}

.jg-verdict-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.jg-verdict-text {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.jg-confidence {
    font-size: 0.85rem;
    color: #9ca3af;
}

/* Factor Breakdown */
.jg-breakdown {
    padding: 1.5rem;
}

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

.jg-factor-row {
    margin-bottom: 1rem;
}

.jg-factor-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.jg-factor-icon { font-size: 1rem; }
.jg-factor-label { flex: 1; font-weight: 500; font-size: 0.9rem; }
.jg-factor-weight { font-size: 0.75rem; }

.jg-factor-bar {
    height: 8px;
    background: #374151;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.jg-factor-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.jg-factor-fill.good { background: #10b981; }
.jg-factor-fill.fair { background: #f59e0b; }
.jg-factor-fill.poor { background: #ef4444; }
.jg-factor-fill.pending { background: #6b7280; }

/* Color-match weight % and score text to bar fill color */
.jg-factor-weight.good, .jg-factor-score.good { color: #10b981; }
.jg-factor-weight.fair, .jg-factor-score.fair { color: #f59e0b; }
.jg-factor-weight.poor, .jg-factor-score.poor { color: #ef4444; }
.jg-factor-weight.pending, .jg-factor-score.pending { color: #6b7280; }

.jg-factor-score {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
}

.jg-factor-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.jg-detail {
    font-size: 0.7rem;
    color: #9ca3af;
    background: #1f2937;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

/* Insights & Warnings */
.jg-insights,
.jg-warnings {
    padding: 0 1.5rem 1rem;
}

.jg-insights-list,
.jg-warnings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.jg-insight-item {
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    font-size: 0.85rem;
}

.jg-warning-item {
    padding: 0.5rem 0.75rem;
    background: #78350f;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #fde68a;
}

/* Acceptance Probability */
.jg-acceptance {
    padding: 0 1.5rem 1.5rem;
}

.jg-acceptance-bar {
    height: 24px;
    background: #374151;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0.5rem;
}

.jg-acceptance-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 40%, #10b981 80%);
    border-radius: 12px;
    transition: width 0.6s ease;
}

.jg-acceptance-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.jg-acceptance-factors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.jg-acceptance-factor {
    font-size: 0.7rem;
    color: #9ca3af;
    background: #1f2937;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

/* Panel Actions */
.jg-panel-actions {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid #374151;
}

.jg-action-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.jg-action-btn.save {
    background: #374151;
    color: white;
}

.jg-action-btn.save:hover {
    background: #4b5563;
}

.jg-action-btn.compare {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
}

.jg-action-btn.compare:hover {
    opacity: 0.9;
}

/* Attribution */
.jg-attribution {
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-size: 0.7rem;
    color: #6b7280;
    border-top: 1px solid #1f2937;
}

/* Grade colors */
.grade-a { color: #10b981; }
.grade-b { color: #3b82f6; }
.grade-c { color: #f59e0b; }
.grade-d { color: #ef4444; }

/* JerryGrid Score Circle (comparison card) */
.jg-score-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.jg-score-circle.grade-a { background: #10b981; color: white; }
.jg-score-circle.grade-b { background: #3b82f6; color: white; }
.jg-score-circle.grade-c { background: #f59e0b; color: #1f2937; }
.jg-score-circle.grade-d { background: #ef4444; color: white; }

.jg-score-details {
    text-align: left;
}

.jg-score-label { font-size: 0.7rem; color: #9ca3af; }
.jg-score-number { font-size: 1.3rem; font-weight: 700; }
.jg-verdict-line { font-size: 0.75rem; color: #9ca3af; }

/* Loading */
.jg-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #9ca3af;
    font-size: 0.85rem;
}

.jg-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #374151;
    border-top: 2px solid #7c3aed;
    border-radius: 50%;
    animation: jg-spin 0.8s linear infinite;
}

.jg-loading-spinner.large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes jg-spin {
    to { transform: rotate(360deg); }
}

.jg-loading-state {
    padding: 3rem;
    text-align: center;
}

.jg-loading-text {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0;
}

.jg-loading-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}

.jg-step {
    font-size: 0.85rem;
    color: #6b7280;
    transition: color 0.3s;
}

.jg-step.active { color: #a855f7; }

/* ============================================
   TRADE CLIPBOARD
   ============================================ */

.trade-clipboard {
    max-width: 900px;
    margin: 0 auto;
    color: #e2e8f0;
}

.clipboard-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.clipboard-header h3 { margin: 0; }

.clipboard-count {
    background: #3b82f6;
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.clipboard-empty {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.clipboard-empty .empty-icon { font-size: 2rem; }
.clipboard-empty .empty-hint { font-size: 0.8rem; }

.clipboard-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.clipboard-card {
    background: #1f2937;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #374151;
}

.clipboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.clipboard-card-name { font-weight: 600; font-size: 0.9rem; color: #e2e8f0; }

.clipboard-card-grade {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    background: currentColor;
}

.clipboard-card-grade.grade-a { background: #10b981; color: white; }
.clipboard-card-grade.grade-b { background: #3b82f6; color: white; }
.clipboard-card-grade.grade-c { background: #f59e0b; color: #1f2937; }

.clipboard-card-date {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

/* Per-team player detail rows for differentiating saved trades */
.clipboard-card-details {
    margin: 0.35rem 0;
    padding: 0.35rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border-left: 2px solid #4b5563;
    font-size: 0.75rem;
    line-height: 1.5;
}

.clip-team-row {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.clip-team-name {
    font-weight: 600;
    color: #a78bfa;
    flex-shrink: 0;
}

.clip-sends {
    color: #6b7280;
    font-style: italic;
    flex-shrink: 0;
}

.clip-players {
    color: #cbd5e1;
}

.clip-pos {
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
}

.clip-asset {
    color: #7c3aed;
    font-weight: 600;
    font-size: 0.7rem;
}

/* Compare button when trade is already in comparison */
.clipboard-btn.in-compare {
    background: #7c3aed;
    color: white;
    border: 1px solid #a78bfa;
}

/* ============================================
   TRADE COMPARISON MODAL (New JerryGrid-based)
   ============================================ */

.comparison-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-left: 0.5rem;
}

/* Winner card styling */
.comparison-card.winner {
    border-color: #10b981 !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.winner-ribbon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem;
    letter-spacing: 0.05em;
}

/* New card layout classes */
.comp-card-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid var(--card-accent, #374151);
    background: #1f2937;
}

.comp-card-label {
    font-weight: 700;
    font-size: 0.8rem;
}

.comp-card-name {
    flex: 1;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comp-card-remove {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #9ca3af;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
}
.comp-card-remove:hover { background: #ef4444; color: white; }

.comp-card-body {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    line-height: 1.6;
}

.comp-team-line { margin-bottom: 0.35rem; }
.comp-team-user { color: #10b981; font-weight: 600; }
.comp-team-other { color: #f59e0b; font-weight: 600; }

.comp-player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #374151;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.72rem;
    margin: 0 0.15rem;
}

.comp-pos {
    font-size: 0.6rem;
    font-weight: 700;
    color: #a78bfa;
}

/* Score section at bottom of card */
.comp-card-score {
    padding: 0.75rem 1rem;
    background: #111827;
    border-top: 1px solid #374151;
}

.comp-score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comp-grade {
    font-size: 1.5rem;
    font-weight: 800;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.comp-grade.grade-a { background: #064e3b; color: #10b981; }
.comp-grade.grade-b { background: #1e3a5f; color: #3b82f6; }
.comp-grade.grade-c { background: #78350f; color: #f59e0b; }
.comp-grade.grade-d { background: #7f1d1d; color: #ef4444; }

.comp-score-info { text-align: left; }
.comp-score-normalized { font-size: 0.85rem; font-weight: 600; }
.comp-score-raw { font-size: 0.7rem; color: #9ca3af; }

.comp-loading {
    display: flex; align-items: center; gap: 0.5rem;
    color: #9ca3af; font-size: 0.8rem;
}

.comp-spinner {
    width: 16px; height: 16px;
    border: 2px solid #374151;
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.comp-error { color: #ef4444; font-size: 0.8rem; }

/* Factor Comparison Table */
.comp-factor-table-wrap {
    margin: 0 1.5rem 1rem;
    background: #0f172a;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #1e293b;
}

.comp-factor-table-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.comp-jg-logo {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-weight: 800;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: monospace;
}

.comp-jg-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.comp-jg-hint {
    margin-left: auto;
    font-size: 0.65rem;
    color: #64748b;
}

.comp-table-scroll {
    overflow-x: auto;
}

.comp-factor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.comp-factor-table th {
    text-align: center;
    padding: 0.5rem 0.75rem;
    color: #94a3b8;
    border-bottom: 1px solid #1e293b;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comp-th-factor { text-align: left !important; }
.comp-th-imp { width: 50px; }

.comp-factor-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.7);
}

.comp-td-factor {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.comp-factor-icon { font-size: 0.9rem; }
.comp-factor-label { font-weight: 500; color: #e2e8f0; }
.comp-factor-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; font-size: 0.55rem; font-weight: 700;
    color: #64748b; border: 1px solid #475569; border-radius: 50%;
    cursor: help; margin-left: 0.2rem;
}

.comp-td-importance {
    text-align: center;
    color: #64748b;
    font-size: 0.72rem;
}

.comp-td-score {
    text-align: center;
    padding: 0.5rem;
}

.comp-td-score.factor-winner {
    background: rgba(16, 185, 129, 0.08);
}

.comp-raw-score {
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.comp-sub-score {
    font-size: 0.65rem;
    color: #64748b;
    margin-left: 0.25rem;
}

.comp-na { color: #475569; }

/* Total row */
.comp-row-total td {
    border-top: 2px solid #334155;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.comp-raw-total {
    font-size: 1.1rem;
    font-weight: 800;
    color: #f8fafc;
}

.comp-td-total.factor-winner {
    background: rgba(16, 185, 129, 0.12);
}

/* Recommendation banner */
.comp-recommendation {
    margin: 0 1.5rem 1rem;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid transparent;
}

.comp-recommendation.high {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: #10b981;
}

.comp-recommendation.moderate {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
}

.comp-recommendation.slight {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
}

.comp-rec-icon { font-size: 1.5rem; }

.comp-rec-content { flex: 1; }
.comp-rec-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.comp-rec-text {
    font-size: 0.82rem;
    line-height: 1.5;
    color: #e2e8f0;
}

.comp-rec-grade { flex-shrink: 0; }

/* Actions bar */
.comparison-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #1e293b;
    position: relative;
}

.comp-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    border: none;
}

.comp-btn-add {
    background: #1e293b;
    color: #94a3b8;
    border: 1px dashed #475569;
}
.comp-btn-add:hover { background: #334155; color: #e2e8f0; }

.comp-btn-close {
    background: #7c3aed;
    color: white;
}
.comp-btn-close:hover { background: #6d28d9; }

/* Trade picker (inline) */
.comp-trade-picker {
    position: absolute;
    bottom: 100%;
    left: 1.5rem;
    right: 1.5rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.3);
}

.comp-picker-title {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.comp-picker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.comp-pick-btn {
    background: #374151;
    color: #e2e8f0;
    border: 1px solid #475569;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
}
.comp-pick-btn:hover { background: #4b5563; border-color: #7c3aed; }

.comp-picker-cancel {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.72rem;
    cursor: pointer;
}
.comp-picker-cancel:hover { color: #ef4444; }

.clipboard-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.clipboard-btn {
    flex: 1;
    padding: 0.35rem;
    background: #374151;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.15s;
}

.clipboard-btn:hover { background: #4b5563; }

.clipboard-btn.danger {
    flex: none;
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.clipboard-btn.danger:hover { background: rgba(239, 68, 68, 0.1); }

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .trade-subview-toggle {
        flex-wrap: wrap;
    }
    
    .trade-subview-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
    }
    
    .offer-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .offer-arrow {
        padding: 0;
        text-align: center;
    }
    
    .comparison-cards {
        grid-template-columns: 1fr !important;
    }
    
    .jg-hero {
        flex-direction: column;
        gap: 1rem;
    }
    
    .jg-comparison-table {
        overflow-x: auto;
    }
    
    .jg-table {
        min-width: 600px;
    }
}

/* ============================================
   TRADE SUMMARY BAR (bottom fixed bar)
   ============================================ */

.trade-summary-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(to top, #0f172a, #1e293b);
    border-top: 1px solid #334155;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

.trade-summary-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    gap: 1rem;
}

.trade-summary-info {
    flex: 1;
    min-width: 0;
}

.trade-summary-title {
    font-weight: 700;
    font-size: 1rem;
    color: #e2e8f0;
}

.trade-summary-details {
    font-size: 0.85rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action buttons wrapper (Save + Open Trade Builder) */
.trade-summary-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.trade-summary-btn {
    padding: 0.6rem 1.4rem;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.trade-summary-btn:hover {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    transform: translateY(-1px);
}

/* Quick Save button in summary bar */
.trade-summary-save-btn {
    padding: 0.6rem 1rem;
    background: #374151;
    color: #e2e8f0;
    border: 1px solid #4b5563;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.trade-summary-save-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
}

.trade-summary-save-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ============================================
   TRADE SUMMARY BAR - MOBILE
   On narrow screens, stack layout and wrap player names
   ============================================ */
@media (max-width: 600px) {
    .trade-summary-bar {
        padding: 0.5rem 0.75rem;
        /* Extra bottom padding for mobile toolbar + safe area inset */
        padding-bottom: calc(0.5rem + var(--mobile-toolbar-height, 50px) + env(safe-area-inset-bottom, 0px));
    }
    .trade-summary-inner {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    .trade-summary-details {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        line-height: 1.4;
        font-size: 0.8rem;
    }
    .trade-summary-actions {
        justify-content: stretch;
    }
    .trade-summary-actions button {
        flex: 1;
        font-size: 0.85rem;
        padding: 0.5rem 0.6rem;
    }
}
