/* ================================================
   Ticket C — Import Game UI (Chess.com / Lichess)
   Entry button + modal + recent-games list.
   Reuses base style.css variables/components; adds
   nothing to the frozen Study Workspace layout.
   ================================================ */

/* Entry button sits alongside Upload PGN / Upload / New Game — same .btn
   .btn-secondary chrome, just kept to its intrinsic width in the flex row. */
.ga-import-open-btn { flex: 0 0 auto; }

/* ── Overlay ─────────────────────────────────── */
.gaimp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 77, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 24px;
    z-index: 1000;
    overflow-y: auto;
}

body.gaimp-modal-open { overflow: hidden; }

/* ── Modal card ──────────────────────────────── */
.gaimp-modal {
    width: 100%;
    max-width: 560px;
    padding: 22px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gaimp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gaimp-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gaimp-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
}
.gaimp-close:hover { color: var(--text-primary); }

/* ── Steps ───────────────────────────────────── */
.gaimp-step {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gaimp-label {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ── Provider choice ─────────────────────────── */
.gaimp-providers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.gaimp-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.gaimp-provider:hover { border-color: var(--accent); }

.gaimp-provider-selected {
    border-color: var(--accent);
    background: rgba(11, 31, 77, 0.06);
    box-shadow: 0 0 0 3px rgba(11, 31, 77, 0.12);
}

[data-theme="dark"] .gaimp-provider-selected {
    background: rgba(255, 255, 255, 0.06);
}

.gaimp-provider i { font-size: 1.05em; }

/* ── Username row ────────────────────────────── */
.gaimp-username-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gaimp-input {
    flex: 1 1 220px;
    min-width: 0;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.gaimp-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(11, 31, 77, 0.1);
}

.gaimp-load-btn { flex: 0 0 auto; }

/* Ticket C owns this button's primary-blue styling entirely in this file
   (matches .ga-analyze-btn.btn-primary in game.css, which stays untouched
   per the UI freeze — no shared selector across the two files). */
.gaimp-load-btn.btn-primary {
    background: #2f6feb;
    box-shadow: 0 8px 20px rgba(47, 111, 235, 0.28);
}

.gaimp-load-btn.btn-primary:hover {
    background: #1d4fc4;
}

/* ── Status / error line ─────────────────────── */
.gaimp-status {
    font-size: 0.9rem;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}
.gaimp-status a { color: var(--accent); font-weight: 600; }

.gaimp-status-error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.gaimp-status-auth {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.12);
    color: var(--text-primary);
}

/* ── Recent games list ───────────────────────── */
.gaimp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 46vh;
    overflow-y: auto;
    padding-right: 2px;
}

.gaimp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
}

.gaimp-row-main { min-width: 0; }

.gaimp-row-players {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.gaimp-row-vs {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.gaimp-row-white, .gaimp-row-black {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 15ch;
}

.gaimp-row-meta {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-primary);
    opacity: 0.85;
}
.gaimp-row-sub {
    margin-top: 1px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.gaimp-analyze-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* ── Narrow screens ──────────────────────────── */
@media (max-width: 560px) {
    .gaimp-providers { grid-template-columns: 1fr; }
    .gaimp-row { flex-direction: column; align-items: stretch; }
    .gaimp-analyze-btn { width: 100%; justify-content: center; }
}
