/* ═══════════════════════════════════════════════════════════════════════
   AUTH STYLE – Synced with bacay.css / shared.css design system
   Uses same CSS variables (--bg, --surface, --border, --text, --muted, etc.)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Verified Badge ─────────────────────────────────────────────────── */
.verified-badge::after {
    content: '';
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-left: 3px;
    vertical-align: middle;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230d6efd' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01-.622-.636zm.287 5.984-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7 8.793l2.646-2.647a.5.5 0 0 1 .708.708z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ── Auth Modal Overlay (reuses modal-overlay pattern from bacay.css) ─ */
#auth-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

/* ── Auth Modal Card ────────────────────────────────────────────────── */
.auth-modal {
    width: min(100%, 480px);
    border-radius: 24px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    background:
        linear-gradient(180deg, rgba(91, 141, 238, 0.1), transparent 44%),
        var(--surface, #ffffff);
    box-shadow: var(--shadow, 0 18px 40px rgba(15,23,42,0.12));
    padding: 20px;
    color: var(--text, #172033);
    font-family: var(--font-body, "Be Vietnam Pro", sans-serif);
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.auth-modal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border, rgba(99,102,241,0.14));
}

.auth-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted, #64748b);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-family: inherit;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 400px) {
    .auth-tab-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

.auth-tab-btn:hover {
    background: var(--surface-soft, rgba(245,247,251,0.98));
    color: var(--text, #172033);
    transform: translateY(-1px);
}

.auth-tab-btn.active {
    background: linear-gradient(135deg, var(--blue, #4f68e8) 0%, var(--cyan, #0891b2) 100%);
    color: #ffffff;
    border-color: transparent;
    font-weight: 700;
}

.auth-tab-close {
    background: none;
    border: none;
    color: var(--muted, #64748b);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    margin-left: auto;
    border-radius: 10px;
    transition: background 0.2s;
    flex: none;
}

.auth-tab-close:hover {
    background: var(--surface-soft, rgba(245,247,251,0.98));
    color: var(--text, #172033);
}

/* ── Form Groups ─────────────────────────────────────────────────────── */
.auth-form-group {
    margin-bottom: 14px;
}

.auth-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted, #64748b);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.auth-input {
    width: 100%;
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    background: var(--bg, #f4f5f7);
    color: var(--text, #172033);
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
    border-color: var(--blue, #4f68e8);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 104, 232, 0.15);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.auth-submit-btn {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--blue, #4f68e8) 0%, var(--cyan, #0891b2) 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
    padding: 10px 14px;
    transition: transform 0.16s ease, opacity 0.2s;
    font-family: inherit;
    box-shadow: var(--shadow, 0 18px 40px rgba(15,23,42,0.12));
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.auth-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.auth-submit-btn.secondary {
    background: var(--surface-soft, rgba(245,247,251,0.98));
    color: var(--muted, #64748b);
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    box-shadow: none;
}

.auth-submit-btn.secondary:hover {
    color: var(--text, #172033);
}

/* ── Error Message ───────────────────────────────────────────────────── */
.auth-error-msg {
    color: var(--red, #e11d48);
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
    min-height: 18px;
}

/* ── Info text ───────────────────────────────────────────────────────── */
.auth-info {
    font-size: 12px;
    color: var(--muted, #64748b);
    text-align: center;
    margin-top: 6px;
    line-height: 1.4;
}

.auth-info .tick-green {
    color: #10b981;
    font-weight: bold;
}

/* ── Profile section (for logged-in users) ───────────────────────────── */
.auth-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 14px;
    background: var(--surface-soft, rgba(245,247,251,0.98));
    border: 1px solid var(--border, rgba(99,102,241,0.14));
}

.auth-profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blue, #4f68e8), var(--cyan, #0891b2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.auth-profile-info {
    min-width: 0;
}

.auth-profile-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text, #172033);
}

.auth-profile-username {
    font-size: 12px;
    color: var(--muted, #64748b);
    font-family: var(--font-mono, "IBM Plex Mono", monospace);
}

/* ── Character Filters ──────────────────────────────────────────────── */
.auth-char-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.auth-char-filter-group {
    display: flex;
    gap: 2px;
    background: var(--surface-soft, rgba(245,247,251,0.98));
    border-radius: 10px;
    padding: 2px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
}

.auth-char-filter {
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted, #64748b);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.auth-char-filter.active {
    background: linear-gradient(135deg, var(--blue, #4f68e8), var(--cyan, #0891b2));
    color: #fff;
}

.auth-char-filter:hover:not(.active) {
    color: var(--text, #172033);
    background: rgba(99,102,241,0.06);
}

/* ── Character Grid ─────────────────────────────────────────────────── */
.auth-char-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    padding: 2px;
    min-height: 410px;
}

.auth-char-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted, #64748b);
    font-size: 13px;
    padding: 24px 0;
}

.auth-char-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px 8px;
    border-radius: 14px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    background: var(--surface-soft, rgba(245,247,251,0.98));
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
    min-width: 0;
}

.auth-char-card.is-active {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.auth-char-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
}

.auth-char-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text, #172033);
    text-align: center;
    line-height: 1.2;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-char-rarity {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 6px;
}

.auth-char-rarity.rarity-normal {
    color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}

.auth-char-rarity.rarity-rare {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.auth-char-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
}

.auth-char-badge.active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

.auth-char-badge.owned {
    color: var(--blue, #4f68e8);
    background: rgba(79, 104, 232, 0.1);
}

.auth-char-badge.locked {
    color: var(--muted, #64748b);
    background: rgba(100, 116, 139, 0.08);
}

.auth-char-btn {
    width: 100%;
    padding: 4px 0;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.auth-char-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.auth-char-btn.use {
    background: linear-gradient(135deg, var(--blue, #4f68e8), var(--cyan, #0891b2));
    color: #fff;
}

.auth-char-btn.buy {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
}

/* ── Character Paging ───────────────────────────────────────────────── */
.auth-char-paging {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-top: 8px;
}

.auth-char-page-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    background: var(--surface-soft, rgba(245,247,251,0.98));
    color: var(--text, #172033);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.auth-char-page-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--blue, #4f68e8), var(--cyan, #0891b2));
    color: #fff;
    border-color: transparent;
}

.auth-char-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.auth-char-page-info {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted, #64748b);
    min-width: 48px;
    text-align: center;
}

/* ── Shop Tab ────────────────────────────────────────────────────────── */
.auth-shop-tabs {
    display: flex;
    gap: 2px;
    background: var(--surface-soft, rgba(245,247,251,0.98));
    border-radius: 10px;
    padding: 2px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    margin-bottom: 10px;
    overflow-x: auto;
}

.auth-shop-tabs .auth-char-filter {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.auth-shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 2px;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

@media (min-width: 400px) {
    .auth-shop-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.auth-shop-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px 8px;
    border-radius: 14px;
    border: 1px solid var(--border, rgba(99,102,241,0.14));
    background: var(--surface-soft, rgba(245,247,251,0.98));
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
    min-width: 0;
}

.auth-shop-card.is-active {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.auth-shop-card.is-locked {
    opacity: 0.6;
}

.auth-shop-preview {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg, rgba(0,0,0,0.05));
    font-size: 1.3rem;
}

.auth-shop-sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 64px;
    height: 64px;
    border-radius: 8px;
}

.auth-shop-sticker-grid img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

.auth-shop-title-preview {
    padding: 8px 4px;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.3;
    word-break: break-word;
}

.auth-shop-chatframe-preview {
    width: 90%;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    text-align: center;
    background: var(--bg, rgba(0,0,0,0.03));
}

.auth-shop-desc {
    font-size: 10px;
    color: var(--muted, #64748b);
    text-align: center;
    line-height: 1.2;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Dark mode support ───────────────────────────────────────────────── */
body.dark-mode .auth-modal {
    background:
        linear-gradient(180deg, rgba(91, 141, 238, 0.08), transparent 44%),
        var(--bg-card, #0e0e24);
    border-color: var(--border);
}

body.dark-mode .auth-input {
    background: var(--bg-deep, #060614);
}

body.dark-mode .auth-profile-header {
    background: var(--bg-deep, #060614);
}

body.dark-mode .auth-char-card {
    background: var(--bg-deep, #060614);
}

body.dark-mode .auth-shop-card {
    background: var(--bg-deep, #060614);
}

body.dark-mode .auth-shop-tabs {
    background: var(--bg-deep, #060614);
}

body.dark-mode .auth-shop-preview {
    background: rgba(255,255,255,0.05);
}
