/**
 * Blox Fruits Values - Competitor Inspired Theme
 * Clean, High-Contrast, Data-First Design
 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;700;800&display=swap');

:root {
    --bfv-bg-body: #0b0e14;
    --bfv-bg-card: #151a23;
    --bfv-bg-header: #1e2532;
    --bfv-text-main: #ffffff;
    --bfv-text-muted: #94a3b8;

    /* Functional Colors */
    --bfv-accent: #3b82f6;
    --bfv-success: #10b981;
    --bfv-warning: #f59e0b;
    --bfv-danger: #ef4444;
    --bfv-border: #2a3441;

    /* Rarity Colors (Standardized) */
    --bfv-common: #9ca3af;
    --bfv-uncommon: #4ade80;
    --bfv-rare: #3b82f6;
    --bfv-legendary: #fbbf24;
    --bfv-mythical: #a855f7;
    --bfv-gamepass: #ec4899;
    --bfv-limited: #f43f5e;
}

/* ========================================
   GLOBAL LAYOUT
   ======================================== */

.bfv-values-container,
.bfv-calculator {
    background: var(--bfv-bg-body);
    padding: 30px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    color: var(--bfv-text-main);
    margin: 0 auto;
    box-sizing: border-box;
}

/* ========================================
   VALUES TABLE
   ======================================== */

/* Search & Filter Header */
.bfv-search-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: var(--bfv-bg-card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--bfv-border);
}

.bfv-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 15px;
}

.bfv-search-input:focus {
    outline: none;
    border-color: var(--bfv-accent);
}

.bfv-filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bfv-filter-btn {
    padding: 10px 20px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 8px;
    color: var(--bfv-text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    white-space: nowrap;
}

.bfv-filter-btn:hover,
.bfv-filter-btn.active {
    background: var(--bfv-accent);
    color: white;
    border-color: var(--bfv-accent);
}

/* Filter Toggle Button */
.bfv-filter-toggle-btn {
    padding: 10px 16px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 8px;
    color: var(--bfv-text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bfv-filter-toggle-btn:hover {
    background: var(--bfv-bg-card);
    border-color: var(--bfv-accent);
    color: var(--bfv-accent);
}

.bfv-filter-toggle-btn.has-filters {
    background: var(--bfv-accent);
    color: white;
    border-color: var(--bfv-accent);
}

.bfv-filter-icon {
    font-size: 16px;
}

/* Filter Modal */
.bfv-filter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.bfv-filter-modal.open {
    display: block;
}

.bfv-filter-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.bfv-filter-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bfv-bg-card);
    border-radius: 16px;
    border: 1px solid var(--bfv-border);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.bfv-filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--bfv-border);
    background: var(--bfv-bg-header);
}

.bfv-filter-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.bfv-filter-modal-close {
    background: none;
    border: none;
    color: var(--bfv-text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.bfv-filter-modal-close:hover {
    color: var(--bfv-danger);
}

.bfv-filter-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.bfv-filter-modal-footer {
    display: flex;
    gap: 12px;
    padding: 18px 20px;
    border-top: 1px solid var(--bfv-border);
    background: var(--bfv-bg-header);
}

.bfv-apply-btn {
    flex: 1;
    padding: 12px 20px;
    background: var(--bfv-accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.bfv-apply-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

/* Filter Groups (inside modal) */

.bfv-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.bfv-filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bfv-text-muted);
    letter-spacing: 0.5px;
}

/* Select Dropdown */
.bfv-select {
    padding: 10px 14px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
}

.bfv-select:hover {
    border-color: var(--bfv-accent);
}

.bfv-select:focus {
    outline: none;
    border-color: var(--bfv-accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.bfv-select option {
    background: var(--bfv-bg-header);
    color: white;
}

/* Value Presets */
.bfv-value-presets {
    display: flex;
    gap: 6px;
}

.bfv-preset-btn {
    padding: 8px 14px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 6px;
    color: var(--bfv-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.bfv-preset-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--bfv-accent);
    color: var(--bfv-accent);
}

.bfv-preset-btn.active {
    background: var(--bfv-accent);
    color: white;
    border-color: var(--bfv-accent);
}

/* Demand Filter */
.bfv-demand-filter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bfv-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    background: var(--bfv-bg-header);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.bfv-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--bfv-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid var(--bfv-bg-body);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.bfv-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.bfv-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--bfv-accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bfv-bg-body);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.bfv-demand-display {
    font-size: 14px;
    font-weight: 700;
    color: var(--bfv-accent);
    min-width: 36px;
    text-align: center;
}

/* Reset Button */
.bfv-reset-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid var(--bfv-border);
    border-radius: 8px;
    color: var(--bfv-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.bfv-reset-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--bfv-danger);
    color: var(--bfv-danger);
}

/* Grid Layout */
.bfv-values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* Card Design - Clean & Rarity Focused */
.bfv-item-card {
    background: var(--bfv-bg-card);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--bfv-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.bfv-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Dynamic Rarity Borders */
[data-rarity="COMMON"] {
    border-top: 4px solid var(--bfv-common);
}

[data-rarity="UNCOMMON"] {
    border-top: 4px solid var(--bfv-uncommon);
}

[data-rarity="RARE"] {
    border-top: 4px solid var(--bfv-rare);
}

[data-rarity="LEGENDARY"] {
    border-top: 4px solid var(--bfv-legendary);
}

[data-rarity="MYTHICAL"] {
    border-top: 4px solid var(--bfv-mythical);
}

[data-rarity="GAMEPASS"] {
    border-top: 4px solid var(--bfv-gamepass);
}

[data-rarity="LIMITED"] {
    border-top: 4px solid var(--bfv-limited);
}

.bfv-card-header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    border-bottom: 1px solid var(--bfv-border);
}

.bfv-item-image {
    width: 90px;
    height: 90px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bfv-item-card:hover .bfv-item-image {
    transform: scale(1.1);
}

.bfv-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bfv-header-info {
    width: 100%;
}

.bfv-item-name {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--bfv-text-main);
}

.bfv-rarity-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    color: var(--bfv-text-muted);
}

/* Rarity Text Colors */
[data-rarity="MYTHICAL"] .bfv-item-name {
    color: var(--bfv-mythical);
}

[data-rarity="LEGENDARY"] .bfv-item-name {
    color: var(--bfv-legendary);
}

[data-rarity="RARE"] .bfv-item-name {
    color: var(--bfv-rare);
}

[data-rarity="UNCOMMON"] .bfv-item-name {
    color: var(--bfv-uncommon);
}

[data-rarity="MYTHICAL"] .bfv-rarity-pill {
    background: rgba(168, 85, 247, 0.15);
    color: var(--bfv-mythical);
}

[data-rarity="LEGENDARY"] .bfv-rarity-pill {
    background: rgba(251, 191, 36, 0.15);
    color: var(--bfv-legendary);
}

/* Card Body - Data Grid */
.bfv-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bfv-trade-values {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--bfv-border);
}

.bfv-main-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.bfv-val-label {
    font-size: 12px;
    color: var(--bfv-text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.bfv-val-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--bfv-success);
}

.bfv-perm-value {
    border-top: 1px solid var(--bfv-border);
    margin-top: 5px;
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bfv-perm-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--bfv-accent);
}

/* Prices Grid */
.bfv-prices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bfv-price-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.bfv-price-mini-label {
    font-size: 10px;
    color: var(--bfv-text-muted);
    display: block;
    margin-bottom: 2px;
}

.bfv-price-value {
    font-weight: 600;
    font-size: 13px;
}

/* Demand Bar */
.bfv-demand-section {
    margin-top: auto;
}

.bfv-demand-top {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--bfv-text-muted);
}

.bfv-demand-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.bfv-demand-fill {
    height: 100%;
    border-radius: 3px;
}

.bfv-trend-badge {
    text-align: center;
    padding: 4px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* ========================================
   CALCULATOR - NEW DESIGN
   ======================================== */

.bfv-calculator {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.bfv-calc-header {
    text-align: center;
    padding-bottom: 20px;
}

.bfv-calc-header h2 {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin: 0 0 8px 0;
}

.bfv-calc-subtitle {
    color: var(--bfv-text-muted);
    font-size: 15px;
    margin: 0;
}

/* Main Calculator Layout */
.bfv-calc-main {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 20px;
    align-items: stretch;
}

/* Each Side (Give / Receive) */
.bfv-calc-side {
    background: var(--bfv-bg-card);
    border: 2px solid var(--bfv-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.bfv-side-give {
    border-top: 4px solid var(--bfv-danger);
}

.bfv-side-receive {
    border-top: 4px solid var(--bfv-success);
}

.bfv-side-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--bfv-border);
}

.bfv-side-icon {
    font-size: 24px;
}

.bfv-side-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.bfv-side-give .bfv-side-header h3 {
    color: var(--bfv-danger);
}

.bfv-side-receive .bfv-side-header h3 {
    color: var(--bfv-success);
}

/* Items Container - GRID LAYOUT (Max 3 per row) */
.bfv-side-items {
    flex: 1;
    min-height: 180px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--bfv-border);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
}

.bfv-items-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bfv-text-muted);
    font-size: 14px;
    text-align: center;
    min-height: 100px;
}

/* Selected Item in Calculator - GRID CELL */
.bfv-calc-item {
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 6px;
    position: relative;
    animation: fadeIn 0.2s ease;
    transition: all 0.2s;
    height: 100%;
    /* Ensure it fills grid height */
    justify-content: space-between;
}

.bfv-calc-item:hover {
    border-color: var(--bfv-accent);
    transform: translateY(-2px);
    /* Subtle lift instead of scale */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.bfv-calc-item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    margin-bottom: 6px;
    margin-top: 4px;
    /* Space for remove button */
}

.bfv-calc-item-info {
    width: 100%;
    margin-bottom: 6px;
}

.bfv-calc-item-name {
    font-size: 11px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
}

.bfv-calc-item-value {
    color: var(--bfv-success);
    font-size: 11px;
    font-weight: 700;
}

.bfv-calc-item-beli {
    color: #fbbf24;
    font-size: 10px;
    font-weight: 600;
}

.bfv-calc-item-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--bfv-danger);
    border: 2px solid var(--bfv-bg-card);
    /* Add border to separate from bg */
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: all 0.2s;
    line-height: 1;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.bfv-calc-item:hover .bfv-calc-item-remove {
    opacity: 1;
    top: -10px;
    right: -10px;
}

.bfv-calc-item-remove:hover {
    transform: scale(1.1);
    background: #dc2626;
}

/* Quantity Badge */
.bfv-item-qty {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--bfv-accent);
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    /* Make perfectly round */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--bfv-bg-card);
    z-index: 4;
}

/* Quantity Controls */
.bfv-qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    /* Remove gap, join buttons */
    margin-top: auto;
    /* Push to bottom */
    width: 100%;
    background: var(--bfv-bg-card);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--bfv-border);
}

.bfv-qty-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--bfv-text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    border-radius: 4px;
}

.bfv-qty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.bfv-qty-minus:hover {
    color: var(--bfv-danger);
}

.bfv-qty-plus:hover {
    color: var(--bfv-success);
}

.bfv-qty-num {
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    color: white;
    padding: 0 2px;
}

/* Item Placeholder (no image) */
.bfv-item-placeholder {
    width: 50px;
    height: 50px;
    background: #333;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Add Item Button */
.bfv-add-btn {
    width: 100%;
    padding: 14px;
    background: var(--bfv-bg-header);
    border: 2px dashed var(--bfv-accent);
    border-radius: 10px;
    color: var(--bfv-accent);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-bottom: 15px;
}

.bfv-add-btn:hover {
    background: var(--bfv-accent);
    color: white;
    border-style: solid;
}

.bfv-add-icon {
    font-size: 20px;
    font-weight: 800;
}

/* Side Totals Container - ROW LAYOUT */
.bfv-side-totals {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.bfv-side-total {
    flex: 1;
    background: var(--bfv-bg-header);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-weight: 700;
    border: 1px solid var(--bfv-border);
}

.bfv-side-total.beli {
    border-top: 3px solid #fbbf24;
}

.bfv-side-total.value {
    border-top: 3px solid var(--bfv-success);
}

.bfv-total-label {
    color: var(--bfv-text-muted);
    font-size: 11px;
    margin-bottom: 4px;
}

.bfv-total-beli {
    color: #fbbf24;
    font-size: 16px;
    font-weight: 800;
}

.bfv-total-value {
    color: var(--bfv-success);
    font-size: 16px;
    font-weight: 800;
}

/* VS Divider */
.bfv-calc-divider {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bfv-vs-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bfv-danger), var(--bfv-success));
    color: white;
    font-weight: 900;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Result Box - Comparison Design */
.bfv-calc-result {
    background: var(--bfv-bg-card);
    border: 2px solid var(--bfv-border);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
}

.bfv-result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid;
}

.bfv-calc-result.win .bfv-result-badge {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--bfv-success);
}

.bfv-calc-result.fair .bfv-result-badge {
    background: rgba(251, 191, 36, 0.1);
    border-color: var(--bfv-warning);
}

.bfv-calc-result.lose .bfv-result-badge {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--bfv-danger);
}

.bfv-result-emoji {
    font-size: 24px;
}

.bfv-result-text {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
}

.bfv-calc-result.win .bfv-result-text {
    color: var(--bfv-success);
}

.bfv-calc-result.fair .bfv-result-text {
    color: var(--bfv-warning);
}

.bfv-calc-result.lose .bfv-result-text {
    color: var(--bfv-danger);
}

/* Side by Side Comparison */
.bfv-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.bfv-compare-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 150px;
}

.bfv-compare-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--bfv-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bfv-compare-value {
    font-size: 32px;
    font-weight: 900;
}

.bfv-compare-side.give .bfv-compare-value {
    color: #fbbf24;
}

.bfv-compare-side.receive .bfv-compare-value {
    color: var(--bfv-mythical);
}

.bfv-compare-price {
    font-size: 14px;
    font-weight: 600;
}

.bfv-compare-side.give .bfv-compare-price {
    color: #fbbf24;
}

.bfv-compare-side.receive .bfv-compare-price {
    color: var(--bfv-mythical);
}

.bfv-compare-vs {
    font-size: 14px;
    font-weight: 700;
    color: var(--bfv-text-muted);
}

/* Percentages Display */
.bfv-percentages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 800;
}

.bfv-percent.give {
    color: #a855f7;
}

.bfv-percent.receive {
    color: #ec4899;
}

.bfv-percent-divider {
    color: var(--bfv-text-muted);
}

/* Difference Display */
.bfv-difference {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: var(--bfv-bg-header);
    border-radius: 10px;
    border: 1px solid var(--bfv-border);
}

.bfv-diff-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--bfv-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bfv-diff-value {
    font-size: 24px;
    font-weight: 900;
}

.bfv-calc-result.win .bfv-diff-value {
    color: var(--bfv-success);
}

.bfv-calc-result.fair .bfv-diff-value {
    color: var(--bfv-warning);
}

.bfv-calc-result.lose .bfv-diff-value {
    color: var(--bfv-danger);
}

/* Action Buttons */
.bfv-calc-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.bfv-btn {
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bfv-btn-primary {
    background: var(--bfv-accent);
    color: white;
}

.bfv-btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
}

.bfv-btn-secondary {
    background: var(--bfv-bg-card);
    border: 1px solid var(--bfv-border);
    color: var(--bfv-text-muted);
}

.bfv-btn-secondary:hover {
    background: var(--bfv-bg-header);
    color: white;
}

/* ========================================
   ITEM SELECTION MODAL
   ======================================== */

.bfv-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bfv-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.bfv-modal-content {
    position: relative;
    background: var(--bfv-bg-body);
    border: 1px solid var(--bfv-border);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.bfv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--bfv-border);
    background: var(--bfv-bg-card);
}

.bfv-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.bfv-modal-close {
    background: none;
    border: none;
    color: var(--bfv-text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.bfv-modal-close:hover {
    color: var(--bfv-danger);
}

.bfv-modal-search {
    padding: 15px 25px;
    background: var(--bfv-bg-card);
}

#bfv-modal-search-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
}

#bfv-modal-search-input:focus {
    outline: none;
    border-color: var(--bfv-accent);
}

/* Combined Toolbar */
.bfv-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 25px 15px 25px;
    background: var(--bfv-bg-card);
    flex-wrap: wrap;
}

.bfv-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bfv-toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--bfv-border);
}

.bfv-modal-filter {
    padding: 8px 14px;
    background: var(--bfv-bg-header);
    border: 1px solid var(--bfv-border);
    border-radius: 8px;
    color: var(--bfv-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bfv-modal-filter:hover,
.bfv-modal-filter.active {
    background: var(--bfv-accent);
    color: white;
    border-color: var(--bfv-accent);
}

/* Value Type Toggle (Inside Toolbar) */
.bfv-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--bfv-text-muted);
    margin-right: 5px;
}

.bfv-value-type-btn {
    padding: 8px 14px;
    background: var(--bfv-bg-header);
    border: 2px solid var(--bfv-border);
    border-radius: 8px;
    color: var(--bfv-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bfv-value-type-btn:hover {
    border-color: var(--bfv-accent);
    color: white;
}

.bfv-value-type-btn.active[data-value-type="normal"] {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-color: #f59e0b;
    color: white;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

.bfv-value-type-btn.active[data-value-type="permanent"] {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Value Type Badge on Selected Items */
.bfv-value-type-badge {
    position: absolute;
    top: -6px;
    right: 20px;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 3;
    border: 2px solid var(--bfv-bg-card);
}

.bfv-value-type-badge.trend {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.bfv-value-type-badge.permanent {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

/* Alternate Value in Modal Items */
.bfv-modal-item-alt-value {
    font-size: 10px;
    color: var(--bfv-text-muted);
    margin-top: 3px;
    opacity: 0.7;
}

/* Items Grid in Modal */
.bfv-modal-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    align-content: start;
}

.bfv-modal-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--bfv-text-muted);
    padding: 40px;
}

/* Grid Item Card */
.bfv-modal-item {
    background: var(--bfv-bg-card);
    border: 2px solid var(--bfv-border);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.bfv-modal-item:hover {
    border-color: var(--bfv-accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.bfv-modal-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 10px;
}

.bfv-modal-item-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bfv-modal-item-value {
    font-size: 12px;
    color: var(--bfv-success);
    font-weight: 700;
}

/* Multi-select: Selected State */
.bfv-modal-item.selected {
    border-color: var(--bfv-accent);
    background: rgba(59, 130, 246, 0.15);
    position: relative;
}

.bfv-modal-item.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--bfv-accent);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Footer */
.bfv-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-top: 1px solid var(--bfv-border);
    background: var(--bfv-bg-card);
}

.bfv-selected-count {
    color: var(--bfv-text-muted);
    font-size: 14px;
    font-weight: 600;
}

.bfv-add-selected {
    min-width: 140px;
}

/* Mobile Optimization */
@media (max-width: 768px) {

    /* Global Mobile Adjustments */
    .bfv-values-container,
    .bfv-calculator {
        padding: 5px;
    }

    /* --- Values Table --- */

    /* Search Bar Stack */
    .bfv-search-bar {
        flex-direction: column;
        padding: 15px;
        gap: 12px;
    }

    .bfv-search-input {
        min-width: 100%;
        width: 100%;
        font-size: 16px;
        /* Prevent zoom on iOS */
        padding: 12px 14px;
        height: 48px;
    }

    /* Horizontal Scroll Filters */
    /* Wrapped Filters - Better than scroll for visibility */
    .bfv-filter-buttons {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 8px;
        padding-bottom: 0;
        justify-content: center;
        /* Center align buttons */
    }

    .bfv-filter-buttons::-webkit-scrollbar {
        display: none;
    }

    .bfv-filter-btn {
        flex-shrink: 0;
        padding: 8px 16px;
        font-size: 14px;
        height: 40px;
        display: flex;
        align-items: center;
    }

    /* Filter Toggle Button Mobile */
    .bfv-filter-toggle-btn {
        padding: 8px 14px;
        font-size: 13px;
        height: 40px;
    }

    /* Filter Modal Mobile */
    .bfv-filter-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .bfv-filter-modal-header {
        padding: 15px;
    }

    .bfv-filter-modal-body {
        padding: 15px;
        gap: 16px;
    }

    .bfv-filter-group {
        width: 100%;
    }

    .bfv-select {
        width: 100%;
        min-width: auto;
        font-size: 16px;
        /* Prevent iOS zoom */
        height: 48px;
    }

    .bfv-value-presets {
        flex-wrap: wrap;
        width: 100%;
    }

    .bfv-preset-btn {
        flex: 1;
        min-width: 60px;
        text-align: center;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .bfv-demand-filter {
        width: 100%;
    }

    .bfv-slider {
        flex: 1;
        min-width: 0;
    }

    .bfv-filter-modal-footer {
        padding: 15px;
    }

    .bfv-reset-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .bfv-apply-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Values Grid: 1 column for better readability */
    .bfv-values-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* --- Trade Calculator --- */

    /* Main Layout: Stack Vertically */
    .bfv-calc-main {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bfv-calc-divider {
        padding: 5px 0;
    }

    .bfv-vs-badge {
        transform: rotate(90deg);
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    /* Selected Items Grid: Fixed 2 columns */
    .bfv-side-items {
        grid-template-columns: repeat(2, 1fr);
        padding: 10px;
        gap: 8px;
        min-height: 120px;
    }

    /* Item Card Optimizations */
    .bfv-calc-item {
        padding: 8px 4px;
    }

    .bfv-calc-item-name {
        font-size: 11px;
    }

    .bfv-qty-controls {
        transform: scale(0.95);
    }

    /* Action Buttons: Full Width */
    .bfv-calc-actions {
        flex-direction: column;
        gap: 10px;
    }

    .bfv-btn {
        width: 100%;
        justify-content: center;
        height: 48px;
        font-size: 16px;
    }

    /* --- Modal: Full Screen Experience --- */
    .bfv-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .bfv-modal-header {
        padding: 12px 15px;
    }

    .bfv-modal-search {
        padding: 0 15px 10px;
    }

    /* Modal Toolbar Mobile */
    .bfv-modal-toolbar {
        padding: 0 15px 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .bfv-toolbar-group {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .bfv-toolbar-group::-webkit-scrollbar {
        display: none;
    }

    .bfv-toolbar-separator {
        display: none;
    }

    .bfv-modal-filter {
        flex-shrink: 0;
        white-space: nowrap;
        height: 36px;
        display: flex;
        align-items: center;
    }

    /* Value Type Mobile */
    .bfv-toggle-label {
        display: none;
        /* Hide label on mobile to save space */
    }

    .bfv-value-type-btn {
        flex: 1;
        min-width: 80px;
        text-align: center;
        justify-content: center;
        white-space: nowrap;
    }

    /* Modal Grid: Scrollable Area */
    .bfv-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        padding: 15px;
        overflow-y: auto;
        flex: 1;
        /* Allow grid to take remaining space */
        gap: 8px;
    }

    /* Modal Item Card */
    .bfv-modal-item {
        padding: 8px;
    }

    .bfv-modal-item img {
        width: 45px;
        height: 45px;
    }

    .bfv-modal-item-name {
        font-size: 11px;
    }

    .bfv-modal-item-value {
        font-size: 11px;
    }

    /* Modal Footer: Fixed at bottom */
    .bfv-modal-footer {
        padding: 12px 15px;
        background: var(--bfv-bg-card);
        border-top: 1px solid var(--bfv-border);
        flex-shrink: 0;
        gap: 10px;
    }
}

/* Extra Small Devices */
@media (max-width: 350px) {
    .bfv-values-grid {
        grid-template-columns: 1fr;
    }

    .bfv-modal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}