/* checkout.css - market/checkout.php */

.checkout-container {
    --checkout-radius: 4px;
    --checkout-text: #f2f2f2;
    --checkout-white: #fff;
    --checkout-muted: #b8b8b8;
    --checkout-muted-soft: #9f9f9f;
    --checkout-accent: #e67e22;
    --checkout-border: 1px solid rgba(255, 255, 255, 0.07);
    --checkout-border-soft: 1px solid rgba(255, 255, 255, 0.06);
    --checkout-panel-bg: rgba(255, 255, 255, 0.035);
    --checkout-card-bg: rgba(0, 0, 0, 0.24);
    --checkout-card-bg-hover: rgba(255, 255, 255, 0.045);
    --checkout-field-bg: #1f1f1f;
    --checkout-field-bg-dark: #181818;
    --checkout-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    --checkout-danger-text: #ffd8d8;
    --checkout-danger-bg: rgba(160, 40, 40, 0.22);
    --checkout-danger-border: 1px solid rgba(220, 80, 80, 0.25);
    --checkout-success-text: #dff7df;
    --checkout-success-bg: rgba(56, 161, 105, 0.22);
    --checkout-success-border: 1px solid rgba(56, 161, 105, 0.30);
    --checkout-transition: 0.2s ease;

    max-width: 1060px;
    margin: 18px auto;
    padding: 24px;
    color: var(--checkout-text);
    background:
        linear-gradient(135deg, rgba(230, 126, 34, 0.10), rgba(79, 135, 194, 0.10)),
        linear-gradient(180deg, rgba(42, 42, 42, 0.96), rgba(18, 18, 18, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--checkout-radius);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.checkout-container h2 {
    margin: 0;
    color: var(--checkout-white);
    font-size: 28px;
    font-weight: 700;
}

.checkout-page-header,
.checkout-page-meta,
.checkout-nav .market-nav-right,
.checkout-panel-header,
.order-summary-header,
.cart-item-meta-row,
.line-total-container,
.checkout-btn-cta,
.remove-item-btn,
.deliver-to-option,
.deliver-to-character,
.checkout-race-pill,
.checkout-count-pill,
.cart-item-race,
.deliver-to-race {
    display: flex;
    align-items: center;
}

.checkout-page-header,
.checkout-panel-header {
    align-items: flex-start;
    justify-content: space-between;
}

.checkout-page-header {
    gap: 18px;
    margin-bottom: 14px;
}

.checkout-page-subtitle {
    margin: 6px 0 0;
    color: var(--checkout-muted);
    font-size: 14px;
    line-height: 1.4;
}

.checkout-page-meta {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

.checkout-nav {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: var(--checkout-border);
}

.checkout-form {
    margin: 0;
}

.checkout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 296px;
    gap: 18px;
    align-items: start;
}

.cart-column,
.checkout-values-row,
.qty-block {
    display: flex;
    flex-direction: column;
}

.cart-column {
    gap: 18px;
    min-width: 0;
}

.checkout-panel,
.order-summary-card,
.checkout-empty-state {
    border: var(--checkout-border);
    border-radius: var(--checkout-radius);
    background: var(--checkout-panel-bg);
}

.checkout-panel,
.order-summary-card {
    padding: 16px;
    box-shadow: var(--checkout-shadow);
}

.checkout-panel-header {
    gap: 14px;
    margin-bottom: 12px;
}

.checkout-panel-title,
.order-summary-header h3 {
    margin: 0;
    color: var(--checkout-white);
    font-size: 18px;
}

.checkout-panel-title {
    font-weight: 700;
}

.order-summary-header h3 {
    font-weight: 600;
}

.checkout-panel-subtitle {
    margin: 4px 0 0;
    color: #b7b7b7;
    font-size: 13px;
    line-height: 1.35;
}

.checkout-race-pill,
.checkout-count-pill,
.cart-item-race,
.deliver-to-race {
    justify-content: center;
    min-height: 22px;
    border-radius: var(--checkout-radius);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.checkout-race-pill,
.checkout-count-pill,
.deliver-to-race {
    padding: 4px 8px;
}

.cart-item-race {
    padding: 4px 8px 4px 0;
}

.checkout-count-pill {
    color: #e8e8e8;
    background: rgba(255, 255, 255, 0.08);
}

.checkout-race-pill.common,
.cart-item-race.common,
.deliver-to-race.common {
    color: #e8e8e8;
}

.checkout-race-pill.slayer,
.cart-item-race.slayer,
.deliver-to-race.slayer {
    color: #3a6ea5;
}

.checkout-race-pill.vampire,
.cart-item-race.vampire,
.deliver-to-race.vampire {
    color: #b22234;
}

.checkout-race-pill.ousters,
.cart-item-race.ousters,
.deliver-to-race.ousters {
    color: #2e8b57;
}

.checkout-race-pill.mixed {
    color: #ffe2b8;
    background: rgba(230, 126, 34, 0.26);
    border-color: rgba(230, 126, 34, 0.34);
}

.deliver-to-list,
.cart-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.deliver-to-list {
    max-height: 230px;
    overflow-y: auto;
    border: var(--checkout-border);
    border-radius: var(--checkout-radius);
}

.deliver-to-row {
    margin: 0;
    padding: 0;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.20);
    border-bottom: var(--checkout-border-soft);
    transition: background var(--checkout-transition);
}

.deliver-to-row:last-child {
    border-bottom: 0;
}

.deliver-to-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.deliver-to-option {
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    color: inherit;
    cursor: pointer;
}

.deliver-to-option input[type="radio"] {
    flex: 0 0 auto;
    margin: 0;
}

.deliver-to-character {
    flex: 1;
    gap: 8px;
    min-width: 0;
}

.deliver-to-name {
    overflow: hidden;
    color: var(--checkout-white);
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deliver-to-row-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.55);
}

.deliver-to-row-disabled:hover {
    background: transparent;
}

.deliver-to-row-disabled .deliver-to-option {
    cursor: not-allowed;
}

.deliver-to-locked {
    margin-left: auto;
    padding: 3px 7px;
    border-radius: var(--checkout-radius);
    color: #f0c6c6;
    background: rgba(160, 40, 40, 0.28);
    border: var(--checkout-danger-border);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.deliver-to-empty,
.deliver-to-warning,
.order-summary-warning {
    padding: 10px 12px;
    border-radius: var(--checkout-radius);
    color: var(--checkout-danger-text);
    background: var(--checkout-danger-bg);
    border: var(--checkout-danger-border);
    font-size: 13px;
    font-weight: 700;
}

.deliver-to-warning {
    margin-bottom: 10px;
}

.cart-items-panel {
    overflow: hidden;
}

.cart-item {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 126px 122px;
    gap: 14px;
    align-items: center;
    margin: 0;
    padding: 14px;
    border-radius: var(--checkout-radius);
    background: var(--checkout-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.065);
    transition:
        background var(--checkout-transition),
        border-color var(--checkout-transition);
}

.cart-item + .cart-item {
    margin-top: 10px;
}

.cart-item:hover {
    background: var(--checkout-card-bg-hover);
    border-color: rgba(230, 126, 34, 0.22);
}

.cart-item-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 82px;
    height: 82px;
    padding: 7px;
    border-radius: var(--checkout-radius);
    background: rgba(0, 0, 0, 0.28);
    border: var(--checkout-border-soft);
}

.cart-item-img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
}

.cart-item-info,
.checkout-value-block,
.order-summary {
    min-width: 0;
}

.item-name {
    margin-bottom: 7px;
    color: var(--checkout-white);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.cart-item-meta-row {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 7px;
}

.cart-item-unit-price {
    color: #d8d8d8;
    font-size: 12px;
    font-weight: 700;
}

.item-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--checkout-muted-soft);
    font-size: 13px;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.qty-block {
    align-items: center;
    gap: 7px;
}

.qty-label,
.checkout-value-label {
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.qty-label {
    color: #bdbdbd;
    font-size: 11px;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    height: 34px;
    overflow: hidden;
    background: var(--checkout-field-bg);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--checkout-radius);
}

.qty-btn {
    width: 34px;
    height: 34px;
    border: 0;
    color: var(--checkout-white);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    transition: background var(--checkout-transition);
}

.qty-btn:hover,
.qty-btn:focus {
    background: rgba(230, 126, 34, 0.28);
    outline: none;
}

.qty-input {
    width: 48px;
    height: 34px;
    padding: 0 6px;
    color: var(--checkout-white);
    background: var(--checkout-field-bg-dark);
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    font-weight: 600;
}

.qty-input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(230, 126, 34, 0.30);
}

.line-total-container {
    justify-content: flex-end;
    gap: 9px;
}

.line-total {
    color: var(--checkout-white);
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.remove-item-btn {
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--checkout-radius);
    color: #ffb2b2;
    background: rgba(183, 67, 67, 0.10);
    border: 1px solid rgba(220, 80, 80, 0.24);
    cursor: pointer;
    transition:
        color var(--checkout-transition),
        background var(--checkout-transition),
        border-color var(--checkout-transition),
        box-shadow var(--checkout-transition);
}

.remove-item-btn:hover,
.remove-item-btn:focus {
    color: var(--checkout-white);
    background: linear-gradient(180deg, #c94d4d, #9a2b2b);
    border-color: rgba(220, 80, 80, 0.44);
    outline: none;
}

.remove-item-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(201, 77, 77, 0.24);
}

.remove-item-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.order-summary {
    position: sticky;
    top: 16px;
}

.order-summary-header {
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.checkout-values-row {
    gap: 10px;
}

.checkout-value-block {
    padding: 12px 13px;
    border-radius: var(--checkout-radius);
    text-align: left;
    background: rgba(0, 0, 0, 0.26);
    border: 1px solid rgba(255, 255, 255, 0.065);
}

.checkout-value-label {
    display: block;
    margin-bottom: 4px;
    color: #aeb7bf;
    font-size: 11px;
}

.checkout-value-amount {
    display: block;
    color: var(--checkout-white);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
}

.checkout-value-amount.negative {
    color: #ff8f8f;
}

.order-summary-warning {
    margin-top: 12px;
}

.checkout-btn-cta {
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    margin-top: 14px;
    padding: 9px 14px;
    border-radius: var(--checkout-radius);
    border: 1px solid rgba(191, 89, 22, 0.40);
    color: var(--checkout-white);
    background: linear-gradient(180deg, #eb8a35, #ca6415);
    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition:
        background var(--checkout-transition),
        border-color var(--checkout-transition),
        box-shadow var(--checkout-transition),
        filter var(--checkout-transition);
}

.checkout-btn-cta:hover,
.checkout-btn-cta:focus {
    color: var(--checkout-white);
    background: linear-gradient(180deg, #f09a48, #d86d19);
    border-color: rgba(230, 126, 34, 0.62);
    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    outline: none;
    text-decoration: none;
}

.checkout-btn-cta:active {
    color: var(--btn-donate-text, #fff);
    background: linear-gradient(135deg, #d35400, #c0392b);
    border-color: var(--checkout-accent);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.30);
    filter: brightness(0.9);
}

.checkout-btn-cta:focus-visible {
    box-shadow:
        0 0 0 3px rgba(230, 126, 34, 0.22),
        0 3px 12px rgba(0, 0, 0, 0.20);
}

.checkout-btn-cta.btn-disabled,
.checkout-btn-cta.btn-disabled:hover,
.checkout-btn-cta.btn-disabled:focus,
.checkout-btn-cta.btn-disabled:active,
.checkout-btn-cta:disabled,
.checkout-btn-cta:disabled:hover,
.checkout-btn-cta:disabled:focus,
.checkout-btn-cta:disabled:active {
    opacity: 0.55;
    cursor: not-allowed;
    color: #aaa;
    background: linear-gradient(180deg, #535353, #3b3b3b);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    filter: none;
    pointer-events: none;
}

.checkout-summary-donate {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.purchase-message,
.removed-message {
    margin: 0 0 14px;
    padding: 11px 13px;
    border-radius: var(--checkout-radius);
    font-size: 13px;
    font-weight: 600;
}

.purchase-message {
    color: var(--checkout-success-text);
    background: var(--checkout-success-bg);
    border: var(--checkout-success-border);
}

.removed-message {
    color: var(--checkout-danger-text);
    background: var(--checkout-danger-bg);
    border: var(--checkout-danger-border);
}

.checkout-empty-state {
    padding: 42px 24px;
    text-align: center;
}

.checkout-empty-icon {
    margin-bottom: 10px;
    color: var(--checkout-accent);
    font-size: 34px;
}

.checkout-empty-cart-svg {
    display: inline-block;
    fill: currentColor;
}

.checkout-empty-state h3 {
    margin: 0 0 8px;
    color: var(--checkout-white);
    font-size: 22px;
}

.checkout-empty-state p {
    max-width: 420px;
    margin: 0 auto 18px;
    color: #bcbcbc;
    font-size: 14px;
}

.checkout-empty-btn {
    width: auto;
    min-width: 180px;
    margin-top: 0;
}

.feedback-message {
    display: none;
}

/* ============================
   Auth Gate Login Modal
   ============================ */

body.auth-gate-lock {
    overflow: hidden;
}

.auth-gate-shell {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    margin: 0;
    padding: 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-gate-shell.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-gate-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(circle at 50% 15%, rgba(184, 122, 34, 0.18) 0%, rgba(0, 0, 0, 0) 42%),
        rgba(10, 8, 6, 0.86);
    backdrop-filter: blur(4px);
}

.auth-gate-panel {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    color: #1f1f1f;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.72),
        0 0 0 1px rgba(0, 0, 0, 0.28);
}

.auth-gate-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 16px;
    background: linear-gradient(180deg, #1c1710 0%, #111008 100%);
    border-bottom: 1px solid rgba(184, 122, 34, 0.28);
}

.auth-gate-kicker {
    margin: 0 0 5px;
    color: #c89535;
    font-size: 0.70rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-gate-title {
    margin: 0;
    color: #f5f0e0;
    font-size: 1.22rem;
    font-weight: 700;
    line-height: 1.2;
}

.auth-gate-close {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 999px;
    color: #c8c0b0;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 28px;
    text-align: center;
    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.auth-gate-close:hover,
.auth-gate-close:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

.auth-gate-body {
    position: relative;
    padding: 18px 20px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f9f9f9 54%, #f1f1f1 100%);
}

.auth-gate-body::before {
    content: "";
    display: block;
    height: 4px;
    margin-bottom: 16px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(184, 122, 34, 0.45), transparent);
}

.auth-gate-module-title {
    margin: 0 0 10px;
    color: #3a3a3a;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-gate-hidden-label {
    display: none;
}

.auth-gate-error {
    margin: 0 0 10px;
    padding: 7px 10px;
    border-radius: 5px;
    color: #b23a2e;
    background: rgba(178, 58, 46, 0.10);
    border: 1px solid rgba(178, 58, 46, 0.30);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.4;
}

.auth-gate-form {
    margin: 0;
}

.auth-gate-fields {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 10px;
}

.auth-gate-fields input[type="text"],
.auth-gate-fields input[type="password"] {
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.22);
    border-radius: 5px;
    color: #1f1f1f;
    background: #ffffff;
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.4;
    outline: none;
}

.auth-gate-fields input[type="text"]:focus,
.auth-gate-fields input[type="password"]:focus {
    border-color: #b87a22;
    box-shadow: 0 0 0 2px rgba(184, 122, 34, 0.15);
}

.auth-gate-submit {
    width: 100%;
    min-height: 0;
    margin-top: 0;
    padding: 9px 14px;
    border: 0;
    border-radius: 5px;
    color: #f0ece0;
    background: linear-gradient(180deg, #3a3a3a 0%, #1f1f1f 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: none;
    transition: background 0.2s ease;
}

.auth-gate-submit:hover,
.auth-gate-submit:focus {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    outline: none;
}

.auth-gate-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 12px;
    color: #888888;
    font-size: 0.82rem;
}

.auth-gate-links a {
    color: #8a5918;
    text-decoration: underline;
    font-weight: 700;
}

.auth-gate-links a:hover {
    color: #c89535;
}

.auth-gate-link-disabled {
    color: #aaaaaa;
    cursor: default;
}

.auth-gate-sep {
    color: #cccccc;
}

.auth-gate-hint {
    margin: 14px 0 0;
    color: #888888;
    text-align: center;
    font-size: 0.80rem;
    line-height: 1.45;
}

/* ============================
   Responsive
   ============================ */

@media (max-width: 920px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    .order-summary {
        position: static;
    }

    .checkout-values-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .checkout-container {
        padding: 16px;
    }

    .checkout-page-header,
    .checkout-nav,
    .deliver-to-character {
        flex-direction: column;
    }

    .checkout-page-header,
    .checkout-nav {
        align-items: stretch;
    }

    .checkout-page-meta,
    .checkout-nav .market-nav-right {
        justify-content: flex-start;
    }

    .checkout-nav {
        gap: 12px;
    }

    .checkout-nav .market-nav-right {
        flex-wrap: wrap;
    }

    .cart-item {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 12px;
    }

    .cart-item-image-wrap {
        width: 72px;
        height: 72px;
    }

    .qty-block,
    .line-total-container {
        grid-column: 1 / -1;
    }

    .qty-block {
        align-items: flex-start;
    }

    .line-total-container {
        justify-content: space-between;
        padding-top: 10px;
        border-top: var(--checkout-border-soft);
    }

    .checkout-values-row {
        grid-template-columns: 1fr;
    }

    .deliver-to-character {
        align-items: flex-start;
        gap: 5px;
    }

    .deliver-to-locked {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .checkout-panel,
    .order-summary-card {
        padding: 13px;
    }

    .checkout-panel-header {
        flex-direction: column;
    }

    .cart-item {
        grid-template-columns: 1fr;
    }

    .cart-item-image-wrap {
        width: 88px;
        height: 88px;
    }

    .auth-gate-shell {
        padding: 10px;
    }

    .auth-gate-panel {
        max-width: 100%;
    }
}