/* =============================================================================
   PokéCheck — Global Styles
   search.css  (shared by search.html and card-detail.php)
   ============================================================================= */

/* ── Google Font ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
    --bg:           #0d0d14;
    --surface:      #13131f;
    --surface-2:    #1a1a2e;
    --border:       rgba(255,255,255,0.08);
    --text:         #e8e8f0;
    --text-muted:   #7070a0;
    --accent:       #f6c90e;       /* Pokémon yellow */
    --accent-soft:  rgba(246,201,14,0.12);
    --accent-glow:  rgba(246,201,14,0.25);
    --red:          #ff4d6d;
    --blue:         #60a5fa;
    --green:        #34d399;
    --radius:       16px;
    --radius-sm:    10px;
    --shadow:       0 4px 24px rgba(0,0,0,0.4);
    --shadow-card:  0 8px 32px rgba(0,0,0,0.5);
    --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Subtle animated radial glow behind the page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(246,201,14,0.07) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(96,165,250,0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13,13,20,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px var(--accent));
}

.logo span:last-child {
    background: linear-gradient(135deg, #f6c90e 0%, #ff9d3d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-search { flex: 1; max-width: 480px; margin-left: auto; }

/* ── Hero (search page only) ─────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 5rem 1.5rem 3rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-soft);
    border: 1px solid rgba(246,201,14,0.2);
    border-radius: 100px;
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1.4rem;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-title em {
    font-style: normal;
    background: linear-gradient(135deg, #f6c90e 0%, #ff9d3d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Search input ────────────────────────────────────────────────────────── */
.search-wrap {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 0.9rem 1.4rem 0.9rem 3.2rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    caret-color: var(--accent);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
    border-color: rgba(246,201,14,0.5);
    box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow);
}

/* Search icon inside input */
.search-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1.1rem;
}

/* Spinner inside search box when loading */
.search-spinner {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.search-spinner.active { display: block; }

/* ── Status bar ──────────────────────────────────────────────────────────── */
.status-bar {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 1.2rem 0 2rem;
    min-height: 1.4em;
    transition: opacity 0.2s;
}

/* ── Card grid ───────────────────────────────────────────────────────────── */
#results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    padding-bottom: 4rem;
}

/* ── Individual card ─────────────────────────────────────────────────────── */
.poke-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition);
    cursor: pointer;
    animation: fadeSlideUp 0.3s ease both;
}

.poke-card:hover {
    transform: translateY(-5px) scale(1.015);
    box-shadow: var(--shadow-card);
    border-color: rgba(246,201,14,0.3);
}

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

/* Stagger animation for each card */
.poke-card:nth-child(1)  { animation-delay: 0.03s; }
.poke-card:nth-child(2)  { animation-delay: 0.06s; }
.poke-card:nth-child(3)  { animation-delay: 0.09s; }
.poke-card:nth-child(4)  { animation-delay: 0.12s; }
.poke-card:nth-child(5)  { animation-delay: 0.15s; }
.poke-card:nth-child(6)  { animation-delay: 0.18s; }
.poke-card:nth-child(7)  { animation-delay: 0.21s; }
.poke-card:nth-child(8)  { animation-delay: 0.24s; }
.poke-card:nth-child(9)  { animation-delay: 0.27s; }
.poke-card:nth-child(10) { animation-delay: 0.30s; }

.card-img-wrap {
    position: relative;
    background: var(--surface-2);
    aspect-ratio: 2 / 3;        /* Standard Pokémon card ratio */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
    display: block;
}

.poke-card:hover .card-img-wrap img { transform: scale(1.04); }

.card-img-placeholder {
    font-size: 4rem;
    opacity: 0.25;
}

.card-body {
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.card-name {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--text);
}

.card-set {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-prices {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    margin-top: 0.4rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.price-source {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    font-weight: 500;
}

.price-source .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-cm  { background: var(--blue); }
.dot-tcp { background: var(--green); }

.price-amount {
    font-weight: 700;
    font-size: 0.88rem;
}

.price-amount.cm  { color: var(--blue); }
.price-amount.tcp { color: var(--green); }
.price-na { color: var(--text-muted); font-weight: 400; font-size: 0.78rem; }

/* ── Empty / error state ─────────────────────────────────────────────────── */
.empty-state, .auth-required-block {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}
.auth-required-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}
.auth-required-block h3 {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.9rem; }

/* ── Spinner (inline) ────────────────────────────────────────────────────── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-wrap {
    display: flex;
    justify-content: center;
    padding: 4rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero { padding: 3rem 1rem 2rem; }
    .hero-title { font-size: 2rem; }

    #results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .card-body { padding: 0.7rem 0.75rem; }
}

@media (max-width: 380px) {
    #results-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar (webkit) ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Selection ───────────────────────────────────────────────────────────── */
::selection {
    background: var(--accent-glow);
    color: var(--text);
}

/* ── Header nav (auth state) ─────────────────────────────────────────────── */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.2rem;
    align-items: center;
    justify-content: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    transition: color var(--transition), background var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }

.nav-user-email {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-btn-ghost {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.nav-btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

.nav-btn-accent {
    background: var(--accent);
    color: #0d0d14;
    border-radius: 8px;
    padding: 0.38rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: box-shadow var(--transition), transform var(--transition);
}

.nav-btn-accent:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .site-header { padding: 0 1rem; gap: 0.5rem; }
    .header-nav { gap: 0.4rem; }
    .header-search { display: none !important; }
    .nav-user-email { display: none; }
    .mobile-menu-btn { display: flex; }
    
    .nav-links {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(13,13,20,0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.5rem;
        box-shadow: 0 16px 32px rgba(0,0,0,0.6);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all var(--transition);
        z-index: 99;
    }
    
    .nav-links.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .nav-link {
        padding: 0.8rem 1rem;
        border-radius: 8px;
        background: rgba(255,255,255,0.02);
    }
    
    .nav-btn-accent {
        text-align: center;
        padding: 0.8rem 1rem;
        margin-top: 0.5rem;
        font-size: 0.95rem;
    }
}

/* ── Limit banner ────────────────────────────────────────────────────────── */
.limit-banner {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: linear-gradient(135deg, rgba(246,201,14,0.08) 0%, rgba(255,157,61,0.08) 100%);
    border: 1px solid rgba(246,201,14,0.25);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
    color: var(--text);
}

.limit-banner-icon { font-size: 1.2rem; flex-shrink: 0; }

.limit-banner #limit-banner-msg {
    flex: 1;
    min-width: 180px;
    color: var(--text-muted);
}

.limit-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.limit-btn-primary {
    background: var(--accent);
    color: #0d0d14;
    border-radius: 8px;
    padding: 0.38rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: box-shadow 0.2s;
}

.limit-btn-primary:hover { box-shadow: 0 4px 16px var(--accent-glow); }

.limit-btn-ghost {
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.2s;
}

.limit-btn-ghost:hover { border-color: var(--text-muted); }

/* ── Card overlay (collection toggle button) ─────────────────────────────── */
.card-img-wrap { position: relative; }

.card-overlay-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    opacity: 1;
    transition: opacity var(--transition);
}

/* Show overlay on card hover OR touch (for mobile) */
.poke-card:hover .card-overlay-actions,
.poke-card:focus-within .card-overlay-actions { opacity: 1; }

.collect-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: none;
    border-radius: 12px;
    background: rgba(13,13,20,0.8);
    backdrop-filter: blur(8px);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), transform 0.15s;
    line-height: 1.4;
}

.collect-btn:hover { background: rgba(30,30,50,0.95); transform: scale(1.12); }

.collect-btn.collected {
    color: var(--red);
    background: rgba(255,77,109,0.15);
}

.collect-btn.collected:hover { background: rgba(255,77,109,0.25); }

.collect-login-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(13,13,20,0.8);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition);
}

.collect-login-hint:hover { color: var(--text); }

/* ── Locked price state ───────────────────────────────────────────────────── */
.card-prices.locked {
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
    margin-top: 0.4rem;
}

.price-locked-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

.price-locked-icon { font-size: 0.85rem; }

/* ── Profile Dropdown ────────────────────────────────────────────────────── */
.profile-dropdown-wrap {
    position: relative;
    margin-left: 0.5rem;
}

.profile-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    transition: border-color var(--transition);
}

.profile-btn:hover .profile-avatar {
    border-color: var(--accent);
}

.profile-badge-pro {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: linear-gradient(135deg, #f6c90e 0%, #ff9d3d 100%);
    color: #0d0d14;
    font-size: 0.5rem;
    font-weight: 900;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    border: 1px solid #0d0d14;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: var(--shadow-card);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition);
    z-index: 200;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-email {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    padding: 0.5rem 0.5rem 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-plan {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 0.5rem 0.5rem;
}

.profile-hr {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.profile-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
}

.profile-item:hover {
    background: var(--surface-2);
}

.profile-logout {
    color: var(--red);
}
