/* app/static/css/pages.css - Login and lobby page styles */

/* ---------- Brand ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-suits {
    display: grid;
    grid-template-columns: repeat(2, 20px);
    gap: 3px;
    padding: 7px;
    border-radius: 12px;
    background: rgba(233, 222, 196, 0.06);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-suits img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
    /* suit PNGs carry ~60 % transparent padding */
    transform: scale(2.3);
}

.brand-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--text);
}

.brand-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

/* ---------- Login ---------- */
.login-container {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-header .brand-suits {
    grid-template-columns: repeat(4, 28px);
    gap: 6px;
    padding: 10px 12px;
}

.login-header .brand-suits img {
    width: 28px;
    height: 28px;
}

.login-header h1 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-2);
    font-size: 15px;
}

.name-suggestion-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    text-align: center;
}

.name-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.fantasy-name {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--brass-2);
    font-size: 28px;
    line-height: 1.2;
    min-height: 34px;
    margin-bottom: 14px;
    transition: opacity 0.2s var(--ease);
}

.fantasy-name.pulse {
    animation: pulseAnimation 0.4s var(--ease);
}

.generate-btn {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border-strong);
    padding: 8px 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.generate-btn:hover {
    background: rgba(233, 222, 196, 0.06);
    color: var(--text);
}

.form-actions {
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 14px 22px;
    font-size: 16px;
}

.login-footnote {
    margin-top: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

/* ---------- Lobby ---------- */
.lobby-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 2px 22px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-badge {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.user-badge i {
    color: var(--brass);
}

.user-id {
    color: var(--muted);
    font-weight: 500;
    font-size: 12px;
}

.logout-btn {
    color: var(--text-2);
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.logout-btn:hover {
    color: #ffb4a8;
    border-color: rgba(222, 90, 71, 0.4);
    background: rgba(222, 90, 71, 0.08);
}

.create-game-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background:
        radial-gradient(500px 200px at 0% 0%, rgba(240, 196, 106, 0.12), transparent 70%),
        linear-gradient(180deg, var(--surface-2), var(--surface));
    border-color: rgba(216, 167, 72, 0.22);
}

.create-game-card h2 {
    font-size: 22px;
    margin-bottom: 4px;
}

.create-game-card p {
    color: var(--text-2);
    font-size: 14px;
}

.create-game-card #create-game-status {
    flex-basis: 100%;
}

.create-game-card #create-game-status:empty {
    display: none;
}

.games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.games-header h2 {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.games-count {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 700;
    color: var(--brass-ink);
    background: var(--brass);
    border-radius: 999px;
    padding: 2px 8px;
    min-width: 22px;
    text-align: center;
}

.games-count:empty {
    display: none;
}

.refresh-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    color: var(--text);
    background: rgba(233, 222, 196, 0.06);
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.game-item:hover {
    border-color: var(--border-strong);
}

.game-item.my-game {
    border-color: rgba(216, 167, 72, 0.4);
    background: linear-gradient(90deg, rgba(216, 167, 72, 0.08), transparent 60%), var(--bg-2);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.game-name {
    font-weight: 700;
    color: var(--text);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.game-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-2);
}

.game-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(67, 183, 122, 0.18);
}

.game-item.in-progress .game-status::before {
    background: var(--warning);
    box-shadow: 0 0 0 3px rgba(227, 163, 59, 0.18);
}

.my-game-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brass-2);
    border: 1px solid rgba(216, 167, 72, 0.4);
    border-radius: 999px;
    padding: 1px 8px;
}

.player-slots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.player-slot {
    width: 10px;
    height: 14px;
    border-radius: 2px;
    background: rgba(233, 222, 196, 0.12);
}

.player-slot.filled {
    background: var(--brass);
}

.player-slots-text {
    color: var(--muted);
    font-size: 12px;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.game-actions {
    display: flex;
}

.join-btn, .enter-btn {
    padding: 9px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.join-btn {
    background: linear-gradient(180deg, var(--brass-2), var(--brass));
    color: var(--brass-ink);
    border-color: rgba(0, 0, 0, 0.25);
}

.join-btn:hover {
    background: linear-gradient(180deg, #f6d08a, var(--brass-2));
}

.enter-btn {
    background: var(--felt);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.enter-btn:hover {
    background: #236b48;
}

.status-badge {
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.in-progress-badge {
    background: rgba(227, 163, 59, 0.1);
    border: 1px solid rgba(227, 163, 59, 0.3);
    color: var(--warning);
}

.loading-games, .creating-game, .no-games {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.creating-game {
    flex-direction: row;
    justify-content: center;
    padding: 8px 0 0;
}

.no-games {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.no-games i {
    font-size: 30px;
    color: var(--brass);
    opacity: 0.7;
}

.no-games p {
    color: var(--text-2);
}

/* Animations */
@keyframes pulseAnimation {
    0% { transform: scale(1); opacity: 0.4; }
    60% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 560px) {
    .brand-title {
        font-size: 26px;
    }

    .login-header h1 {
        font-size: 34px;
    }

    .create-game-card .primary-btn {
        width: 100%;
    }

    .game-actions,
    .game-actions > * {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- Google sign-in / guest ---------- */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    background: #fff;
    color: #1f1f1f;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}

.google-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

.login-benefit {
    margin-top: 8px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 16px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-strong);
}

.guest-btn {
    width: 100%;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-card .error-message {
    margin: 0 0 16px;
}

/* ---------- Profile ---------- */
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid var(--brass);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-input {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    outline: none;
}

.text-input:focus {
    border-color: rgba(240, 196, 106, 0.7);
    box-shadow: 0 0 0 3px rgba(240, 196, 106, 0.15);
}

.field-help {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.profile-form .login-btn {
    margin-top: 6px;
}

.profile-links {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    font-size: 13px;
}

.profile-links a {
    color: var(--text-2);
    text-decoration: none;
}

.profile-links a:hover {
    color: var(--text);
}

.badge-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.google-chip {
    color: var(--brass-2);
    border-color: rgba(216, 167, 72, 0.4);
}

/* ---------- Invite page ---------- */
.invite-kicker {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brass-2);
}

.invite-card .login-header h1 {
    font-size: 34px;
}

.invite-seats {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.invite-seats li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    min-width: 0;
}

.invite-seats li.free {
    border-style: dashed;
    color: var(--muted);
}

.invite-seats .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--brass-ink);
    background: linear-gradient(180deg, var(--brass-2), var(--brass));
    overflow: hidden;
}

.invite-seats .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invite-seats .avatar.bot {
    background: var(--surface-3);
    color: var(--info);
}

.invite-seats .avatar.empty {
    background: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--muted);
}

.seat-label {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seat-label small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--brass-2);
}

.invite-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-actions .login-btn,
.invite-actions .guest-btn {
    text-decoration: none;
}

.invite-actions form .login-btn {
    width: 100%;
}

.guest-btn {
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
}

.invite-note {
    text-align: center;
    color: var(--text-2);
    margin-bottom: 6px;
}

/* ---------- Admin tools (lobby) ---------- */
.games-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-clear-btn {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(222, 90, 71, 0.12);
    border: 1px solid rgba(222, 90, 71, 0.45);
    color: #ff9d8e;
}

.admin-clear-btn:hover {
    background: var(--danger);
    color: #fff;
}

.admin-del-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    margin-right: 8px;
    border-radius: 50%;
    font-size: 13px;
    background: transparent;
    border: 1px solid rgba(222, 90, 71, 0.4);
    color: #ff9d8e;
}

.admin-del-btn:hover {
    background: var(--danger);
    color: #fff;
}

.game-actions {
    align-items: center;
}

@media (max-width: 560px) {
    .game-actions > .admin-del-btn {
        width: 36px;
        flex: none;
    }
}

.trophy-chip {
    font-size: 12px;
    font-weight: 800;
    color: var(--brass-2);
    background: rgba(216, 167, 72, 0.14);
    border-radius: 999px;
    padding: 1px 8px;
}

/* ---------- Language switch ---------- */
.lang-switch {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    overflow: hidden;
}

.lang-switch a {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    text-decoration: none;
}

.lang-switch a.on {
    background: var(--brass);
    color: var(--brass-ink);
}

.login-card > .lang-switch {
    display: flex;
    width: max-content;
    margin: -8px auto 18px;
}

.invite-waiting {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius);
    background: rgba(216, 167, 72, 0.08);
    border: 1px solid rgba(216, 167, 72, 0.35);
}

.invite-waiting > i {
    font-size: 22px;
    color: var(--brass-2);
}

a.join-btn.request-btn {
    text-decoration: none;
    border-radius: var(--radius-sm);
}

a.enter-btn.watch-btn {
    text-decoration: none;
    margin-right: 8px;
    border-radius: var(--radius-sm);
    background: rgba(90, 162, 214, 0.15);
    border: 1px solid rgba(90, 162, 214, 0.45);
}

/* ---------- Install as an app (PWA) ---------- */
.install-btn[hidden],
.install-hint[hidden] {
    display: none;
}

button.logout-btn {
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

.install-btn.logout-btn {
    color: var(--brass-2);
    border-color: rgba(240, 196, 106, 0.45);
}

.hero-play .install-btn {
    margin-top: 12px;
}

.install-hint {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(240, 196, 106, 0.1);
    border: 1px solid rgba(240, 196, 106, 0.35);
    color: var(--text);
    font-size: 13px;
    text-align: center;
}

/* ---------- Titles by matches won ---------- */
.user-badge .rank-title {
    color: var(--brass-2);
    font-weight: 700;
}

.profile-rank {
    margin: -6px 0 18px;
    text-align: center;
    color: var(--text-2);
    font-size: 14px;
}

.profile-rank strong {
    color: var(--brass-2);
}

.profile-rank span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

/* ---------- Lobby: last activity at a table ---------- */
.game-activity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}

.game-activity.live {
    color: var(--success);
    font-weight: 600;
}

.game-activity.live i {
    font-size: 7px;
    animation: livePulse 1.6s ease-in-out infinite;
}

.game-activity.stale {
    color: var(--warning);
}

.game-item:has(.game-activity.stale) .game-info {
    opacity: 0.7;
}

@keyframes livePulse {
    50% { opacity: 0.3; }
}
