/* ================================== */
/* NEW 3D MARKET PAGE STYLES          */
/* ================================== */

.market-html, .market-page-body {
    height: 100%;
    margin: 0;
    overflow: hidden; /* Prevent scrolling entirely */
    background-color: #0a0a0a;
}

/* Base UI setup */
/* Global hidden utility – but NOT for loading overlay (it needs fade) */
.hidden:not(#loading-overlay) { display: none !important; }

.market-navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: rgba(18, 77, 43, 0.85); /* Slightly transparent dark green */
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--color-primary);
}

.market-main-container {
    padding-top: 80px; /* Offset for navbar */
    position: relative;
    width: 100vw;
    height: 100vh;
    pointer-events: none; /* Let clicks pass through to canvas by default */
}

/* Elements we want clickable */
.market-sidebar, .bottom-slider-container, .item-info-panel, .buy-modal-overlay {
    pointer-events: auto;
}

/* ================================== */
/* 3D CANVAS BACKGROUND               */
/* ================================== */
.market-3d-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1; /* Behind everything */
    outline: none;
}

/* ================================== */
/* LOADING OVERLAY                    */
/* ================================== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader {
    width: 60px;
    height: 60px;
    background: var(--color-primary);
    border: 4px solid var(--color-dark-green);
    box-shadow: 0 8px 0 rgba(0,0,0,0.5);
    animation: pixel-bounce 0.8s ease-in-out infinite alternate;
}

@keyframes pixel-bounce {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-30px) rotate(45deg); }
}

#loading-text {
    color: var(--color-primary);
    margin-top: 30px;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
}

/* ================================== */
/* SIDEBAR (Fixed Left)               */
/* ================================== */
.market-sidebar {
    position: fixed;
    left: 0px;
    top: 74px; /* Perfectly aligned below navbar */
    width: 280px;
    bottom: 0px; /* Full height down to bottom */
    background: rgba(15, 15, 15, 0.9);
    border-right: 1px solid rgba(225, 192, 0, 0.3);
    padding: 15px 20px; /* Reduced top padding to close gap */
    overflow-y: auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.market-sidebar::-webkit-scrollbar { width: 5px; }
.market-sidebar::-webkit-scrollbar-track { background: transparent; }
.market-sidebar::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 5px; }

.sidebar-title {
    color: var(--color-primary);
    font-size: 1.4em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 170, 0, 0.2);
    text-transform: uppercase;
}

.sidebar-search {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search input {
    background: rgba(0,0,0,0.6);
    color: white; /* Make search text visible */
    padding: 10px 35px 10px 10px;
    border: 1px solid #333;
    border-radius: 6px;
    width: 100%;
}

.sidebar-search .search-icon {
    position: absolute;
    right: 12px;
    color: #888;
    pointer-events: none;
}

.category-menu {
    list-style: none;
    padding: 0;
    flex-grow: 1;
}

.category-group-title {
    color: var(--color-text-light);
    font-weight: bold;
    font-size: 1.05em;
    padding: 10px;
    background: rgba(30, 77, 43, 0.6);
    border-radius: 4px;
    margin-bottom: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--color-primary);
}

.category-item {
    color: #bbb;
    padding: 8px 10px 8px 25px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.category-item:hover {
    color: var(--color-primary);
    background: rgba(225, 192, 0, 0.1);
}

.category-item.active {
    color: var(--color-primary);
    font-weight: bold;
    border-left: 2px solid var(--color-primary);
    background: linear-gradient(90deg, rgba(225, 192, 0, 0.15) 0%, transparent 100%);
}

.controls-info-box {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0,0,0,0.6);
    border-radius: 8px;
    border-top: 2px solid var(--color-secondary);
    font-size: 0.85em;
    color: #aaa;
}
.controls-info-box p { margin: 5px 0; }
.controls-info-box span { color: var(--color-primary); font-weight: bold; }

/* ================================== */
/* BOTTOM SLIDER (Items Menu)         */
/* ================================== */
.bottom-slider-container {
    position: fixed;
    bottom: 0;
    left: 280px; /* Sidebar width offset */
    width: calc(100% - 280px);
    height: 180px; /* Bigger height for items */
    background: linear-gradient(0deg, rgba(10,10,10,0.95) 0%, rgba(10,10,10,0.7) 100%);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--color-primary);
    z-index: 15;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
}

.slider-header {
    color: var(--color-text-light);
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slider-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-grow: 1;
    padding-bottom: 5px;
    padding-right: 20px;
}

.slider-track::-webkit-scrollbar { height: 6px; }
.slider-track::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 3px; }
.slider-track::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 3px; }

/* Mini Cards for Slider */
.slider-card {
    min-width: 220px;
    max-width: 220px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.slider-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 10px 25px rgba(225, 192, 0, 0.3);
}

.slider-card.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary);
}

.slider-card-img {
    height: 80px; /* Big enough to clearly see cars/icons */
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 5px;
}
.slider-card-img img {
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated; /* Essential for tiny Minecraft items */
}

.slider-card-price {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.8);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid var(--color-primary);
}

.slider-card-info {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.slider-card-title {
    color: white;
    font-size: 0.9em;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.slider-card-limit {
    color: #ff5555;
    font-size: 0.75em;
    margin-top: 5px;
}

/* ================================== */
/* FLOATING RIGHT INFO PANEL          */
/* ================================== */
.item-info-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 240px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(225, 192, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.item-info-panel.hidden {
    display: none;
}

.item-info-panel::-webkit-scrollbar { width: 5px; }
.item-info-panel::-webkit-scrollbar-track { background: transparent; }
.item-info-panel::-webkit-scrollbar-thumb { background: var(--color-primary); }

.info-title {
    color: var(--color-primary);
    font-size: 1.8em;
    margin-bottom: 5px;
    line-height: 1.2;
}
.info-category {
    color: #888;
    font-size: 0.85em;
    text-transform: uppercase;
    margin-bottom: 15px;
}

/* Color Picker */
.color-picker-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.color-picker-title {
    color: white;
    font-size: 0.9em;
    margin-bottom: 10px;
}
.color-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #555;
    transition: all 0.2s ease;
    background-size: cover;
    background-position: center;
    position: relative; /* For the cross pseudoelement */
}
.color-btn:hover {
    transform: scale(1.1);
}
.color-btn.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary);
}

/* ================================== */
/* EXTRAS E-COMMERCE 2D GRID STORE    */
/* ================================== */
.extras-store-container {
    position: absolute;
    top: 80px; /* Below navbar */
    left: 280px; /* Sidebar width */
    width: calc(100vw - 280px);
    height: calc(100vh - 80px);
    background: url('../images/pattern.png') repeat, radial-gradient(circle at center, #1b281f 0%, #0d120f 100%);
    z-index: 10;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.extras-store-container.hidden {
    display: none;
}

.extras-title {
    color: var(--color-primary);
    font-size: 2em;
    margin-bottom: 25px;
    border-bottom: 2px solid rgba(225, 192, 0, 0.3);
    padding-bottom: 10px;
}

.extras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.extra-item-card {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(225, 192, 0, 0.2);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.extra-item-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 10px 25px rgba(225, 192, 0, 0.2);
}

.extra-item-name {
    color: white;
    font-size: 1.3em;
    margin-bottom: 10px;
    font-weight: bold;
}

.extra-item-desc {
    color: #aaa;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.extra-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.extra-item-price {
    color: var(--color-primary);
    font-size: 1.4em;
    font-weight: bold;
}

.extra-item-buy-btn {
    background: rgba(30, 77, 43, 0.8);
    border: 1px solid var(--color-primary);
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.extra-item-buy-btn:hover {
    background: var(--color-primary);
    color: black;
}

/* Unavailable color cross overlay */
.color-btn.unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 3px;
    background: red;
    transform: translate(-50%, -50%) rotate(45deg);
    box-shadow: 0 0 2px black;
    border-radius: 2px;
    z-index: 2;
}
.color-btn.unavailable::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 3px;
    background: red;
    transform: translate(-50%, -50%) rotate(-45deg);
    box-shadow: 0 0 2px black;
    border-radius: 2px;
    z-index: 2;
}

.action-buy-btn {
    width: 100%;
    padding: 15px;
    background: var(--color-dark-green);
    color: white;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.action-buy-btn:hover {
    background: var(--color-primary);
    color: black;
    transform: translateY(-2px);
}

/* Mini Stats Grid for Sidebar */
.mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}
.mini-stat-card {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}
.mini-stat-card i {
    color: var(--color-secondary);
    font-size: 1.2em;
    margin-bottom: 5px;
}
.mini-stat-value {
    color: white;
    font-weight: bold;
    font-size: 1em;
    display: block;
}
.mini-stat-label {
    color: #888;
    font-size: 0.7em;
    text-transform: uppercase;
}

.item-desc {
    color: #ccc;
    font-size: 0.9em;
    line-height: 1.5;
    background: rgba(0,0,0,0.4);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* ================================== */
/* MODALS                             */
/* ================================== */
.buy-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.buy-modal-overlay.hidden { display: none; }
.buy-modal-content {
    background: var(--color-dark-green);
    padding: 30px;
    border-radius: 12px;
    border: 2px solid var(--color-primary);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}
.buy-modal-content h2 {
    color: var(--color-primary);
    margin-bottom: 15px;
}
.buy-modal-content p {
    color: white;
    margin-bottom: 25px;
    font-size: 1.1em;
}
.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}
.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
}
.modal-btn.confirm {
    background: var(--color-primary);
    color: black;
}
.modal-btn.cancel {
    background: #444;
    color: white;
}
.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}

/* ================================== */
/* RESPONSIVE CSS                     */
/* ================================== */
@media (max-width: 768px) {
    /* Mobile Layout Transformation */

    /* Sidebar shifts to top horizontal scrolling bar */
    .market-sidebar {
        position: fixed;
        left: 0;
        top: 80px;
        width: 100vw;
        height: auto;
        max-height: 120px;
        border-right: none;
        border-bottom: 2px solid rgba(225, 192, 0, 0.5);
        display: flex;
        flex-direction: column;
        padding: 8px 10px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        background: rgba(10, 15, 12, 0.95);
        z-index: 50;
    }
    .market-sidebar::-webkit-scrollbar { height: 4px; }

    /* Hide sidebar title/brand and controls info */
    .market-sidebar h2, .controls-info-box, .category-group-title {
        display: none !important;
    }
    
    /* FIX: Correct class name for search input (was .search-box, should be .sidebar-search) */
    .sidebar-search {
        margin: 0 0 6px 0;
        min-width: 100%;
        flex-shrink: 0;
    }
    .sidebar-search input {
        padding: 8px 30px 8px 10px;
        font-size: 0.85em;
        width: 100%;
    }
    .sidebar-search .search-icon {
        top: 9px;
    }

    #categoryMenu {
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .category-group-list {
        display: flex;
        flex-direction: row;
        margin: 0; padding: 0;
        gap: 8px;
    }
    .category-item {
        margin: 0;
        padding: 6px 14px;
        font-size: 0.85em;
        border-radius: 20px;
        background: rgba(40,40,40,0.8);
        flex-shrink: 0;
    }
    .category-item:hover, .category-item.active {
        background: var(--color-primary);
        color: black;
    }

    /* Main container offset for taller mobile sidebar */
    .market-main-container {
        padding-top: 200px;
    }

    /* Bottom Slider — collapsible via JS toggle */
    .bottom-slider-container {
        position: fixed;
        bottom: 0px;
        left: 0;
        width: 100vw;
        border-radius: 12px 12px 0 0;
        padding-left: 0; 
        z-index: 40;
        max-height: 180px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .slider-header {
        font-size: 0.85em;
        padding: 6px 10px;
    }
    .slider-track {
        padding: 8px;
        gap: 10px;
    }
    .slider-card {
        min-width: 110px;
        height: 95px;
    }
    .slider-card-info { padding: 4px; }
    .slider-card-title { font-size: 0.75em; }
    .slider-card-img img {
        max-height: 38px;
    }

    /* Right Info Panel — collapsible via JS toggle */
    .item-info-panel {
        position: fixed;
        right: auto;
        left: 2vw;
        top: 200px;
        width: 96vw;
        max-height: calc(100vh - 400px);
        margin-bottom: 20px;
        padding: 10px 15px;
        gap: 8px;
        font-size: 0.85em;
        z-index: 45;
        border-radius: 12px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        will-change: transform;
    }
    /* Consistent hidden mechanism on mobile */
    .item-info-panel.hidden {
        display: none;
    }
    .action-buy-btn {
        padding: 10px;
        font-size: 0.95em;
        margin-top: 5px;
    }

    /* Extras Web Store */
    .extras-store-container {
        top: 200px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 200px);
        padding: 15px;
        padding-bottom: 50px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .extras-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* 3D Canvas — reduce interactions on mobile */
    .market-3d-canvas {
        pointer-events: none;
        z-index: 0;
    }

    /* Performance: GPU acceleration hints */
    .slider-card, .category-item, .item-info-panel {
        will-change: auto;
        transform: translateZ(0);
    }

    /* Buy modal mobile */
    .buy-modal-content {
        width: 90vw;
        padding: 20px;
    }
}

/* ==================================================== */
/* FINANCE & BORSA SYSTEM STYLES (NEW)                  */
/* ==================================================== */

.finance-panel-container {
    position: absolute;
    top: 74px; /* Aligned with sidebar top */
    left: 280px;
    width: calc(100vw - 280px);
    height: calc(100vh - 74px);
    background: radial-gradient(circle at top right, #112015 0%, #060a08 100%);
    z-index: 12;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Legal warning banner */
.finance-alert-banner {
    background: rgba(229, 57, 53, 0.1);
    border: 1px solid rgba(229, 57, 53, 0.4);
    border-radius: 8px;
    padding: 12px 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-icon {
    color: #ff3333;
    font-size: 1.4em;
    animation: flash-red 1.5s infinite alternate;
}

@keyframes flash-red {
    from { opacity: 0.5; filter: drop-shadow(0 0 1px #ff3333); }
    to { opacity: 1.0; filter: drop-shadow(0 0 8px #ff3333); }
}

.finance-alert-banner span {
    font-size: 0.9em;
    color: #ffd2d2;
    line-height: 1.4;
}

/* Wallet Cards & Top Stats */
.finance-header-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.wallet-stat-card {
    background: rgba(20, 30, 24, 0.85);
    border: 1px solid rgba(225, 192, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: transform 0.2s;
}

.wallet-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.coin-pixel-img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.stat-icon-wrapper {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    color: var(--color-primary);
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-val {
    color: white;
    font-size: 1.25em;
    font-weight: 800;
    font-family: 'Poppins';
}

.stat-lbl {
    color: #888;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.text-secondary .stat-val { color: #80ffd2; }
.text-danger .stat-val { color: #ff5555; }

/* News Ticker */
.news-ticker-container {
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(225, 192, 0, 0.15);
    border-radius: 6px;
    height: 36px;
    display: flex;
    align-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.ticker-label {
    background: var(--color-primary);
    color: black;
    font-weight: 800;
    font-size: 0.8em;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border-radius: 4px 0 0 4px;
}

.ticker-wrapper {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.ticker-text {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: ticker-slide 30s linear infinite;
    color: #00ff66;
    font-size: 0.85em;
    font-weight: 500;
    font-family: 'Courier New', Courier, monospace;
}

@keyframes ticker-slide {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Columns Setup */
.finance-main-content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 25px;
    align-items: start;
}

.finance-section-card {
    background: rgba(15, 20, 17, 0.9);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 25px;
}

.card-sec-title {
    font-size: 1.2em;
    color: white;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.border-accent-gold { border-color: rgba(225, 192, 0, 0.4); }
.border-accent-primary { border-color: rgba(30, 77, 43, 0.6); }
.border-accent-danger { border-color: rgba(229, 57, 53, 0.4); }

.color-gold { color: var(--color-primary) !important; }
.color-primary { color: #80ffd2 !important; }
.color-danger { color: #ff5555 !important; }

/* Borsa Table styling */
.table-responsive {
    overflow-x: auto;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 5px;
}

.borsa-table {
    width: 100%;
    border-collapse: collapse;
}

.borsa-table th, .borsa-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.9em;
    color: #e0e0e0;
}

.borsa-table th {
    color: #888888;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    text-align: left;
}

.ore-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ore-name-cell span {
    color: #ffffff;
    font-weight: 500;
}

.ore-pixel-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
}

.txt-center { text-align: center; }
.txt-right { text-align: right; }
.font-bold { font-weight: bold; }

.trend-up { color: #00ff88; font-weight: bold; }
.trend-down { color: #ff4d4d; font-weight: bold; }
.trend-stable { color: #888; }

/* Smelter specific classes */
.smelter-disclaimer-box {
    background: rgba(225, 192, 0, 0.05);
    border-left: 3px solid var(--color-primary);
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.8em;
    color: #e1c000;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.smelter-disclaimer-box i {
    font-size: 1.3em;
}

.smelter-grid-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: #aaa;
    font-size: 0.8em;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: rgba(0,0,0,0.6);
    border: 1px solid #333;
    border-radius: 6px;
    color: white;
    padding: 10px;
    font-size: 0.9em;
    outline: none;
}

.form-control:focus {
    border-color: var(--color-primary);
}

.input-group {
    display: flex;
    gap: 5px;
}

.input-group .form-control {
    flex-grow: 1;
}

.btn-secondary {
    background: #333;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 12px;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.8em;
}

.btn-secondary:hover {
    background: #444;
}

.smelter-payout-box {
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.03);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payout-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    color: #aaa;
}

.total-row {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
    font-size: 1em;
    color: white;
}

.btn-smelter-fire {
    width: 100%;
    background: linear-gradient(135deg, #e65c00 0%, #f9d423 100%);
    border: none;
    color: black;
    font-weight: bold;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05em;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(230, 92, 0, 0.4);
    transition: all 0.3s ease;
}

.btn-smelter-fire:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(230, 92, 0, 0.6);
    filter: brightness(1.1);
}

/* Player simulated inventory grid */
.player-inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 5px;
}

.inventory-item-card {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 6px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.inventory-item-card:hover {
    background: rgba(225, 192, 0, 0.05);
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.inventory-item-card .item-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 5px;
}

.inventory-item-card .item-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.85);
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
}

.inventory-item-card .item-name {
    font-size: 0.65em;
    color: #aaa;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Simulator items */
.sim-btn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.btn-sim-event {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: #ccc;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.btn-sim-event:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.btn-sim-event.active {
    background: rgba(30, 77, 43, 0.4);
    border-color: #80ffd2;
    color: #80ffd2;
}

.btn-sim-looted.active {
    background: rgba(229, 57, 53, 0.2);
    border-color: #ff5555;
    color: #ff5555;
}

/* VIP Store Grid & Cards */
.vip-store-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 992px) {
    .vip-store-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .vip-store-grid {
        grid-template-columns: 1fr;
    }
}

.vip-item-store-card {
    background: rgba(20, 24, 21, 0.95);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.vip-item-store-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    box-shadow: 0 10px 25px rgba(225, 192, 0, 0.15);
}

.vip-card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(30, 77, 43, 0.8);
    border: 1px solid #80ffd2;
    color: #80ffd2;
    font-size: 0.65em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.vip-card-icon-area {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.vip-card-img {
    height: 80px;
    object-fit: contain;
    image-rendering: pixelated;
}

.vip-card-body {
    flex-grow: 1;
    margin-bottom: 20px;
}

.vip-card-title {
    color: white;
    font-size: 1.05em;
    font-weight: bold;
    margin-bottom: 8px;
}

.vip-card-desc {
    color: #888;
    font-size: 0.8em;
    line-height: 1.5;
}

.vip-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 15px;
}

.vip-card-price {
    color: var(--color-primary);
    font-weight: 800;
    font-size: 1.25em;
}

.vip-card-buy-btn {
    background: rgba(30, 77, 43, 0.8);
    border: 1px solid var(--color-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    transition: all 0.2s;
}

.vip-card-buy-btn:hover {
    background: var(--color-primary);
    color: black;
}

/* Personal web vault list & rows */
.vault-bridge-disclaimer {
    background: rgba(0, 162, 255, 0.05);
    border-left: 3px solid #00a2ff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.8em;
    color: #ffd2d2;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    line-height: 1.4;
}

.vault-bridge-disclaimer i {
    font-size: 1.3em;
    color: #00a2ff;
}

.web-vault-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vault-item-row {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.vault-item-row:hover {
    background: rgba(255,255,255,0.02);
}

.v-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.v-item-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.v-item-details {
    display: flex;
    flex-direction: column;
}

.v-item-name {
    color: white;
    font-size: 0.9em;
    font-weight: bold;
}

.v-item-date {
    color: #666;
    font-size: 0.7em;
    margin-top: 3px;
}

.v-item-bridge-btn {
    background: linear-gradient(135deg, #0082c8 0%, #00a2ff 100%);
    border: none;
    color: white;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.v-item-bridge-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 162, 255, 0.4);
}

.empty-vault-text {
    text-align: center;
    color: #555;
    font-size: 0.85em;
    padding: 30px;
    border: 1px dashed rgba(255,255,255,0.04);
    border-radius: 8px;
}

/* ==================================================== */
/* PORTAL OVERLAY & ANIMATION                          */
/* ==================================================== */

.portal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(5, 10, 8, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.portal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.portal-ring {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid #00a2ff;
    position: relative;
    box-shadow: 0 0 25px #00a2ff, inset 0 0 25px #00a2ff;
    animation: rotate-portal 4s linear infinite;
    margin-bottom: 30px;
    background: radial-gradient(circle, rgba(0, 162, 255, 0.3) 0%, transparent 70%);
}

@keyframes rotate-portal {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.05); }
    100% { transform: rotate(360deg) scale(1); }
}

.portal-title {
    color: white;
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.portal-status {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 25px;
}

.portal-progress-bar {
    width: 250px;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}

.portal-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0082c8 0%, #80ffd2 100%);
    box-shadow: 0 0 10px #80ffd2;
    transition: width 0.3s ease;
}

/* ==================================================== */
/* RESPONSIVE LAYOUT FOR FINANCE PANELS                 */
/* ==================================================== */

@media (max-width: 768px) {
    .finance-panel-container {
        left: 0;
        top: 200px; /* Aligned with mobile top sidebar */
        width: 100vw;
        height: calc(100vh - 200px);
        padding: 15px;
    }

    .finance-main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .finance-header-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .smelter-grid-container {
        grid-template-columns: 1fr;
    }
}

/* Override when placed inside LOA_SOCIAL page */
.social-page .finance-panel-container {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: 1100px;
    margin: 40px auto;
    min-height: auto;
    height: auto;
    background: rgba(18, 18, 18, 0.7) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 30px;
    box-sizing: border-box;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.4s ease-out;
    display: none;
}

/* Explicit Bright Colors inside Finance Panel to override global dark theme styles */
.finance-panel-container {
    color: #e0e0e0 !important;
}

.finance-panel-container h1,
.finance-panel-container h2,
.finance-panel-container h3,
.finance-panel-container h4,
.finance-panel-container h5,
.finance-panel-container h6 {
    color: #ffffff !important;
}

.finance-panel-container p,
.finance-panel-container label,
.finance-panel-container span:not(.trend-up):not(.trend-down):not(.trend-stable):not(.color-gold):not(.color-primary):not(.color-danger):not(.vip-card-price):not(.vip-card-badge):not(.stat-val) {
    color: #cccccc !important;
}

.finance-panel-container td {
    color: #e0e0e0 !important;
}

.finance-panel-container select,
.finance-panel-container option {
    color: #ffffff !important;
    background-color: #151b18 !important;
}

.vip-card-desc {
    color: #bbbbbb !important;
}

.v-item-date {
    color: #aaaaaa !important;
}

/* Borsa Sorting Container Styles */
.borsa-sort-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sort-title {
    font-size: 0.8em !important;
    color: #888888 !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sort-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sort-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #bbbbbb !important;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.15);
}

.sort-btn.active {
    background: var(--color-primary) !important;
    color: #0f1411 !important;
    border-color: var(--color-primary) !important;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(128, 255, 210, 0.2);
}
