/* ==========================================================================
   OverAchiever — Shared Base Styles
   ========================================================================== */

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

/* --------- Colors --------- */
:root {
    /* Surfaces */
    --oa-bg: #111111;
    --oa-surface: #1a1a1a;
    --oa-surface-hover: #222222;
    --oa-surface-inset: #0e0e0e;

    /* Borders */
    --oa-border: #2a2a2a;
    --oa-border-strong: #444444;

    /* Text hierarchy */
    --oa-fg: #e0e0e0;
    --oa-fg-muted: #aaaaaa;
    --oa-fg-dim: #888888;
    --oa-fg-faint: #666666;
    --oa-fg-on-primary: #ffffff;

    /* Primary (brand green) */
    --oa-primary: #107c10;
    --oa-primary-hover: #0e6b0e;
    --oa-primary-light: #4ea24e;
    --oa-primary-lighter: #6fc46f;

    /* Danger (red) */
    --oa-danger-bg: #3b1010;
    --oa-danger-border: #6b2020;
    --oa-danger-fg: #f5a0a0;

    /* Accent (gold / showcase) */
    --oa-accent: #e0c040;

    /* Medals */
    --oa-gold: #ffd700;
    --oa-silver: #c0c0c0;
    --oa-bronze: #cd7f32;
}

/* ---------- Body ---------- */
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
        sans-serif;
    background: var(--oa-bg);
    color: var(--oa-fg);
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* Auth pages: vertically + horizontally centered */
body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* ---------- Layout ---------- */
.container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ---------- Typography ---------- */
h1 {
    text-align: center;
    margin-bottom: 0.25rem;
    color: var(--oa-primary);
    font-size: 1.8rem;
}

.subtitle {
    text-align: center;
    color: var(--oa-fg-dim);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ---------- Section Headers ---------- */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--oa-fg);
    border-bottom: 1px solid var(--oa-border);
    padding-bottom: 0.5rem;
}

.section-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--oa-fg);
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--oa-border);
}

.section-header .count {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--oa-fg-dim);
}

/* ---------- Cards ---------- */
.card {
    background: var(--oa-surface);
    border: 1px solid var(--oa-border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-header {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--oa-fg-dim);
    margin-bottom: 0.75rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition:
        background 0.2s,
        opacity 0.2s;
}

.btn-green {
    background: var(--oa-primary);
    color: var(--oa-fg-on-primary);
}
.btn-green:hover {
    background: var(--oa-primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--oa-primary);
    border: 1px solid var(--oa-primary);
}
.btn-outline:hover {
    background: color-mix(in srgb, var(--oa-primary) 10%, transparent);
}

.btn-red {
    background: var(--oa-danger-border);
    color: var(--oa-danger-fg);
}
.btn-red:hover {
    background: color-mix(in srgb, var(--oa-danger-border), white 12%);
}

.btn-disabled {
    background: var(--oa-bg);
    color: var(--oa-fg-faint);
    cursor: not-allowed;
}
.btn-disabled:hover {
    background: var(--oa-bg);
}

.edit-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

/* ---------- Flash Messages ---------- */
.error {
    background: var(--oa-danger-bg);
    border: 1px solid var(--oa-danger-border);
    color: var(--oa-danger-fg);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.success {
    background: color-mix(in srgb, var(--oa-primary) 20%, black);
    border: 1px solid var(--oa-primary);
    color: var(--oa-primary-lighter);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* ---------- Links ---------- */
a {
    color: var(--oa-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a:visited {
    color: var(--oa-primary);
}

.back-link {
    display: block;
    text-align: center;
    color: var(--oa-primary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 2rem;
}
.back-link:hover {
    text-decoration: underline;
}

/* ---------- Utility ---------- */
.text-primary {
    color: var(--oa-primary);
}

/* ---------- No Results ---------- */
.no-results {
    text-align: center;
    color: var(--oa-fg-dim);
    margin-top: 2rem;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--oa-fg-muted);
    margin-bottom: 0.4rem;
}

.form-group textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--oa-surface-inset);
    border: 1px solid var(--oa-border-strong);
    border-radius: 6px;
    color: var(--oa-fg);
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
}

.form-group textarea:focus {
    border-color: var(--oa-primary);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--oa-primary);
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.9rem;
    color: var(--oa-fg-muted);
    cursor: pointer;
}

/* ---------- Settings Inputs ---------- */
.settings-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    background: var(--oa-surface-inset);
    border: 1px solid var(--oa-border-strong);
    border-radius: 6px;
    color: var(--oa-fg);
    outline: none;
    transition: border-color 0.2s;
}

.settings-input:focus {
    border-color: var(--oa-primary);
}

/* ---------- Toggle Button Pair ---------- */
.toggle-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--oa-primary);
    cursor: pointer;
    background: transparent;
    color: var(--oa-primary);
    transition:
        background 0.2s,
        color 0.2s;
}

.toggle-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.toggle-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.toggle-btn.active {
    background: var(--oa-primary);
    color: var(--oa-fg-on-primary);
}

/* ---------- Guide Cards ---------- */
.guide-card {
    background: var(--oa-surface);
    border: 1px solid var(--oa-border);
    border-left: 4px solid var(--oa-primary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}
.guide-card:hover {
    background: var(--oa-surface-hover);
    border-color: var(--oa-border);
    border-left-color: var(--oa-primary);
}

.guide-info {
    flex: 1;
    min-width: 0;
}

.guide-title {
    color: var(--oa-primary-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}
.guide-title:hover {
    text-decoration: underline;
    color: var(--oa-primary-lighter);
}

.guide-url {
    color: var(--oa-fg-dim);
    text-decoration: none;
    font-size: 0.8rem;
    word-break: break-all;
    margin-top: 0.2rem;
    display: block;
}
.guide-url:hover {
    text-decoration: underline;
    color: var(--oa-fg-muted);
}

.guide-description {
    font-size: 0.85rem;
    color: var(--oa-fg-muted);
    margin-top: 0.35rem;
    line-height: 1.4;
}

.guide-author {
    font-size: 0.8rem;
    color: var(--oa-fg-dim);
    margin-top: 0.35rem;
}

.guide-date {
    margin-left: 0.5rem;
    color: var(--oa-fg-faint);
}

/* ---------- Games Grid ---------- */
.games-grid {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--oa-surface);
    border: 1px solid var(--oa-border);
    border-radius: 10px;
    padding: 1rem;
    text-decoration: none;
    color: var(--oa-fg);
    transition:
        background 0.2s,
        border-color 0.2s;

    position: relative;
}
.game-card:hover {
    background: var(--oa-surface-hover);
    border-color: var(--oa-primary);
}
.game-card.hidden {
    display: none;
}

.game-card img.game-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--oa-bg);
}

.game-info {
    flex: 1;
    min-width: 0;
}

.game-name-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.platform-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.game-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-progress {
    font-size: 0.85rem;
    color: var(--oa-fg-muted);
    margin-bottom: 0.4rem;
}

/* ---------- Progress Bars ---------- */
.progress-bar {
    height: 6px;
    background: var(--oa-bg);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--oa-primary);
    border-radius: 3px;
    transition: width 0.3s;
}

/* ---------- Auth Forms (login / register) ---------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.auth-form label {
    font-size: 0.95rem;
    color: var(--oa-fg-muted);
}

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--oa-border);
    border-radius: 6px;
    background: var(--oa-surface);
    color: var(--oa-fg);
    outline: none;
    transition: border-color 0.2s;
}
.auth-form input:focus {
    border-color: var(--oa-primary);
}

.auth-form button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: var(--oa-primary);
    color: var(--oa-fg-on-primary);
    cursor: pointer;
    transition: background 0.2s;
}
.auth-form button:hover {
    background: var(--oa-primary-hover);
}

.alt-link {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--oa-fg-dim);
    text-align: center;
}

.alt-link a {
    color: var(--oa-primary);
    text-decoration: none;
}
.alt-link a:hover {
    text-decoration: underline;
}

/* ---------- Rank Badges (leaderboard) ---------- */
.rank-badge {
    font-size: 1.4rem;
    font-weight: 700;
    min-width: 2rem;
    text-align: center;
}

.rank-badge.gold {
    color: var(--oa-gold);
}

.rank-badge.silver {
    color: var(--oa-silver);
}

.rank-badge.bronze {
    color: var(--oa-bronze);
}

.rank-badge.default {
    color: var(--oa-fg-dim);
}

/* ---------- Achievement Description (public guides) ---------- */
.achievement-description-text {
    color: var(--oa-fg-dim);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* ---------- Controls (search / sort / filter bar) ---------- */
.controls {
    max-width: 900px;
    margin: 0 auto 1.5rem auto;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 180px;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    background: var(--oa-surface);
    border: 1px solid var(--oa-border);
    border-radius: 6px;
    color: var(--oa-fg);
    outline: none;
    transition: border-color 0.2s;
}

.search-input::placeholder {
    color: var(--oa-fg-faint);
}

.search-input:focus {
    border-color: var(--oa-primary);
}

.sort-select,
.platform-select {
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    background: var(--oa-surface);
    border: 1px solid var(--oa-border);
    border-radius: 6px;
    color: var(--oa-fg);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2rem;
}

.sort-select:focus,
.platform-select:focus {
    border-color: var(--oa-primary);
}

/* ---------- Guides Links ---------- */
.guides-link {
    display: block;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--oa-primary-light);
    text-decoration: none;
    font-size: 0.95rem;
}

.guides-link:hover {
    text-decoration: underline;
    color: var(--oa-primary-lighter);
}

.achievement-guides-link {
    font-size: 0.8rem;
    color: var(--oa-primary-light);
    text-decoration: none;
    margin-top: 0.35rem;
    display: inline-block;
}

.achievement-guides-link:hover {
    text-decoration: underline;
    color: var(--oa-primary-lighter);
}

.guide-badge {
    font-size: 0.8rem;
    color: var(--oa-primary-light);
    margin-top: 0.15rem;
}

/* ---------- Showcase Buttons ---------- */
.showcase-btn-form {
    display: inline-block;
    margin-left: 0.75rem;
}

.showcase-btn {
    font-size: 0.8rem;
    color: var(--oa-accent);
    background: transparent;
    border: 1px solid var(--oa-accent);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
}

.showcase-btn:hover {
    background: var(--oa-accent);
    color: var(--oa-surface-inset);
}

.showcase-btn.in-showcase {
    border-color: var(--oa-fg-faint);
    color: var(--oa-fg-faint);
    cursor: default;
}

.showcase-btn.in-showcase:hover {
    background: transparent;
    color: var(--oa-fg-faint);
}

.showcase-game-form {
    display: block;
    text-align: center;
    margin-bottom: 2rem;
}

.showcase-game-btn {
    font-size: 0.95rem;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition:
        background 0.2s,
        color 0.2s;
}

.showcase-game-btn.add {
    color: var(--oa-accent);
    background: transparent;
    border: 1px solid var(--oa-accent);
}

.showcase-game-btn.add:hover {
    background: var(--oa-accent);
    color: var(--oa-surface-inset);
}

.showcase-game-btn.added {
    color: var(--oa-fg-faint);
    background: transparent;
    border: 1px solid var(--oa-border-strong);
    cursor: default;
}

/* ---------- Section Header Variants ---------- */
.section-header.unlocked {
    color: var(--oa-primary-light);
}

.section-header.locked {
    color: var(--oa-fg-dim);
}

/* ---------- Achievement Cards ---------- */
.achievement {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--oa-surface);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--oa-primary-light);
}

.achievement.locked {
    border-left-color: var(--oa-border-strong);
    opacity: 0.65;
}

.achievement-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--oa-surface-hover);
}

.achievement-info {
    flex: 1;
    min-width: 0;
}

.achievement-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--oa-fg);
}

.achievement-desc {
    font-size: 0.85rem;
    color: var(--oa-fg-muted);
    line-height: 1.4;
}

.achievement-meta {
    font-size: 0.75rem;
    color: var(--oa-primary-lighter);
    margin-top: 0.35rem;
}

.achievement-score {
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
    font-size: 1rem;
    font-weight: 700;
    color: var(--oa-primary);
    padding-top: 0.15rem;
}

.achievement.locked .achievement-score {
    color: var(--oa-fg-faint);
}

.achievement-rarity {
    font-size: 0.75rem;
    color: var(--oa-fg-dim);
    margin-top: 0.25rem;
}

.achievement-count {
    text-align: center;
    color: var(--oa-fg-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem auto;
    max-width: 900px;
    padding: 0 1rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--oa-surface);
    border: 1px solid var(--oa-border);
    border-radius: 6px;
    color: var(--oa-primary);
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--oa-surface-hover);
    border-color: var(--oa-primary);
}

.pagination-btn:disabled {
    color: var(--oa-fg-faint);
    border-color: var(--oa-border);
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--oa-fg-muted);
    white-space: nowrap;
}
