/* --- 1. Variables & Base Setup --- */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg: #0f172a;        /* Deep Midnight Blue */
    --card-bg: #1e293b;   /* Slate Blue */
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --owned: rgba(34, 197, 94, 0.15); /* Soft Green Glow */
    --want: rgba(234, 179, 8, 0.15);  /* Soft Yellow Glow */
    --border: #334155;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    
    /* --- FIXES SIDE-SCROLLING --- */
    padding: 10px; 
    width: 100%;
    overflow-x: hidden; /* Prevents horizontal movement */
    /* ---------------------------- */

    padding-bottom: 120px; /* Space for fixed bottom nav */
    line-height: 1.5;
}

/* --- 2. Header & Artist Filters --- */
.header-sticky {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
    padding-top: 10px;
    width: 100%;
}

#artist-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 15px;
    scrollbar-width: none; /* Firefox */
    width: 100%; /* Ensures filter bar respects screen width */
}

#artist-filters::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.btn {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 20px;
    white-space: nowrap; /* Keeps button text on one line */
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* --- 3. The Grid System (Mobile First) --- */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Exactly 2 cards side-by-side */
    gap: 10px; /* --- REDUCED GAP TO PREVENT OVERFLOW --- */
    width: 100%;
}

/* Desktop override: more columns on larger screens */
@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 20px;
    }
}

/* --- 4. Card Styling --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    
    /* --- ENSURES CARD FITS GRID --- */
    width: 100%;
    overflow: hidden; 
}

/* THE IMAGE FIX: Perfect TCG Proportions */
.card img {
    width: 100%;
    height: auto;
    aspect-ratio: 63 / 88; /* Official Pokémon card ratio */
    object-fit: contain;  /* Shows full card without cropping */
    border-radius: 6px;
    background-color: #000;
    margin-bottom: 10px;
}


.card-info {
    min-height: 48px;
    margin-bottom: 8px;
    padding: 0 2px;
    width: 100%;
}

/* --- NEW CSS FOR NAME/ID LAYOUT --- */
.name-id-row {
    display: flex;
    justify-content: space-between; /* Pushes name left, ID right */
    align-items: flex-start;
    gap: 8px;
}

.card-info strong {
    font-size: 0.9rem;
    font-weight: 600;
    /* Allow text to wrap if necessary, but take up less width */
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
}

.card-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    text-align: right;
    white-space: nowrap; /* Keeps ID on one line */
    margin-top: 2px; /* Small adjustment to align with top of name */
}
/* --------------------------------- */

/* --- 5. Status Colors & Buttons --- */
.card.owned { 
    border-color: #22c55e; 
    background-color: var(--owned);
    box-shadow: inset 0 0 10px rgba(34, 197, 94, 0.1);
}

.card.want { 
    border-color: #eab308; 
    background-color: var(--want); 
    box-shadow: inset 0 0 10px rgba(234, 179, 8, 0.1);
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    width: 100%;
}

.status-btns {
    display: flex;
    gap: 4px;
}

.status-btns button {
    flex: 1;
    padding: 8px 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #0f172a;
    color: var(--text-muted);
    cursor: pointer;
}

.status-btns button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.hide-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.65rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 5px 0;
    width: 100%;
}

/* --- 6. Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.8); /* Translucent Slate */
    backdrop-filter: blur(12px);      /* Frosted Glass */
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    padding: 15px 10px 30px 10px; /* Extra bottom padding for "Home" bars on mobile */
    border-top: 1px solid var(--border);
    z-index: 1000;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn span {
    font-size: 1.1rem; /* This is where an icon would go */
}
