/* BrainBuzz Plugin CSS v1.0.0
   Game UI, Auth Forms, Profile, Leaderboard, Admin overrides
   ============================================================ */

/* ── Choice buttons (shared across all quiz games) ── */
.bb-choices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .625rem;
}

.bb-choice-btn {
    background: rgba(255,255,255,.05);
    border: 2px solid var(--bb-border, rgba(255,255,255,.1));
    border-radius: 10px;
    color: var(--bb-text, #e2e8f0);
    cursor: pointer;
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.4;
    padding: .85rem 1rem;
    text-align: left;
    transition: border-color .15s, background .15s, transform .1s;
    width: 100%;
}

.bb-choice-btn:hover:not(:disabled) {
    background: rgba(99,102,241,.18);
    border-color: var(--bb-blue, #6366f1);
    transform: translateY(-1px);
}

.bb-choice-btn:disabled {
    cursor: not-allowed;
}

.bb-choice-btn.correct {
    background: rgba(46,160,106,.2);
    border-color: #2ea06a;
    color: #4ade80;
}

.bb-choice-btn.wrong {
    background: rgba(229,115,115,.15);
    border-color: #e57373;
    color: #f87171;
}

/* ── Timer circle ── */
.bb-timer-circle {
    align-items: center;
    background: conic-gradient(var(--bb-blue,#6366f1) 0%, rgba(255,255,255,.07) 0%);
    border-radius: 50%;
    color: var(--bb-text, #e2e8f0);
    display: flex;
    font-size: 1rem;
    font-weight: 700;
    height: 52px;
    justify-content: center;
    width: 52px;
    border: 3px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}

/* ── XP / level overlay modal ── */
#bb-xp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#bb-xp-overlay.visible {
    display: flex;
}

#bb-xp-modal {
    background: var(--bb-surface, #1e293b);
    border: 1px solid var(--bb-border, rgba(255,255,255,.1));
    border-radius: 20px;
    max-width: 440px;
    padding: 2.25rem 2rem;
    text-align: center;
    width: 100%;
    animation: bb-modal-pop .25s ease;
}

@keyframes bb-modal-pop {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
}

.bb-xp-bar-wrap {
    background: rgba(255,255,255,.07);
    border-radius: 100px;
    height: 10px;
    margin: 1rem 0 .5rem;
    overflow: hidden;
}

.bb-xp-bar-fill {
    background: linear-gradient(90deg, var(--bb-blue,#6366f1), var(--bb-purple,#a855f7));
    border-radius: 100px;
    height: 100%;
    transition: width 1s ease;
}

/* ── Auth forms (login / register) ── */
.bb-auth-wrap {
    max-width: 440px;
    margin: 0 auto;
}

.bb-auth-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
}

.bb-auth-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--bb-muted, #94a3b8);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    padding: .5rem 1rem;
    transition: color .15s, border-color .15s;
}

.bb-auth-tab.active {
    border-bottom-color: var(--bb-blue, #6366f1);
    color: var(--bb-blue, #6366f1);
}

.bb-auth-form {
    display: none;
}

.bb-auth-form.active {
    display: block;
}

/* ── Input fields ── */
.bb-input {
    background: rgba(255,255,255,.05);
    border: 1.5px solid var(--bb-border, rgba(255,255,255,.1));
    border-radius: 8px;
    color: var(--bb-text, #e2e8f0);
    font-size: .95rem;
    outline: none;
    padding: .65rem .9rem;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

.bb-input:focus {
    border-color: var(--bb-blue, #6366f1);
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}

.bb-input::placeholder {
    color: var(--bb-muted, #94a3b8);
}

.bb-form-group {
    margin-bottom: 1rem;
}

.bb-form-label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: .35rem;
    color: var(--bb-text, #e2e8f0);
}

.bb-form-error {
    color: #f87171;
    font-size: .85rem;
    margin-top: .35rem;
    display: none;
}

.bb-form-error.visible {
    display: block;
}

.bb-form-success {
    color: #4ade80;
    font-size: .9rem;
    margin-top: .75rem;
    display: none;
    padding: .75rem 1rem;
    background: rgba(46,160,106,.12);
    border-radius: 8px;
}

.bb-form-success.visible {
    display: block;
}

/* ── Profile page ── */
.bb-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.bb-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bb-blue,#6366f1), var(--bb-purple,#a855f7));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.bb-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bb-profile-meta h2 {
    margin: 0 0 .25rem;
}

.bb-profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
    margin-bottom: 2rem;
}

.bb-stat-tile {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--bb-border, rgba(255,255,255,.08));
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.bb-stat-tile-val {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--bb-blue, #6366f1);
    line-height: 1.1;
}

.bb-stat-tile-label {
    font-size: .8rem;
    color: var(--bb-muted, #94a3b8);
    margin-top: .3rem;
}

/* ── Badges grid ── */
.bb-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: .75rem;
}

.bb-badge-item {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--bb-border, rgba(255,255,255,.08));
    border-radius: 10px;
    padding: .75rem .5rem;
    text-align: center;
    position: relative;
}

.bb-badge-item.earned {
    border-color: rgba(168,85,247,.4);
    background: rgba(168,85,247,.08);
}

.bb-badge-item.locked {
    opacity: .4;
    filter: grayscale(1);
}

.bb-badge-icon {
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: .35rem;
}

.bb-badge-name {
    font-size: .72rem;
    font-weight: 600;
    color: var(--bb-text, #e2e8f0);
    line-height: 1.2;
}

/* ── Leaderboard table ── */
.bb-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.bb-lb-table th {
    text-align: left;
    padding: .6rem .75rem;
    color: var(--bb-muted, #94a3b8);
    font-weight: 600;
    font-size: .8rem;
    border-bottom: 1px solid var(--bb-border, rgba(255,255,255,.08));
    text-transform: uppercase;
    letter-spacing: .05em;
}

.bb-lb-table td {
    padding: .75rem;
    border-bottom: 1px solid var(--bb-border, rgba(255,255,255,.06));
    vertical-align: middle;
}

.bb-lb-table tr:last-child td {
    border-bottom: none;
}

.bb-lb-table tr:hover td {
    background: rgba(255,255,255,.03);
}

.bb-lb-rank {
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    width: 48px;
}

.bb-lb-rank.gold   { color: #f59e0b; }
.bb-lb-rank.silver { color: #94a3b8; }
.bb-lb-rank.bronze { color: #b45309; }

/* ── Daily challenge banner ── */
.bb-daily-banner {
    background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(168,85,247,.15));
    border: 1px solid rgba(168,85,247,.3);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.bb-daily-icon {
    font-size: 2.25rem;
    flex-shrink: 0;
}

.bb-daily-info {
    flex: 1;
    min-width: 180px;
}

.bb-daily-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: .2rem;
}

/* ── Game page header bar ── */
.bb-game-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.bb-game-topbar-icon {
    font-size: 2rem;
}

.bb-game-topbar h1 {
    font-size: 1.5rem;
    margin: 0;
    line-height: 1.2;
}

/* ── Challenge share box ── */
.bb-share-box {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--bb-border, rgba(255,255,255,.1));
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1.25rem;
}

.bb-share-url {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
}

.bb-share-url input {
    flex: 1;
    background: rgba(0,0,0,.25);
    border: 1px solid var(--bb-border, rgba(255,255,255,.1));
    border-radius: 6px;
    color: var(--bb-muted, #94a3b8);
    font-size: .85rem;
    padding: .45rem .7rem;
    outline: none;
}

/* ── Friend challenge page ── */
.bb-challenge-card {
    background: linear-gradient(135deg, var(--bb-blue,#6366f1), var(--bb-purple,#a855f7));
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    color: #fff;
    margin-bottom: 2rem;
}

.bb-challenge-card .bb-challenge-game {
    font-size: 3rem;
    margin-bottom: .75rem;
}

.bb-challenge-score {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

/* ── Games directory grid ── */
.bb-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.bb-game-card {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--bb-border, rgba(255,255,255,.08));
    border-radius: 14px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    display: block;
}

.bb-game-card:hover {
    border-color: var(--bb-blue, #6366f1);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(99,102,241,.2);
    text-decoration: none;
    color: inherit;
}

.bb-game-card-icon {
    font-size: 2.25rem;
    margin-bottom: .75rem;
}

.bb-game-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .35rem;
}

.bb-game-card-desc {
    font-size: .85rem;
    color: var(--bb-muted, #94a3b8);
    line-height: 1.5;
}

.bb-game-card-meta {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}

/* ── Category filter chips ── */
.bb-filter-chips {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.bb-chip {
    background: rgba(255,255,255,.05);
    border: 1.5px solid var(--bb-border, rgba(255,255,255,.1));
    border-radius: 100px;
    color: var(--bb-muted, #94a3b8);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    padding: .35rem .9rem;
    transition: all .15s;
}

.bb-chip:hover,
.bb-chip.active {
    background: rgba(99,102,241,.18);
    border-color: var(--bb-blue, #6366f1);
    color: var(--bb-blue, #6366f1);
}

/* ── Difficulty badge ── */
.bb-badge {
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 600;
    padding: .25rem .65rem;
    display: inline-flex;
    align-items: center;
}

.bb-badge--blue   { background: rgba(99,102,241,.2); color: #818cf8; }
.bb-badge--purple { background: rgba(168,85,247,.2); color: #c084fc; }
.bb-badge--green  { background: rgba(46,160,106,.2); color: #4ade80; }
.bb-badge--orange { background: rgba(245,158,11,.2); color: #fbbf24; }
.bb-badge--red    { background: rgba(239,68,68,.2);  color: #f87171; }

/* ── Buttons ── */
.bb-btn {
    align-items: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-size: .9rem;
    font-weight: 600;
    gap: .4rem;
    justify-content: center;
    padding: .6rem 1.25rem;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
}

.bb-btn:hover { opacity: .88; transform: translateY(-1px); }
.bb-btn:active { transform: translateY(0); }
.bb-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.bb-btn--primary {
    background: linear-gradient(135deg, var(--bb-blue,#6366f1), var(--bb-purple,#a855f7));
    color: #fff;
}

.bb-btn--ghost {
    background: rgba(255,255,255,.06);
    border: 1.5px solid var(--bb-border, rgba(255,255,255,.12));
    color: var(--bb-text, #e2e8f0);
}

.bb-btn--danger {
    background: rgba(239,68,68,.8);
    color: #fff;
}

.bb-btn--sm { font-size: .8rem; padding: .4rem .85rem; }
.bb-btn--lg { font-size: 1.05rem; padding: .85rem 1.75rem; border-radius: 10px; }

/* ── Card ── */
.bb-card {
    background: var(--bb-surface, #1e293b);
    border: 1px solid var(--bb-border, rgba(255,255,255,.08));
    border-radius: 16px;
    padding: 1.5rem;
}

/* ── Utility ── */
.bb-text-muted  { color: var(--bb-muted, #94a3b8); }
.bb-text-center { text-align: center; }
.bb-mt-1  { margin-top: .5rem; }
.bb-mt-2  { margin-top: 1rem; }
.bb-mt-3  { margin-top: 1.5rem; }
.bb-mb-1  { margin-bottom: .5rem; }
.bb-mb-2  { margin-bottom: 1rem; }

/* ── Contact form ── */
.bb-contact-form {
    max-width: 600px;
}

/* ── Admin overrides (WP admin panel only) ── */
.bb-admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.bb-admin-stat-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem 1.25rem;
}

.bb-admin-stat-val {
    font-size: 2rem;
    font-weight: 700;
    color: #2271b1;
    line-height: 1.1;
}

.bb-admin-stat-label {
    font-size: .85rem;
    color: #666;
    margin-top: .25rem;
}

/* ── Responsive tweaks ── */
@media (max-width: 480px) {
    .bb-choices-grid { grid-template-columns: 1fr; }
    .bb-profile-header { flex-direction: column; align-items: center; text-align: center; }
    .bb-daily-banner { flex-direction: column; text-align: center; }
    .bb-lb-table th:nth-child(3),
    .bb-lb-table td:nth-child(3) { display: none; }
}
