/*
 * Story 24.9 (unified) — styles for the single-page upgrade flow at
 * /ascenders. Follows the dark-blue + gold palette established by the
 * tower dashboard (see dialog-theme.css for the tokens).
 */

/* ──────────────────────────────────────────────────────────────
 * Page shell
 * ─────────────────────────────────────────────────────────── */

.asc-upgrade-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 24px 140px 24px; /* bottom padding makes room for the fixed selector */
    color: rgba(255, 255, 255, 0.92);
    min-height: 100vh;
    box-sizing: border-box;
}

/* ──────────────────────────────────────────────────────────────
 * Header row
 * ─────────────────────────────────────────────────────────── */

.asc-upgrade-page__header {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

.asc-upgrade-page__back-button {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

.asc-upgrade-page__back-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.asc-upgrade-page__portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(96, 165, 250, 0.18);
    transition: transform 200ms ease-out;
}

.asc-upgrade-page__portrait--bumping {
    animation: asc-upgrade-portrait-bump 500ms ease-in-out;
}

@keyframes asc-upgrade-portrait-bump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.1); filter: brightness(1.15); }
    100% { transform: scale(1); filter: brightness(1); }
}

.asc-upgrade-page__title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.asc-upgrade-page__name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.asc-upgrade-page__level,
.asc-upgrade-page__hp {
    margin: 2px 0 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
}

.asc-upgrade-page__wallet {
    display: flex;
    gap: 16px;
    font-weight: 600;
}

.asc-upgrade-page__wallet-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ──────────────────────────────────────────────────────────────
 * Body (cost + cards + confirm)
 * ─────────────────────────────────────────────────────────── */

.asc-upgrade-page__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.asc-upgrade-page__loading,
.asc-upgrade-page__error,
.asc-upgrade-page__terminal,
.asc-upgrade-page__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px 24px;
}

.asc-upgrade-page__cost-line {
    margin: 0;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 10px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    font-weight: 600;
    text-align: center;
}

.asc-upgrade-page__instruction {
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
}

.asc-upgrade-page__cards {
    display: grid;
    gap: 16px;
}

.asc-upgrade-page__cards--1 { grid-template-columns: minmax(260px, 360px); justify-content: center; }
.asc-upgrade-page__cards--2 { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
.asc-upgrade-page__cards--3 { grid-template-columns: repeat(3, minmax(220px, 1fr)); }

@media (max-width: 720px) {
    .asc-upgrade-page__cards--2,
    .asc-upgrade-page__cards--3 {
        grid-template-columns: 1fr;
    }
}

.asc-upgrade-page__confirm-row {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.asc-upgrade-page__button {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

.asc-upgrade-page__button--primary {
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
    color: #1f2937;
}

.asc-upgrade-page__button--primary:hover:not(:disabled) {
    filter: brightness(1.08);
}

.asc-upgrade-page__button--primary:disabled {
    background: rgba(75, 85, 99, 0.6);
    color: rgba(255, 255, 255, 0.6);
    cursor: not-allowed;
}

.asc-upgrade-page__deficit {
    margin: 0;
    color: rgba(248, 113, 113, 0.9);
    font-weight: 600;
}

/* ──────────────────────────────────────────────────────────────
 * Ability card (kept from prior story — unchanged)
 * ─────────────────────────────────────────────────────────── */

.asc-ability-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.65);
    border: 2px solid rgba(96, 165, 250, 0.2);
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 160ms ease;
}

.asc-ability-card:hover {
    border-color: rgba(96, 165, 250, 0.6);
    transform: translateY(-1px);
}

.asc-ability-card--selected {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45), 0 10px 24px rgba(0, 0, 0, 0.45);
    transform: scale(1.02);
}

.asc-ability-card__header {
    display: flex;
    gap: 12px;
    align-items: center;
}

.asc-ability-card__icon {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.asc-ability-card__title-block {
    display: flex;
    flex-direction: column;
}

.asc-ability-card__name {
    font-size: 1.05rem;
    font-weight: 600;
}

.asc-ability-card__level-badge {
    font-size: 0.8rem;
    color: rgba(251, 191, 36, 0.9);
    font-weight: 600;
}

.asc-ability-card__deltas {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.asc-ability-card__deltas th {
    text-align: left;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    padding: 4px 8px 4px 0;
}

.asc-ability-card__deltas td {
    text-align: right;
    font-weight: 600;
    padding: 4px 0;
}

/* ──────────────────────────────────────────────────────────────
 * Bottom selector row
 * ─────────────────────────────────────────────────────────── */

.asc-upgrade-page__selector {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.0) 0%, rgba(15, 23, 42, 0.85) 30%, rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(4px);
}

.asc-selector-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 100px;
    max-width: 140px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid rgba(96, 165, 250, 0.2);
    border-radius: 10px;
    color: inherit;
    cursor: pointer;
    text-align: center;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 160ms ease;
}

.asc-selector-tile:hover {
    border-color: rgba(96, 165, 250, 0.6);
    transform: translateY(-2px);
}

.asc-selector-tile--selected {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.08);
}

.asc-selector-tile--locked {
    cursor: not-allowed;
}

.asc-selector-tile--locked .asc-selector-tile__portrait {
    filter: grayscale(1) brightness(0.55);
}

.asc-selector-tile--locked:hover {
    transform: none;
    border-color: rgba(96, 165, 250, 0.2);
}

.asc-selector-tile__portrait-wrap {
    position: relative;
    width: 48px;
    height: 48px;
}

.asc-selector-tile__portrait {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(96, 165, 250, 0.18);
}

.asc-selector-tile__lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.5rem;
}

.asc-selector-tile__name {
    font-size: 0.85rem;
    font-weight: 600;
}

.asc-selector-tile__badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.18);
    color: rgba(255, 255, 255, 0.85);
}

.asc-selector-tile__badge--max {
    background: rgba(251, 191, 36, 0.25);
    color: #fbbf24;
}

.asc-selector-tile__badge--locked {
    background: rgba(248, 113, 113, 0.18);
    color: rgba(248, 113, 113, 0.95);
}

.asc-selector-tile__progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.asc-selector-tile__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #fbbf24);
    border-radius: 999px;
    transition: width 200ms ease-out;
}

.asc-selector-tile__progress-fill--overflow {
    background: linear-gradient(90deg, #fbbf24, #f97316);
    box-shadow: inset 0 0 6px rgba(251, 191, 36, 0.45);
}

.asc-selector-tile__progress-label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
}

@media (max-width: 540px) {
    .asc-upgrade-page__selector {
        flex-wrap: wrap;
        gap: 8px;
    }

    .asc-selector-tile {
        min-width: 84px;
        padding: 6px 8px;
    }
}
