/* Theming */
:root { --text-primary: #e5e7eb; --text-muted: #9aa3af; --card-bg: #222222; --border: #2a2a2a; --subtle-bg: #080808; --link: #93c5fd; }
.theme-light { --text-primary: #111827; --text-muted: #6b7280; --card-bg: #ffffff; --border: #e5e7eb; --subtle-bg: #f9fafb; --link: #2563eb; }

/* Layout container */
.container { max-width: 1250px; margin: 48px auto; padding: 0 16px; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
.section-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.muted { color: var(--text-muted); font-size: 14px; }

/* Featured charities grid */
.featured-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.results-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.np-featured-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .np-featured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .np-featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .np-featured-grid { grid-template-columns: 1fr; } }
.np-card { border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); display: flex; flex-direction: column; gap: 0; cursor: pointer; transition: box-shadow .15s ease, transform .06s ease, border-color .15s ease, background-color .15s ease; overflow: hidden; }
.np-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.np-card:active { transform: translateY(1px); }
.np-card.selected { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); background: #2a2a2a; }
.np-cover { height: 110px; background-size: cover; background-position: center; position: relative; }
.np-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.0), rgba(0,0,0,0.2)); }
.np-card-content { display: flex; gap: 12px; padding: 12px 14px 14px; }
.np-card-logo { width: 48px; height: 48px; border: 1px solid var(--border); border-radius: 8px; object-fit: contain; background: var(--card-bg); }
.np-card-body { flex: 1; min-width: 0; }
.np-card-name { font-weight: 700; color: var(--text-primary); margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-card-desc { color: var(--text-muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-card-actions { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-primary); cursor: pointer; text-decoration: none; }
.btn-primary { border-color: #2563eb; background: #2563eb; color: #fff; }
.btn-link { border: none; background: transparent; color: var(--link); padding: 0; }
.row-spacer { margin-top: 12px; }
.row-divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 24px 0; }

/* Donate CTA */
.donate-cta { margin: 28px 0 56px; display: none; justify-content: center; }
.donate-cta.show { display: flex; }
.donate-btn { appearance: none; border: none; cursor: pointer; padding: 14px 24px; border-radius: 9999px; font-weight: 800; letter-spacing: 0.2px; color: #0a2e17; background: linear-gradient(90deg, #34d399, #10b981); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25); text-decoration: none; }
.donate-btn:hover { filter: brightness(1.03); box-shadow: 0 10px 28px rgba(16, 185, 129, 0.32); }
.donate-btn:active { transform: translateY(1px); }

/* Intro / perks */
.intro { border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.intro h1 { margin: 0 0 6px; font-size: 20px; color: var(--text-primary); }
.intro p { margin: 6px 0; color: var(--text-muted); }
.conversion { display: inline-block; margin-top: 6px; background: #064e3b; color: #a7f3d0; border: 1px solid #065f46; padding: 6px 10px; border-radius: 9999px; font-weight: 700; font-size: 13px; }
.perks-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 900px) { .perks-grid { grid-template-columns: 1fr; } }
.perk { border: 1px dashed var(--border); border-radius: 10px; background: var(--subtle-bg); padding: 12px; }
.perk h3 { margin: 0 0 8px; font-size: 15px; color: var(--text-primary); }
.perk ul { margin: 0; padding-left: 18px; color: var(--text-muted); }
code { background-color: #242222; color: #c7254e; }

/* Search input and dropdown sizing */
#np-search { width: 100%; box-sizing: border-box; background: var(--card-bg) !important; color: var(--text-primary) !important; border: 1px solid var(--border) !important; border-radius: 8px !important; padding: 10px 12px !important; }
#np-search::placeholder { color: var(--text-muted); }
.autoComplete_wrapper { width: 100%; }
.autoComplete_wrapper > input { background: var(--card-bg) !important; color: var(--text-primary) !important; border: 1px solid var(--border) !important; border-radius: 8px !important; padding: 10px 12px !important; }
.autoComplete_wrapper > input::placeholder { color: var(--text-muted); }
.autoComplete_wrapper > input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.autoComplete_wrapper > ul,
.autoComplete_wrapper .autoComplete_results,
.autoComplete_wrapper .autoComplete_list { width: 100% !important; box-sizing: border-box; background: var(--card-bg) !important; border: 1px solid var(--border) !important; border-radius: 10px !important; padding: 6px 0 !important; box-shadow: 0 8px 24px rgba(0,0,0,.35) !important; z-index: 30; }
.autoComplete_wrapper > ul li,
.autoComplete_wrapper [role="option"],
.autoComplete_wrapper .autoComplete_result { background: var(--card-bg) !important; color: var(--text-primary) !important; border-top: 1px solid transparent; border-bottom: 1px solid transparent; }
.autoComplete_wrapper > ul li:hover,
.autoComplete_wrapper > ul li[aria-selected="true"],
.autoComplete_wrapper [role="option"][aria-selected="true"],
.autoComplete_wrapper .autoComplete_result:hover,
.autoComplete_wrapper .autoComplete_result.autoComplete_selected { background: #1b1b1b !important; border-color: #2a2a2a !important; }

/* Dropdown item styles */
.aa-List { list-style: none; margin: 0; padding: 0; background: var(--card-bg) !important; border: 1px solid var(--border) !important; border-radius: 10px !important; }
.aa-Item { padding: 0; }
.aa-ItemContent { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: transparent; }
.aa-ItemIcon { flex-shrink: 0; }
.aa-ItemIcon img.result-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; background: var(--card-bg); border: 1px solid var(--border); }
.aa-ItemContentBody { flex: 1; min-width: 0; }
.aa-ItemContentTitle { font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.aa-ItemContentDescription { font-size: 12px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Make dropdown use same font as the page section */
#aa-search { --aa-font-family: inherit; }
#aa-search, #aa-search * { font-family: inherit; }
/* Extremely defensive: suppress any pseudo-element content labels around the search UI */
#aa-search *::before, #aa-search *::after, .aa-Panel *::before, .aa-Panel *::after { content: none !important; }

/* Supporting segment */
.supporting { margin-top: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--subtle-bg); }
.supporting h3 { margin: 0 0 12px; font-size: 16px; color: var(--text-primary); }
.supporting-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.supporting-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: var(--card-bg); border: 1px solid var(--border); }
.supporting-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.supporting-meta { font-size: 12px; color: var(--text-muted); }
.supporting-desc { font-size: 14px; color: var(--text-muted); margin: 8px 0 0; }
.supporting-links { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; gap: 12px; }
.supporting-links a { color: var(--link); text-decoration: none; }
.supporting-links a:hover { text-decoration: underline; }

/* Player selection */
.player-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
#player-search { width: 100%; box-sizing: border-box; margin-bottom: 10px; }
.player-avatar { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background: var(--card-bg); }
.flag { font-size: 14px; margin-left: 6px; }

/* Recent donations */
.donations { margin-top: 28px; }
.donations-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.donations-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 10px; }
.donation-item { border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); padding: 10px 12px; display: grid; align-items: center; grid-template-columns: 1fr 2fr auto; gap: 12px; box-shadow: 0 1px 1px rgba(0,0,0,.04); transition: background-color .15s ease, border-color .15s ease; }
.donation-item:hover { background: #1b1b1b; border-color: #393939; }
.donation-player { display: flex; align-items: center; gap: 10px; min-width: 0; }
.donation-charity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.donation-avatar, .charity-avatar { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background: var(--card-bg); }
.donation-title { font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donation-sub { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donation-right { text-align: right; display: flex; flex-direction: column; gap: 2px; justify-self: end; }
.donation-amount { font-weight: 800; color: #10b981; background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.35); padding: 2px 10px; border-radius: 9999px; font-size: 13px; }
.donation-time { color: var(--text-muted); font-size: 12px; }
.donations-empty, .donations-error { border: 1px dashed var(--border); border-radius: 8px; background: var(--subtle-bg); padding: 12px; color: var(--text-muted); }
.donation-link { text-decoration: none; }

/* Skeleton loading */
.skeleton { position: relative; background: #1a1a1a; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(26,26,26,0) 0%, rgba(64,64,64,.9) 50%, rgba(26,26,26,0) 100%); transform: translateX(-100%); animation: shimmer 1.2s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.donation-skel { border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); padding: 10px 12px; display: flex; align-items: center; gap: 12px; }
.skel-avatar { width: 36px; height: 36px; border-radius: 8px; }
.skel-line { height: 10px; border-radius: 6px; }
.skel-w1 { width: 140px; }
.skel-w2 { width: 90px; }
.skel-amount { width: 72px; height: 16px; border-radius: 9999px; }

/* Success overlay */
#success-overlay { position: fixed; inset: 0; display: none; }
#success-overlay.show { display: block; }
.success-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.success-panel { position: relative; z-index: 2; width: min(860px, 96%); max-height: 92vh; margin: 4vh auto; border: 1px solid var(--border); background: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.success-close { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border-radius: 9999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-primary); cursor: pointer; }
.success-cover { height: 180px; background: #1a1a1a; background-size: cover; background-position: center; }
.success-body { padding: 14px; }
.success-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.success-logo { width: 56px; height: 56px; border-radius: 8px; object-fit: contain; border: 1px solid var(--border); background: var(--card-bg); }
.success-title { margin: 0; font-size: 22px; color: var(--text-primary); }
.success-nonprofit { margin-top: 2px; }
.success-message { color: var(--text-muted); }
.success-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

