/* ================================================================
   trAIding Cards – NFT Marketplace Design System
   ================================================================ */

:root {
    --bg:        #0d0d14;
    --bg2:       #13131f;
    --bg3:       #1c1c2e;
    --bg4:       #25253e;
    --accent:    #7c3aed;
    --accent2:   #a78bfa;
    --glow:      rgba(124, 58, 237, 0.3);
    --gradient:  linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
    --text:      #f0f0f8;
    --text2:     #9898b8;
    --text3:     #55556e;
    --gold:      #f59e0b;
    --green:     #22c55e;
    --red:       #ef4444;
    --border:    rgba(124, 58, 237, 0.15);
    --border2:   rgba(124, 58, 237, 0.4);
    --h:         64px;
    --r:         12px;
    --r-sm:      8px;
    --r-lg:      20px;
    --shadow:    0 8px 40px rgba(0,0,0,0.55);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    line-height: 1.6;
}
a { color: var(--accent2); text-decoration: none; }
input, button, textarea, select { font-family: inherit; }

/* ── Background ── */
.background-container {
    position: fixed; inset: 0;
    background:
        radial-gradient(ellipse 110% 55% at 50% -5%, rgba(124,58,237,0.10) 0%, transparent 60%),
        radial-gradient(ellipse 60% 45% at 95% 100%, rgba(192,38,211,0.06) 0%, transparent 55%),
        var(--bg);
    pointer-events: none;
    z-index: 0;
}

/* ================================================================
   HEADER
   ================================================================ */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--h);
    background: rgba(10,10,18,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 900;
}

.header-inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-logo {
    font-family: 'Vinque', serif;
    font-size: 1.15rem;
    color: var(--text);
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
}
.site-logo span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-item {
    padding: 7px 13px;
    border-radius: var(--r-sm);
    color: var(--text2);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    background: none;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-item.active { color: var(--accent2); background: rgba(124,58,237,0.13); }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: var(--r-sm);
    padding: 7px 10px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); border-color: var(--border2); }

.wallet-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245,158,11,0.10);
    border: 1px solid rgba(245,158,11,0.25);
    color: var(--gold);
    border-radius: var(--r-sm);
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
}
.wallet-btn:hover { background: rgba(245,158,11,0.18); }

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 6px 14px;
    font-size: 0.875rem;
    color: var(--text);
}

.connect-btn {
    display: inline-flex;
    align-items: center;
    background: var(--gradient);
    color: #fff !important;
    border: none;
    border-radius: var(--r-sm);
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}
.connect-btn:hover { opacity: 0.85; }

.badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 16px; height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ================================================================
   PAGE LAYOUT
   ================================================================ */
.page-wrapper {
    min-height: 100vh;
    padding-top: calc(var(--h) + 32px);
    padding-bottom: 64px;
    position: relative;
    z-index: 1;
}

.page-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 28px;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-family: 'Vinque', serif;
    font-size: 1.75rem;
    color: var(--text);
    margin: 0 0 6px;
}

.page-subtitle {
    color: var(--text2);
    font-size: 0.9rem;
    margin: 0;
}

/* ================================================================
   CARD GRID & NFT CARDS
   ================================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    gap: 20px;
}

.inventory-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.inventory-card:hover {
    transform: translateY(-7px);
    border-color: var(--border2);
    box-shadow: 0 18px 50px rgba(124,58,237,0.2);
}
.inventory-card img {
    width: 100%;
    height: 195px;
    object-fit: cover;
    display: block;
}

.inv-card-info { padding: 14px; }

.inv-card-name {
    font-family: 'Vinque', serif;
    font-size: 0.92rem;
    color: var(--text);
    margin: 6px 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-card-status { font-size: 0.75rem; color: var(--text2); margin: 2px 0; }
.inv-card-status.processing { color: #fb923c; }
.inv-card-status.ready      { color: var(--green); }

.stats-mini {
    font-size: 0.72rem;
    color: var(--text3);
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Rarity Badge ── */
.rarity-badge-small {
    font-size: 0.68rem;
    padding: 3px 9px;
    border: 1px solid;
    border-radius: 999px;
    display: inline-block;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

/* ================================================================
   TABS
   ================================================================ */
.tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 4px;
}

.tab-btn {
    padding: 8px 22px;
    background: none;
    color: var(--text2);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.tab-btn.active { background: var(--accent); color: #fff; font-weight: 600; }
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.06); color: var(--text); }

/* ================================================================
   BUTTONS
   ================================================================ */
.action-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.12s;
    font-family: 'Vinque', serif;
    text-align: center;
}
.action-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.small-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: rgba(124,58,237,0.12);
    color: var(--accent2);
    border: 1px solid rgba(124,58,237,0.28);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.small-btn:hover { background: rgba(124,58,237,0.24); border-color: rgba(124,58,237,0.5); color: #fff; }

/* ================================================================
   SECTION BOX & FORMS
   ================================================================ */
.section-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-family: 'Vinque', serif;
    font-size: 1rem;
    color: var(--text);
    margin: 0 0 14px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border2);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 0.95rem;
    box-sizing: border-box;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.form-input:focus { border-color: var(--accent2); background: rgba(255,255,255,0.07); }
.form-input::placeholder { color: var(--text3); }

/* ── Upload Area ── */
.upload-area {
    border: 2px dashed rgba(124,58,237,0.35);
    border-radius: var(--r);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 16px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover { border-color: var(--accent2); background: rgba(124,58,237,0.05); }
.upload-hint { color: var(--text3); font-size: 0.9rem; margin: 0; }

/* ── Card Preview ── */
.card-preview {
    max-width: 100%; max-height: 300px;
    border-radius: var(--r-sm);
    margin: 12px auto;
    display: block;
}
.card-name-text {
    font-family: 'Vinque', serif;
    font-size: 1.15rem; color: var(--text);
    text-align: center; margin: 8px 0;
}
.card-desc-text {
    font-size: 0.85rem; color: var(--text2);
    line-height: 1.5; max-height: 80px;
    overflow: hidden; margin: 6px 0; text-align: center;
}

/* ── Stats Row ── */
.stats-row {
    display: flex;
    justify-content: space-around;
    font-size: 0.875rem;
    color: var(--text2);
    background: rgba(255,255,255,0.03);
    border-radius: var(--r-sm);
    padding: 10px;
}

/* ================================================================
   RARITY REVEAL
   ================================================================ */
.rarity-reveal { text-align: center; padding: 10px 0; }

.rarity-badge {
    font-family: 'Vinque', serif;
    font-size: 1.5rem;
    padding: 10px 24px;
    border: 2px solid;
    border-radius: var(--r-sm);
    display: inline-block;
    margin-bottom: 14px;
    animation: rarityAppear 0.5s ease-out;
}
@keyframes rarityAppear {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── Roll button pulse ── */
.rarity-roll-btn {
    animation: pulse 2s ease-in-out infinite;
}

/* ================================================================
   CARD FLIP ANIMATION
   ================================================================ */
.card-flip-container {
    perspective: 1000px;
    width: 280px; height: 380px;
    margin: 0 auto 20px;
}
.card-flip-inner {
    position: relative;
    width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4,0,0.2,1);
}
.card-flip-inner.flipped { transform: rotateY(180deg); }

.card-flip-front, .card-flip-back {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    border-radius: var(--r);
    overflow: hidden;
}
.card-flip-front {
    background: linear-gradient(135deg, var(--bg2), var(--bg3));
    border: 2px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
}
.card-back-design { font-size: 5rem; color: rgba(124,58,237,0.38); user-select: none; }
.card-flip-back { transform: rotateY(180deg); }

.revealed-card {
    width: 100%; height: 100%;
    border: 2px solid;
    border-radius: var(--r);
    overflow: hidden;
    display: flex; flex-direction: column;
    background: var(--bg2);
}
.revealed-card img { width: 100%; height: 205px; object-fit: cover; }
.card-info-overlay { padding: 12px; flex: 1; }

/* ================================================================
   SPINNER
   ================================================================ */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(124,58,237,0.18);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 16px;
    box-sizing: border-box;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.modal-box {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--r-lg);
    padding: 28px 24px;
    width: 100%; max-width: 680px;
    max-height: 90vh; overflow-y: auto;
    position: relative;
    color: var(--text);
    box-sizing: border-box;
    box-shadow: var(--shadow), 0 0 80px var(--glow);
}
.modal-close-btn {
    position: absolute; top: 14px; right: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 0.95rem; cursor: pointer;
    padding: 4px 9px; border-radius: var(--r-sm);
    transition: all 0.15s; line-height: 1.4;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.modal-title {
    font-family: 'Vinque', serif;
    color: var(--text); font-size: 1.3rem;
    margin: 0 0 4px; text-align: center;
}
.modal-subtitle { color: var(--text2); font-size: 0.82rem; text-align: center; margin: 0 0 4px; }

/* ================================================================
   LORE LOG
   ================================================================ */
.lore-list { list-style: none; padding: 0; margin: 0; }
.lore-entry {
    padding: 8px 14px;
    border-left: 3px solid var(--accent);
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text2);
    background: rgba(124,58,237,0.05);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    line-height: 1.5;
}

/* ================================================================
   POOL PAGE
   ================================================================ */
.pool-info { text-align: center; }
.pool-info p { font-size: 1.05rem; }

.draw-btn {
    background: var(--gradient) !important;
    font-size: 1.3rem !important;
    padding: 16px !important;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%,100% { box-shadow: 0 0 16px var(--glow); }
    50%      { box-shadow: 0 0 42px var(--glow), 0 0 70px rgba(192,38,211,0.25); }
}

/* ================================================================
   NOTIFICATIONS
   ================================================================ */
.notif-item {
    padding: 10px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item.unread {
    background: rgba(124,58,237,0.10);
    border-left: 3px solid var(--accent2);
    color: var(--text);
}
.notif-item.read { background: rgba(255,255,255,0.03); color: var(--text3); }
.notif-time { display: block; font-size: 0.72rem; color: var(--text3); margin-top: 3px; }
.notif-badge {
    background: var(--red); color: #fff;
    padding: 2px 7px; border-radius: 999px;
    font-size: 0.75rem; margin-left: 6px;
}

/* ================================================================
   UPLOAD PAGE – AUTH CARD
   ================================================================ */
.upload-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 32px;
    width: 100%;
    max-width: 560px;
    color: var(--text);
    box-sizing: border-box;
    margin: 0 auto;
}

/* ── legacy compat ── */
.centered-text { text-align: center; font-family: 'Vinque', serif; font-size: 1.6rem; color: var(--text); margin-top: 0; }
.light-text     { color: var(--text); }
.small-text     { font-size: 0.85rem; color: var(--text2); text-align: center; }
.error-text     { color: var(--red); font-size: 0.85rem; margin-top: 6px; text-align: center; }
.highlight-text { color: var(--gold); font-size: 1.25rem; }
.subtitle       { text-align: center; font-size: 0.92rem; color: var(--text2); margin-bottom: 20px; }

/* ── Wallet topup btn inside page ── */
.wallet-topup-btn {
    background: rgba(245,158,11,0.12) !important;
    color: var(--gold) !important;
    border-color: rgba(245,158,11,0.3) !important;
    font-weight: 600 !important;
}
.wallet-topup-btn:hover { background: rgba(245,158,11,0.22) !important; }

/* ── Btn row ── */
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ── Nav links (inside content, compat) ── */
.nav-links { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

/* ================================================================
   RARITY GLOW EFFECTS
   ================================================================ */
.rarity-common   { border-color: #a8a8c0 !important; }
.rarity-rare     { border-color: #93c5fd !important; box-shadow: 0 0 14px rgba(147,197,253,0.25) !important; }
.rarity-epic     { border-color: #fbbf24 !important; box-shadow: 0 0 20px rgba(251,191,36,0.28) !important; }
.rarity-legendary {
    border-color: #f97316 !important;
    box-shadow: 0 0 28px rgba(249,115,22,0.38) !important;
    animation: legendaryGlow 2s ease-in-out infinite;
}
@keyframes legendaryGlow {
    0%,100% { box-shadow: 0 0 22px rgba(249,115,22,0.38); }
    50%      { box-shadow: 0 0 52px rgba(249,115,22,0.68), 0 0 80px rgba(239,68,68,0.28); }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
    .header-nav { display: none; }
    .header-inner { padding: 0 16px; gap: 12px; }
    .page-content { padding: 0 16px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
}

@media (max-width: 600px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
    .inventory-card img { height: 155px; }
    .modal-box { padding: 20px 16px; border-radius: var(--r); }
    .tabs { display: flex; width: 100%; }
    .tab-btn { flex: 1; text-align: center; padding: 8px 8px; font-size: 0.8rem; }
    .page-title { font-size: 1.4rem; }
    .upload-card { padding: 20px 16px; border-radius: var(--r); }
}
