@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap');

:root {
    --bg: #0b1120;
    --sidebar: #1e293b;
    --card: rgba(30, 41, 59, 0.8);
    --border: rgba(255, 255, 255, 0.1);
    --accent: #38bdf8;
    --gold: #fbbf24;
    --red: #e11d48;
    --green: #22c55e;
}

body {
    margin: 0; padding: 0; background: var(--bg); color: #f1f5f9;
    font-family: 'Inter', sans-serif; font-size: 18px; line-height: 1.6;
}

.dashboard-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 350px; background: var(--sidebar); border-right: 1px solid var(--border);
    padding: 2rem 1.5rem; flex-shrink: 0; display: flex; flex-direction: column;
}

.brand { font-size: 1.8rem; font-weight: 900; color: var(--accent); margin-bottom: 2rem; text-align: center; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }

.buddy-sidebar-card { text-align: center; margin-bottom: 2rem; background: rgba(0,0,0,0.3); padding: 1.5rem; border-radius: 24px; border: 1px solid var(--border); }
.buddy-img-sidebar { width: 100%; max-height: 220px; object-fit: contain; filter: drop-shadow(0 0 25px rgba(56,189,248,0.4)); }
.buddy-name-sidebar { font-size: 1.8rem; font-weight: 900; margin: 15px 0; color: #fff; }

.bq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.bq-item { background: #0f172a; padding: 10px; border-radius: 12px; border: 1px solid var(--border); }
.bq-item span { display: block; font-size: 0.7rem; color: #64748b; font-weight: 800; text-transform: uppercase; }

.rel-summary-detailed { background: rgba(0,0,0,0.2); padding: 12px; border-radius: 12px; margin-bottom: 1rem; text-align: left; }
.rel-header { font-size: 0.65rem; text-transform: uppercase; color: #64748b; display: block; margin-bottom: 8px; letter-spacing: 1px;}
.rel-grid-text { display: grid; grid-template-columns: 1fr; gap: 5px; }
.rel-row-text { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; font-weight: 800; padding: 4px 8px; }

.btn-social { 
    width: 100%; padding: 12px; background: var(--accent); color: #0b1120; 
    border: none; border-radius: 12px; font-weight: 800; cursor: pointer; transition: 0.2s;
}

.side-nav a, .sync-btn, .logout-btn {
    display: block; width: 100%; text-decoration: none; color: #94a3b8;
    padding: 16px 20px; border-radius: 16px; font-weight: 800; font-size: 1.1rem;
    margin-bottom: 8px; transition: 0.2s; border: 1px solid transparent; cursor: pointer; box-sizing: border-box;
}
.side-nav a:hover, .side-nav a.active { background: var(--accent); color: #0b1120; }
.sync-btn { background: rgba(255,255,255,0.05); border-color: var(--border); color: white; margin-top: 20px; text-align: center;}

.content-area { flex: 1; padding: 3rem 4rem; overflow-y: auto; }

.top-header-card { display: flex; justify-content: space-between; align-items: center; padding: 2.5rem !important; margin-bottom: 2.5rem; }
.user-info h1 { font-size: 2.8rem; margin: 0; font-weight: 900; letter-spacing: -1px; }

.balance-group { text-align: right; }
.balance-group .val { font-size: 3.2rem; font-weight: 900; color: var(--gold); display: block; text-shadow: 0 0 25px rgba(251, 191, 36, 0.3); }

/* Tabs */
.tab-nav { display: flex; gap: 15px; margin-bottom: 2.5rem; border-bottom: 2px solid var(--border); }
.tab-link { background: none; border: none; padding: 15px 30px; color: #64748b; font-weight: 800; font-size: 1.2rem; cursor: pointer; border-bottom: 4px solid transparent; }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; animation: fadeIn 0.4s ease; }
.tab-panel.active { display: block; }

.card { background: var(--card); backdrop-filter: blur(15px); border: 1px solid var(--border); border-radius: 24px; padding: 2rem; box-shadow: 0 15px 35px rgba(0,0,0,0.4); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.stat-box { background: rgba(15,23,42,0.6); padding: 2rem 1.5rem; border-radius: 20px; text-align: center; border: 1px solid var(--border); }
.stat-box .val { display: block; font-size: 2.5rem; font-weight: 900; color: #fff; }
.stat-box .lbl { font-size: 0.8rem; color: #64748b; font-weight: 800; text-transform: uppercase; }

.flex-row { display: flex; gap: 2rem; }
.flex-1 { flex: 1; }

.section-title { font-size: 1.2rem; font-weight: 900; text-transform: uppercase; color: #fff; margin-bottom: 1.5rem; display: block; letter-spacing: 2px; }

.data-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-weight: 700; }
.data-row span { color: #94a3b8; margin-right: 15px; } 
.data-row strong { color: white; }

.breakdown-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-weight: 700; font-size: 1.1rem; }
.breakdown-row span { color: #94a3b8; }
.breakdown-row.total { color: var(--accent); font-size: 1.4rem; border-bottom: 2px solid var(--accent); margin-bottom: 10px; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); backdrop-filter: blur(12px); justify-content: center; align-items: center; z-index: 9999; }
.modal-content { max-width: 850px; width: 95%; position: relative; padding: 2.5rem !important; }
.close-btn { position: absolute; top: 20px; right: 30px; font-size: 3.5rem; cursor: pointer; color: #64748b; }

.modal-body-scroll { max-height: 550px; overflow-y: auto; padding-right: 20px; }

.rel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; } 
.rel-card-compact { background: rgba(15, 23, 42, 0.6); padding: 12px 20px; border-radius: 15px; border: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.market-header-wrap { margin-top: 50px; margin-bottom: 30px; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2.5rem; }

.status-friends { color: var(--green); } .status-enemies { color: var(--red); } .status-rivals { color: #fb923c; } .status-frenemies { color: #a855f7; }

.collection-split {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.skill-item {
    background: rgba(15, 23, 42, 0.4);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
}
.skill-bar-wrap {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 800;
}
.skill-bar-bg {
    height: 8px;
    background: #0f172a;
    border-radius: 10px;
    overflow: hidden;
}
.skill-bar-fill {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.achievement-row {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.03);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}
.achievement-row.locked { opacity: 0.5; filter: grayscale(1); }
.ach-info strong { display: block; font-size: 1rem; color: var(--accent); }
.ach-info small { color: #94a3b8; }

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.market-card {
    padding: 15px !important; 
    text-align: center;
    transition: transform 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.market-card:hover { transform: translateY(-5px); border-color: var(--accent); }

.market-pet-img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    margin: 10px 0;
}

.btn-adopt {
    margin-top: 15px;
    background: var(--accent);
    color: #0b1120;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 900;
    text-transform: uppercase;
    width: 100%;
    cursor: pointer;
}
.btn-adopt:hover { background: #fff; }

.rel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}
.rel-card-rich {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    text-align: center;
}
.rel-card-rich img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}
.rel-card-rich .name { display: block; font-weight: 800; color: #fff; margin-bottom: 5px; }
.rel-card-rich .stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(0,0,0,0.2);
    padding: 5px;
    border-radius: 8px;
}

.filter-bar select {
    background: var(--sidebar);
    color: #fff !important;
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    transition: 0.2s;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="white"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.filter-bar select:hover {
    border-color: var(--accent);
    background-color: #0f172a; 
    color: #fff !important;
}

.filter-bar select option {
    background: #1e293b; 
    color: #fff;
    padding: 10px;
}

.filter-bar:hover {
    border-color: rgba(255,255,255,0.15);
}

.detail-img {
    max-width: 320px !important; 
    max-height: 320px !important; 
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(56, 189, 248, 0.4));
    margin-right: 30px;
}

.detail-flex {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 100%;
}

.tag-pronouns {
    background: rgba(255,255,255,0.1); 
    padding: 2px 10px; 
    border-radius: 20px; 
    font-size: 0.65rem; 
    font-weight: 900; 
    color: #64748b;
    text-transform: uppercase;
}

.btn-edit-small {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-edit-small:hover { opacity: 0.8; }

#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 17, 32, 0.8); 
    backdrop-filter: blur(8px);
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 10000; 
    flex-direction: column;
    gap: 20px;
}

.dragon-loader {
    width: 80px;
    height: 80px;
    border: 4px solid transparent;
    border-top: 4px solid var(--accent);
    border-right: 4px solid var(--accent);
    border-radius: 50%;
    animation: dragon-spin 1s linear infinite;
    position: relative;
}

.dragon-loader::after {
    content: "🐉";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes dragon-spin {
    0% { transform: rotate(0deg); border-top-color: var(--accent); }
    50% { border-top-color: var(--gold); border-right-color: var(--gold); }
    100% { transform: rotate(360deg); border-top-color: var(--accent); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.9); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

#loader-wrapper span {
    color: white;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

.adoption-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.adoption-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px 25px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    border-bottom: 1px solid var(--border);
}

.adoption-table td {
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.adoption-table tr:last-child td {
    border-bottom: none;
}

.adoption-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.rarity-godly { color: #facc15; text-shadow: 0 0 10px rgba(250, 204, 21, 0.3); }
.rarity-hidden { color: #a855f7; }
.rarity-secret { color: #f472b6; }
.rarity-legendary { color: #fb923c; }
.rarity-celestial { color: #38bdf8; }

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.sticker-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    transition: 0.3s;
    position: relative;
}

.sticker-img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 5px;
    transition: 0.3s;
}

.sticker-item.locked {
    opacity: 0.6;
}
.sticker-item.locked .sticker-img {
    filter: grayscale(100%) brightness(0.4);
}

.sticker-item.unlocked {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent);
}
.sticker-item.unlocked:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(56, 189, 248, 0.2);
}

.sticker-name {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    display: block;
    line-height: 1.2;
}

.sticker-item.unlocked .sticker-name {
    color: white;
}

.rarity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    right: 8px;
}

.feature-request-btn {
    width: 100%;
    padding: 12px 15px;
    margin-top: 10px;
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.feature-request-btn:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.feature-request-btn:active {
    transform: translateY(0);
}

.feature-request-btn .icon {
    font-size: 1.1rem;
}

.feature-request-btn .text {
    letter-spacing: 0.5px;
}

.external-links {
    display: flex;
    gap: 10px;
}

.external-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.external-link::before {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    transition: all 0.2s ease;
    opacity: 0;
    border: 1px solid var(--border);
}

.external-link:hover::before {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

.discord-link {
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    border: 1px solid rgba(88, 101, 242, 0.3);
    color: white;
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.2);
}

.discord-link:hover {
    background: linear-gradient(135deg, #4752C4 0%, #3C45A5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(88, 101, 242, 0.4);
}

.shop-link {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.shop-link:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.external-link:active {
    transform: translateY(0);
}