/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --dark-900: #0f0f1a;
    --dark-800: #1a1a2e;
    --dark-700: #25254a;
    --dark-600: #2d2d5e;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --gold: #fdcb6e;
    --gold-light: #ffeaa7;
    --pink: #e84393;
    --success: #00b894;
    --danger: #d63031;
    --text: #dfe6e9;
    --text-muted: #b2bec3;
    --text-dim: #636e72;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --glow: 0 0 20px rgba(108,92,231,0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--dark-900);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(108,92,231,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232,67,147,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(108,92,231,0.03) 0%, transparent 50%);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--dark-900); }
::-webkit-scrollbar-thumb { background: var(--dark-600); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(108, 92, 231, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--pink));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
}

.header-logo-text {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    gap: 4px;
    margin-left: 40px;
    flex: 1;
    overflow-x: auto;
    padding: 4px 0;
}

.header-nav::-webkit-scrollbar { display: none; }

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(108, 92, 231, 0.1);
    color: var(--text-muted);
}

.nav-btn.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-light);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.nav-btn i { font-size: 15px; }

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
    margin-left: auto;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.4);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== MAIN LAYOUT ===== */
.main-content {
    margin-top: 64px;
    padding: 24px 32px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.page { display: none; }
.page.active { display: block; animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-left h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header-left p {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 2px;
}

/* ===== STATS ROW ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    position: relative;
    background: linear-gradient(135deg, var(--dark-800), var(--dark-700));
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: var(--radius);
    padding: 20px 24px;
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(108, 92, 231, 0.05));
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(108, 92, 231, 0.25);
    box-shadow: var(--glow);
}

.stat-card .icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
    font-weight: 500;
}

.icon-purple { background: rgba(108, 92, 231, 0.15); color: var(--accent-light); }
.icon-gold { background: rgba(253, 203, 110, 0.15); color: var(--gold); }
.icon-green { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.icon-pink { background: rgba(232, 67, 147, 0.15); color: var(--pink); }

/* ===== CARDS ===== */
.card {
    background: linear-gradient(135deg, var(--dark-800), rgba(37, 37, 74, 0.8));
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
}

.card:hover {
    border-color: rgba(108, 92, 231, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== CHART ===== */
.chart-box {
    background: rgba(15, 15, 26, 0.5);
    border-radius: var(--radius-sm);
    padding: 12px;
    position: relative;
    height: 280px;
}

.chart-box canvas { max-height: 256px !important; width: 100% !important; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: rgba(15, 15, 26, 0.4);
    border-bottom: 1px solid rgba(108, 92, 231, 0.1);
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(108, 92, 231, 0.06);
    white-space: nowrap;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: rgba(108, 92, 231, 0.06); }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
}

.badge-legendary { background: linear-gradient(135deg, rgba(255,165,0,0.2), rgba(255,215,0,0.1)); color: #ffa500; }
.badge-epic { background: linear-gradient(135deg, rgba(155,89,182,0.2), rgba(155,89,182,0.1)); color: #bb8fce; }
.badge-rare { background: rgba(52,152,219,0.15); color: #5dade2; }
.badge-uncommon { background: rgba(46,204,113,0.15); color: var(--success); }
.badge-common { background: rgba(149,165,166,0.15); color: #bdc3c7; }
.badge-jackpot { background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.1)); color: var(--gold); }

/* ===== INPUTS ===== */
.input {
    background: var(--dark-700);
    border: 1px solid rgba(108, 92, 231, 0.15);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder { color: var(--text-dim); }

.select {
    background: var(--dark-700);
    border: 1px solid rgba(108, 92, 231, 0.15);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    min-width: 140px;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b2bec3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    color: white;
    box-shadow: 0 4px 15px rgba(108,92,231,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108,92,231,0.4);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(108, 92, 231, 0.2);
    color: var(--text-muted);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ===== LOADING ===== */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(108, 92, 231, 0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-skeleton {
    background: linear-gradient(90deg, var(--dark-700) 25%, var(--dark-600) 50%, var(--dark-700) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== AUCTION CARDS ===== */
.auction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.auction-card {
    background: linear-gradient(135deg, var(--dark-800), rgba(37, 37, 74, 0.8));
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s;
}

.auction-card:hover {
    transform: translateY(-3px);
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), var(--glow);
}

.auction-card .item-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.auction-card .item-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(15, 15, 26, 0.6);
    object-fit: contain;
    padding: 4px;
    flex-shrink: 0;
}

.auction-card .item-info h4 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.auction-card .item-info .cat {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}

.auction-card .price-big {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: -0.5px;
}

.auction-card .meta {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(108, 92, 231, 0.08);
    font-size: 12px;
    color: var(--text-dim);
}

.auction-card .meta span { display: flex; align-items: center; gap: 4px; }

/* ===== SUB TABS ===== */
.sub-tabs {
    display: flex;
    gap: 4px;
    background: rgba(15, 15, 26, 0.5);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    border: 1px solid rgba(108, 92, 231, 0.08);
}

.sub-tab {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-tab:hover { color: var(--text-muted); }
.sub-tab.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-light);
}

/* ===== TAG ===== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(15, 15, 26, 0.5);
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: var(--radius-xs);
    font-size: 12px;
    color: var(--text-dim);
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open { display: flex; animation: fadeIn 0.2s; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: linear-gradient(135deg, var(--dark-800), var(--dark-700));
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--text); }

.modal-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-right: 32px;
}

.lore-box {
    font-style: italic;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
    background: rgba(15, 15, 26, 0.6);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    border-left: 3px solid var(--accent);
}

.enchant-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent-light);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    margin: 2px;
}

/* ===== RATES ===== */
.rate-result {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

/* ===== PRICE ===== */
.text-green { color: var(--success); }
.text-red { color: var(--danger); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .header-nav { margin-left: 16px; }
    .header-status { display: none; }
    .main-content { padding: 16px; }
    .grid-4, .grid-3, .grid-2, .stats-row { grid-template-columns: 1fr; }
    .auction-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .header { padding: 0 12px; }
    .header-logo-text { font-size: 15px; }
    .nav-btn { padding: 6px 10px; font-size: 12px; }
    .nav-btn span { display: none; }
    .main-content { padding: 12px; }
}