:root {
    --bg-main: #0a0a0c;
    --bg-card: #141419;
    --primary: #8a2be2;
    --accent: #00ffcc;
    --text-main: #ffffff;
    --text-muted: #888899;
    --loss-red: #ff3366;
    --win-green: #00ff66;
    --border: #2a2a35;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
}

a {
    color: var(--text-main);
    text-decoration: none;
}

.text-center {
    text-align: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.nav-links a {
    margin-left: 20px;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

.calc-btn {
    background: var(--primary);
    padding: 8px 15px;
    border-radius: 8px;
    color: #fff;
}

.calc-btn:hover {
    background: #7a1cd2;
    color: #fff;
}

/* Hero */
.hero {
    text-align: center;
    padding: 60px 20px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.highlight {
    color: var(--primary);
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 30px;
}

.search-bar input {
    width: 100%;
    max-width: 500px;
    padding: 15px 20px;
    border-radius: 25px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: #fff;
    font-size: 1rem;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
}

/* Grid */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto 50px;
    padding: 0 20px;
}

.item-card {
    background: rgba(20, 20, 25, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.item-card:hover {
    transform: translateY(-8px);
    border-color: rgba(138, 43, 226, 0.6);
    box-shadow: 0 12px 35px rgba(138, 43, 226, 0.25);
    background: rgba(30, 25, 40, 0.8);
}

.item-img-container {
    background: rgba(15, 15, 20, 0.3);
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.item-img-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 204, 0.2));
}

.item-info {
    padding: 15px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.item-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.value-tag {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 5px;
}

.demand-tag {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
    display: inline-block;
}

/* Tags */
.demand-insane {
    background: rgba(138, 43, 226, 0.2);
    color: #c88dff;
}

.demand-high {
    background: rgba(0, 255, 102, 0.2);
    color: var(--win-green);
}

.demand-medium,
.demand-stable {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.demand-low {
    background: rgba(255, 51, 102, 0.2);
    color: var(--loss-red);
}

.trend-up {
    color: var(--win-green);
}

.trend-down {
    color: var(--loss-red);
}

/* Calculator UI */
.calculator-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

@media(min-width: 768px) {
    .calculator-wrapper {
        flex-direction: row;
    }
}

.calc-side {
    flex: 1;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 2px solid var(--border);
    display: flex;
    flex-direction: column;
}

.calc-side h2 {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.slot-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 250px;
    justify-content: center;
    align-items: start;
    align-content: start;
    flex: 1;
}

.calc-slot {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.calc-slot:hover {
    border-color: var(--primary);
    background: rgba(138, 43, 226, 0.1);
}

.calc-slot.filled {
    border-style: solid;
    background: #1c1c24;
}

.calc-slot img {
    max-width: 80%;
    max-height: 50%;
    object-fit: contain;
}

.calc-slot .remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--loss-red);
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.value-total {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

#total-give {
    color: var(--loss-red);
}

#total-get {
    color: var(--win-green);
}

.calc-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.result-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 40px;
    text-align: center;
    border: 3px solid var(--border);
    min-width: 250px;
}

.result-title {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.result-diff {
    display: block;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal {
    background: var(--bg-main);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.modal-search {
    padding: 15px 20px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    color: white;
    font-size: 1rem;
    outline: none;
}

.modal-items {
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    flex: 1;
}

.modal-item {
    background: var(--bg-card);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

.modal-item:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 204, 0.1);
}

.modal-item img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    margin-bottom: 5px;
    border-radius: 6px;
}

.modal-item span {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-item small {
    display: block;
    color: var(--accent);
    font-weight: bold;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    padding: 12px 25px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #7a1cd2;
}

.btn-secondary {
    display: inline-block;
    padding: 12px 25px;
    background: var(--bg-card);
    color: white;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    border: 1px solid var(--border);
    cursor: pointer;
}

.btn-secondary:hover {
    background: #2a2a35;
}

/* Detail View */
.breadcrumb {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary);
}

.detail-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
}

@media(min-width: 768px) {
    .detail-container {
        flex-direction: row;
        align-items: center;
    }
}

.detail-img {
    flex: 1;
    text-align: center;
    background: #1c1c24;
    padding: 40px;
    border-radius: 12px;
}

.detail-img img {
    max-width: 100%;
    filter: drop-shadow(0 0 20px rgba(138, 43, 226, 0.5));
}

.detail-content {
    flex: 2;
    min-width: 0;
}

.detail-content h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    font-size: 0.8rem;
    background: var(--primary);
    padding: 5px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media(min-width: 500px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.stat-box {
    background: #1c1c24;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-box .label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 800;
    display: block;
}

.box-value .value {
    color: var(--accent);
}

.action-box {
    padding: 20px;
    border: 1px solid var(--primary);
    background: rgba(138, 43, 226, 0.05);
    border-radius: 12px;
}

.action-box p {
    margin-bottom: 15px;
    color: var(--text-muted);
}

/* Filtering & Sorting Controls */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.9rem;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.sort-select {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.sort-select:hover {
    border-color: var(--accent);
}

/* Trading Hub Dashboard */
.trading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.trade-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.trade-card {
    background: rgba(20, 20, 25, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.trade-card:hover {
    border-color: rgba(138, 43, 226, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(138, 43, 226, 0.15);
    background: rgba(30, 25, 40, 0.7);
}

.trade-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1c1c24;
    padding-bottom: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info strong {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user-info .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--primary);
}

.user-info .time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-chat {
    background: linear-gradient(135deg, #2b1f3d, var(--primary));
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
}

.trade-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

@media(max-width: 768px) {
    .trade-main {
        flex-direction: column;
    }

    .trade-separator {
        transform: rotate(90deg);
    }
}

.trade-box {
    flex: 1;
    background: rgba(15, 15, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    min-width: 0;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.trade-box h4 {
    color: #a855f7;
    margin-bottom: 15px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.trade-items-flex {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.trade-mini-item {
    background: #1c1c24;
    border-radius: 8px;
    padding: 8px;
    width: 70px;
    border: 1px solid var(--border);
}

.trade-mini-item img {
    width: 100%;
    height: 45px;
    object-fit: contain;
}

.mini-val {
    font-size: 0.7rem;
    color: var(--accent);
    margin-top: 5px;
    font-weight: bold;
}

.trade-box-total {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #1c1c24;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.trade-box-total span {
    color: #ffd700;
    font-weight: bold;
    font-size: 1rem;
}

.trade-separator .arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.trade-message {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ----------------------------------
   Mobile Menu Override
----------------------------------- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        padding: 5px 10px;
    }

    .nav-content {
        flex-wrap: wrap;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        padding-top: 15px;
        gap: 15px;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        text-align: center;
        width: 100%;
        padding: 10px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }
}