/* gallery2.css — design skin for custom_card_gallery_live2 only
   All rules scoped under .g2-wrapper to avoid collisions with existing CSS */

/* ─── Design tokens ─────────────────────────────────── */
.g2-wrapper {
    --g2-panel-bg:   oklch(0.18 0.02 250);
    --g2-accent:     oklch(0.72 0.16 70);
    --g2-accent-h:   oklch(0.78 0.16 70);
    --g2-border:     rgba(255,255,255,0.07);
    --g2-border-h:   rgba(255,255,255,0.15);
    --g2-text:       #ffffff;
    --g2-text-muted: rgba(255,255,255,0.65);
    --g2-text-dim:   rgba(255,255,255,0.45);
    --g2-card-bg:    oklch(0.21 0.02 250);
    --g2-radius:     16px;
}

.g2-wrapper {
    max-width: 1400px;
    margin: 20px auto 40px;
    padding: 0 16px;
    font-family: 'Myriad Pro', system-ui, sans-serif;
}

/* ─── Panel (shared card) ────────────────────────────── */
.g2-panel {
    background: var(--g2-panel-bg);
    border: 1px solid var(--g2-border);
    border-radius: var(--g2-radius);
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    margin-bottom: 16px;
}

/* ─── Game selector ──────────────────────────────────── */
.g2-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin-bottom: 28px;
}

.g2-intro .g2-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--g2-text);
    margin: 0;
    letter-spacing: -0.02em;
}

.g2-intro .g2-desc {
    font-size: 15px;
    line-height: 1.55;
    color: var(--g2-text-muted);
    max-width: 600px;
    margin: 0;
}

.g2-intro .g2-choose-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--g2-accent);
}

.g2-games-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

@media (max-width: 900px) { .g2-games-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .g2-games-grid { grid-template-columns: repeat(2, 1fr); } }

.g2-game-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--g2-border);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
    color: var(--g2-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
}

.g2-game-tile:hover {
    background: rgba(255,255,255,0.09);
    border-color: var(--g2-accent);
    transform: translateY(-2px);
    color: var(--g2-accent);
}

.g2-game-logo-wrap {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    overflow: hidden;
}

.g2-game-logo-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 0;
    padding: 0;
}

.g2-game-label {
    color: inherit;
}

/* ─── Gallery header panel ───────────────────────────── */
.g2-gal-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.g2-gal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding-right: 18px;
    border-right: 1px solid var(--g2-border);
}

.g2-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--g2-border);
    color: var(--g2-text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    text-decoration: none;
}

.g2-back-btn:hover {
    background: rgba(255,255,255,0.12);
    color: var(--g2-accent);
}

.g2-gal-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.g2-active-game-name {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--g2-accent);
}

.g2-gal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--g2-text);
    margin: 0;
    letter-spacing: -0.02em;
}

/* ─── Category pills ─────────────────────────────────── */
.g2-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.g2-cat-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.06);
    color: var(--g2-text-muted) !important;
    border: 1px solid var(--g2-border);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none !important;
}

.g2-cat-btn:hover {
    background: rgba(255,255,255,0.12);
    color: var(--g2-accent) !important;
    border-color: var(--g2-border-h);
}

.g2-cat-btn.current {
    background: var(--g2-accent);
    color: oklch(0.18 0.02 250) !important;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Submit button */
.g2-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: linear-gradient(135deg, oklch(0.55 0.18 265), oklch(0.62 0.18 275));
    color: #fff !important;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    text-decoration: none !important;
    transition: transform 0.15s, opacity 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.g2-submit-btn:hover {
    transform: translateY(-1px) scale(1.03);
    color: #fff !important;
}

/* ─── Search + Sort row ──────────────────────────────── */
.g2-search-sort-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.g2-search-panel {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--g2-panel-bg);
    border: 1px solid var(--g2-border);
    border-radius: var(--g2-radius);
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.g2-search-input {
    flex: 1;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid var(--g2-border) !important;
    border-radius: 8px !important;
    padding: 7px 12px !important;
    color: var(--g2-text) !important;
    font-size: 14px !important;
    outline: none !important;
    transition: border-color 0.15s;
    width: auto;
    height: auto;
}

.g2-search-input:focus {
    border-color: var(--g2-accent) !important;
}

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

.g2-search-go-btn {
    background: var(--g2-accent);
    color: oklch(0.18 0.02 250);
    border: none;
    border-radius: 8px;
    padding: 7px 18px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.g2-search-go-btn:hover { background: var(--g2-accent-h); }

.g2-sort-panel {
    background: var(--g2-panel-bg);
    border: 1px solid var(--g2-border);
    border-radius: var(--g2-radius);
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--g2-text-muted);
    font-size: 13px;
    white-space: nowrap;
}

.g2-sort-select {
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid var(--g2-border) !important;
    border-radius: 8px !important;
    color: var(--g2-text) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 10px !important;
    outline: none !important;
    cursor: pointer;
    width: auto;
    height: auto;
}

/* ─── Cards grid ─────────────────────────────────────── */
.g2-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 16px;
}

@media (max-width: 1100px) { .g2-cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .g2-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .g2-cards-grid { grid-template-columns: 1fr; } }

/* ─── Card item ──────────────────────────────────────── */

/* Reset card-bx-holder styles from custom.css (adds padding:0 20px at desktop) */
.g2-wrapper .g2-card.card-bx-holder {
    padding: 0 !important;
    flex: unset !important;
    -ms-flex: unset !important;
    max-width: unset !important;
    width: 100% !important;
}

.g2-card {
    display: flex;
    flex-direction: column;
    background: oklch(0.18 0.02 250);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.g2-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
}

/* ── Header: title + author + link icon ── */
.g2-card-header {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.05);
    /* no overflow:hidden so tooltip can extend into card body */
    overflow: visible;
    position: relative;
    z-index: 10;
}

.g2-card-titles {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    min-width: 0;
}

.g2-card-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.3;
    cursor: pointer;
    transition: color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.g2-card-name:hover { color: oklch(0.78 0.16 70); text-decoration: underline; }

.g2-card-author {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: oklch(0.78 0.16 70) !important;
    text-decoration: none !important;
    transition: color 0.15s;
    line-height: 1.3;
}

.g2-card-author:hover { color: #fff !important; }

/* Copy-link button (right of header) */
.g2-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    padding: 6px;
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    transition: background 0.15s, color 0.15s;
    text-decoration: none !important;
    position: relative;
}

.g2-link-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }

.g2-link-btn img {
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Tooltip — shown on hover, positioned below link button (inside card body) */
.g2-link-btn .tooltipp {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.g2-link-btn .tooltiptext {
    visibility: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    left: auto;
    z-index: 200;
    white-space: nowrap;
    background: rgba(0,0,0,0.88);
    color: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    pointer-events: none;
    width: auto !important;
}

.g2-link-btn .tooltipp:hover .tooltiptext { visibility: visible; }

/* ── Vote row: 3-column grid (20% | 60% | 20%) ── */
.g2-vote-row {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    align-items: stretch;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.30);
}

/* Keep d-none grid slot visible so downvote doesn't collapse the column */
.g2-vote-row .d-none {
    display: flex !important;
    visibility: hidden;
    pointer-events: none;
}

.g2-vote-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none !important;
    border: none;
}

.g2-vote-btn:hover { background: rgba(255,255,255,0.10); }

.g2-vote-btn img {
    width: 20px;
    height: 20px;
    display: block;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.g2-vote-dn:hover { background: rgba(200,30,30,0.12); }

.g2-vote-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    border-left: 1px solid rgba(255,255,255,0.05);
    border-right: 1px solid rgba(255,255,255,0.05);
}

.g2-vote-heart {
    font-size: 14px;
    color: #ef4444;
    line-height: 1;
}

.g2-vote-center .countSpan {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: none !important;
    width: auto !important;
    height: auto !important;
    line-height: 1;
    border-radius: 0 !important;
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Admin buttons (delete / showcase) ── */
.g2-card .g2-admin-btns {
    display: flex;
    gap: 6px;
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.15);
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

/* Override cta-btn1 global size from custom.css (font-size:22px, width:135px) */
.g2-card .cta-btn1 {
    background: #af192d !important;
    border-radius: 6px !important;
    color: #ffeadb !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    text-transform: uppercase;
    padding: 4px 10px !important;
    display: inline-block !important;
    font-weight: 600 !important;
    width: auto !important;
    height: auto !important;
    text-align: center;
    text-decoration: none !important;
    margin: 0 !important;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
}

.g2-card .cta-btn1:hover {
    background: #560b0b !important;
    color: #ffeadb !important;
}

/* ── Card image — edge-to-edge ── */
.g2-card-img {
    background: rgba(0,0,0,0.40);
    overflow: hidden;
    flex: 1;
}

.g2-card-img img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.g2-card:hover .g2-card-img img { transform: scale(1.03); }

/* ── Add to order — full-width, rounded-bottom via article overflow:hidden ── */
.g2-card .g2-order-btn,
.g2-card .add-to-order-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 12px !important;
    background: oklch(0.72 0.16 70); /* no !important — JS sets green when added */
    color: oklch(0.18 0.02 250) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    text-transform: none;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none !important;
    line-height: 1;
    box-sizing: border-box;
    margin: 0 !important;
    flex-shrink: 0;
}

.g2-card .g2-order-btn:hover,
.g2-card .add-to-order-btn:hover {
    background: oklch(0.78 0.16 70);
    color: oklch(0.18 0.02 250) !important;
    text-decoration: none !important;
}

.g2-order-plus {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    display: inline;
}

/* ─── Pagination ─────────────────────────────────────── */
.g2-wrapper .g2-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0 8px;
    flex-wrap: wrap;
}

/* Shared pill — prev/next arrows and page numbers */
.g2-wrapper .g2-page-btn,
.g2-wrapper #pages a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 3px 10px !important;
    border-radius: 9999px !important;
    background: oklch(0.21 0.02 250) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    color: rgba(255,255,255,0.75) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    letter-spacing: 0.04em !important;
    text-decoration: none !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.g2-wrapper .g2-page-btn:hover,
.g2-wrapper #pages a:hover {
    background: oklch(0.26 0.02 250) !important;
    border-color: rgba(255,255,255,0.22) !important;
    color: oklch(0.78 0.16 70) !important;
}

/* Active page number */
.g2-wrapper #pages a.current {
    background: oklch(0.72 0.16 70) !important;
    color: oklch(0.18 0.02 250) !important;
    border-color: transparent !important;
}

/* #pages container */
.g2-wrapper #pages {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Jump-to-page input */
.g2-wrapper #pages .g2-page-jump {
    padding: 3px 6px !important;
    width: 40px !important;
    color: #fff !important;
    background: oklch(0.21 0.02 250) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 9999px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    height: auto !important;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}

.g2-wrapper #pages .g2-page-jump::-webkit-outer-spin-button,
.g2-wrapper #pages .g2-page-jump::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Ellipsis separator between page groups */
.g2-wrapper #pages .g2-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 4px !important;
    color: rgba(255,255,255,0.40) !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    cursor: default;
    user-select: none;
}

/* page-numbers (WP style) inside g2 */
.g2-wrapper .page-numbers { color: rgba(255,255,255,0.65); }
.g2-wrapper .page-numbers.current { color: oklch(0.72 0.16 70) !important; background: none; }

/* ─── Spinner ────────────────────────────────────────── */
.g2-wrapper .btn-spin-category { color: var(--g2-accent); font-size: 28px; }

/* ─── Error box ──────────────────────────────────────── */
.g2-wrapper #error-msg {
    margin: 10px 0;
    border-radius: 8px;
}

/* ─── Lightbox (same IDs, scoped) ───────────────────── */
.g2-wrapper #lightbox {
    display: none;
    justify-content: center;
    position: fixed;
    z-index: 9999;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0,0,0,0.85);
}

.g2-wrapper #lightbox-content {
    position: relative;
    margin: auto;
}

.g2-wrapper #lightbox-image {
    width: 530px;
    max-width: 90vw;
    border-radius: 12px;
}

.g2-wrapper #close-btn {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--g2-accent);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
}

/* ─── Modal overrides (showcase modal) ───────────────── */
.g2-wrapper .modal-content {
    background: var(--g2-panel-bg);
    border: 1px solid var(--g2-border);
    color: var(--g2-text);
}

/* ─── Tooltips handled in card section above ─── */
.g2-wrapper .tooltiptext {
    font-size: 11px;
}

/* ─── Select dropdown — dark bg so text is visible ─── */
.g2-sort-select option {
    background: oklch(0.18 0.02 250) !important;
    color: #ffffff !important;
}

/* ─── Category pill icons (before pseudo via data attr) ─ */
/* Social Media icon */
#socialCategory::before    { content: '📸 '; font-style: normal; }
/* All Cards */
#allCategory::before       { content: '⊞ '; font-style: normal; }
/* Creatures */
#creatureCategory::before  { content: '⚔ '; font-style: normal; }
/* Planeswalker */
#planeswalkerCategory::before { content: '✦ '; font-style: normal; }
/* Instants */
#instantCategory::before   { content: '⚡ '; font-style: normal; }
/* Lands */
#landCategory::before      { content: '⛰ '; font-style: normal; }
/* Enchantments */
#enchantmentCategory::before { content: '🌿 '; font-style: normal; }
/* Artifacts */
#artifactCategory::before  { content: '💎 '; font-style: normal; }
/* Sorceries */
#sorceryCategory::before   { content: '🔥 '; font-style: normal; }
/* Tokens */
#tokenCategory::before     { content: '🪙 '; font-style: normal; }
/* Backs (no ID, target by text) */
.g2-cat-btn:not([id])::before { content: '☐ '; font-style: normal; }

/* Submit a Card icon */
.g2-submit-btn::before { content: '↑ '; font-weight: 900; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 760px) {
    .g2-gal-header { flex-direction: column; align-items: flex-start; }
    .g2-gal-header-left { border-right: none; padding-right: 0; border-bottom: 1px solid var(--g2-border); padding-bottom: 12px; width: 100%; }
    .g2-search-sort-row { flex-direction: column; }
    .g2-sort-panel { width: 100%; }
}

@media (max-width: 480px) {
    .g2-panel { padding: 16px; }
    .g2-games-grid { grid-template-columns: repeat(2, 1fr); }
}
