/* ── Header ───────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.35em;
    color: var(--heading);
    text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-pokeball {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow);
}
.logo-pokeball::before {
    content: '';
    width: 14px;
    height: 14px;
    background: var(--header-bg);
    border: 3px solid var(--accent);
    border-radius: 50%;
    z-index: 1;
}
.logo-pokeball::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--header-bg);
    transform: translateY(-50%);
}

.logo-text span {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme switcher */
.theme-switcher {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--bg-alt);
    border-radius: 20px;
    border: 1px solid var(--border);
}
.theme-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
}
.theme-dot:hover,
.theme-dot.active {
    border-color: var(--heading);
    transform: scale(1.15);
}
.theme-dot[data-theme="pokeball"] { background: #E3350D; }
.theme-dot[data-theme="midnight"] { background: #F5C518; }
.theme-dot[data-theme="retro"] { background: #3DDC84; }

/* ── Tab Navigation ──────────────────────────── */
.tab-nav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-nav-inner {
    display: flex;
    align-items: center;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    gap: 4px;
}

.tab-btn {
    padding: 14px 20px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--tab-text);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    letter-spacing: 0.3px;
}
.tab-btn:hover {
    color: var(--heading);
    background: var(--tab-bg);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab-btn .tab-icon {
    margin-right: 6px;
}

/* ── Tab Content ─────────────────────────────── */
.tab-content {
    display: none;
    padding: 32px 0;
    min-height: 60vh;
    animation: fadeIn 0.3s ease;
}
.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Hero Section (per tab) ──────────────────── */
.tab-hero {
    background: var(--hero-gradient);
    padding: 40px 0;
    margin: -32px 0 32px 0;
    border-bottom: 1px solid var(--border);
}
.tab-hero h1 {
    color: #FFFFFF;
    margin-bottom: 8px;
}
.tab-hero p {
    color: #AAB4C7;
    font-size: 1.05em;
}

/* ── Sets Layout ─────────────────────────────── */
.sets-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}
.sets-sidebar {
    width: 360px;
    flex-shrink: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    position: sticky;
    top: 130px;
}
.sets-sidebar::-webkit-scrollbar { width: 6px; }
.sets-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Set List ────────────────────────────────── */
.set-list { display: flex; flex-direction: column; gap: 12px; }

.set-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}
.set-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}
.set-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.set-logo {
    width: 120px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.set-info { flex: 1; min-width: 0; }
.set-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--heading);
    font-size: 1em;
}
.set-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
    margin-top: 2px;
}

.set-detail { flex: 1; }

/* ── Set Detail Panel ────────────────────────── */
.set-detail-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.set-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.set-detail-logo {
    width: 180px;
    height: 60px;
    object-fit: contain;
}
.set-detail-title h2 {
    color: var(--heading);
    margin-bottom: 4px;
}

/* ── Cards Grid ──────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}

.pokemon-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    position: relative;
    cursor: pointer;
}
.pokemon-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: var(--shadow-lg), var(--glow);
    border-color: var(--accent);
    z-index: 2;
}

/* Rank badge */
.pokemon-card-rank {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: 800;
    color: var(--accent);
    font-family: var(--font-heading);
    z-index: 1;
}

.pokemon-card-img {
    width: 100%;
    aspect-ratio: 63/88;
    object-fit: cover;
    display: block;
}

.pokemon-card-info {
    padding: 10px 12px 4px;
}
.pokemon-card-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.82em;
    color: var(--heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pokemon-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}
.pokemon-card-rarity {
    font-size: 0.68em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}
.pokemon-card-price {
    font-weight: 800;
    color: var(--accent);
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.price-label {
    font-size: 0.7em;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pokemon-card-avg {
    font-size: 0.68em;
    color: var(--text-muted);
    margin-top: 2px;
}
.card-trend {
    font-size: 0.72em;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
}
.card-trend.trend-up   { color: #3DDC84; background: rgba(61,220,132,0.12); }
.card-trend.trend-down { color: #FF5555; background: rgba(255,85,85,0.12); }
.card-trend.trend-flat { color: var(--text-muted); }

.pokemon-card-link {
    display: block;
    text-align: center;
    padding: 7px;
    font-size: 0.72em;
    font-weight: 600;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    transition: all var(--transition);
    letter-spacing: 0.2px;
}
.pokemon-card-link:hover {
    background: var(--stat-bg);
    color: var(--accent);
    text-decoration: none;
}

/* ── Rarity Colors ───────────────────────────── */
.rarity-common           { background: #2A2A2A; color: #888; }
.rarity-uncommon         { background: #1A2A1A; color: #5A9A5A; }
.rarity-rare             { background: #1A1A2A; color: #6A7ACA; }
.rarity-rare-holo        { background: #1A1A2A; color: #8A9AEA; }
.rarity-double-rare      { background: #1E2040; color: #A0AAFF; }
.rarity-ultra-rare       { background: #201830; color: #C080FF; }
.rarity-illustration-rare{ background: #202830; color: #60C0E0; }
.rarity-sir              { background: #2A1820; color: #FF80B0; }
.rarity-hyper-rare       { background: #2A2010; color: #FFD060; }
.rarity-ace-spec         { background: #202010; color: #E0C040; }
.rarity-shiny-rare       { background: #201E10; color: #D4C428; }
.rarity-shiny-ultra-rare { background: #281828; color: #E090D0; }

/* ── Sealed Products Table ───────────────────── */
.sealed-table td:first-child {
    font-weight: 600;
    color: var(--heading);
}

.product-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    background: var(--tab-bg);
    color: var(--text);
}

/* ── Collection ──────────────────────────────── */
.collection-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.collection-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.collection-filters select,
.collection-filters input {
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
}
.collection-filters select:focus,
.collection-filters input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Import Section ──────────────────────────── */
.import-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    background: var(--bg-alt);
    transition: all var(--transition);
    cursor: pointer;
}
.import-zone:hover,
.import-zone.dragover {
    border-color: var(--accent);
    background: rgba(var(--accent), 0.05);
}
.import-zone-icon {
    font-size: 3em;
    margin-bottom: 12px;
}
.import-zone-text {
    color: var(--text-muted);
    font-size: 1em;
}
.import-zone-text strong {
    color: var(--accent);
}

/* ── Calculator Sections ─────────────────────── */
.calc-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}
.calc-card h3 {
    color: #E6EDF3;
}

.calc-result {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    margin: 20px 0;
}

.calc-breakdown {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ── Watchlist ───────────────────────────────── */
.watchlist-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.watchlist-item-img {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
}
.watchlist-progress {
    flex: 1;
}

/* ── Section Headers ─────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 {
    position: relative;
    display: inline-block;
}
.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* ── Loading ─────────────────────────────────── */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3em; margin-bottom: 12px; opacity: 0.5; }

/* ── Toast / Notifications ───────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 14px 24px;
    color: var(--heading);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 1024px) {
    .sets-layout { flex-direction: column; }
    .sets-sidebar { width: 100%; max-height: 300px; position: static; }
    .collection-stats { grid-template-columns: repeat(2, 1fr); }
    .set-detail-panel { padding: 20px; }
}
@media (max-width: 768px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .header-inner { height: 60px; }
    .logo { font-size: 1.1em; }
    .logo-pokeball { width: 30px; height: 30px; }
    .set-detail-header { flex-direction: column; text-align: center; }
    .tab-btn { padding: 12px 14px; font-size: 12px; }
    .calc-breakdown { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .collection-stats { grid-template-columns: 1fr; }
    .set-item { flex-direction: column; text-align: center; }
    .set-logo { width: 100px; }
}
