/* TFC Redemption — frontend styles */

/* ── Balance bar ──────────────────────────────────────────── */
.tfcr-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 24px;
    font-size: 15px;
    color: #166534;
}
.tfcr-balance strong { font-size: 20px; font-weight: 700; }

/* ── Catalog grid ─────────────────────────────────────────── */
.tfcr-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 0 0 32px;
}

.tfcr-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.tfcr-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.10); }

.tfcr-thumb { aspect-ratio: 1/1; overflow: hidden; background: #f9fafb; }
.tfcr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tfcr-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.tfcr-body h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    color: #111827;
}

.tfcr-var-select {
    width: 100%;
    font-size: 13px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
}

.tfcr-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.tfcr-pts-line {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}
.tfcr-pts-num {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

/* ── Stock badge ──────────────────────────────────────────── */
.tfcr-stock-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f0fdf4;
    color: #059669;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}
.tfcr-stock-badge.tfcr-stock-empty,
.tfcr-stock-badge.tfcr-stock-low {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.tfcr-stock-badge.tfcr-stock-low {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

/* ── Sold out card state ──────────────────────────────────── */
.tfcr-card-soldout { opacity: .7; }
.tfcr-card-soldout .tfcr-thumb { position: relative; }

.tfcr-soldout-badge {
    position: absolute;
    top: 10px; left: 10px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: .5px;
}

.tfcr-btn:disabled {
    background: #d1d5db !important;
    color: #9ca3af !important;
    cursor: not-allowed;
    filter: none !important;
}

.tfcr-label-only {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
}
.tfcr-empty { color: #9ca3af; text-align: center; padding: 32px 0; }

/* ── Buttons ──────────────────────────────────────────────── */
.tfcr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s, transform .1s;
    width: 100%;
    margin-top: auto;
}
.tfcr-btn:hover  { filter: brightness(1.06); }
.tfcr-btn:active { transform: scale(.98); }

.tfcr-open-modal  { background: #059669; color: #fff; }
.tfcr-btn-login   { background: #e5e7eb; color: #374151; }
.tfcr-btn-confirm { background: #059669; color: #fff; font-size: 15px; padding: 13px; }
.tfcr-btn-confirm:disabled { background: #d1d5db; cursor: not-allowed; }
.tfcr-close-success { background: #f3f4f6; color: #374151; }

/* ── Modal overlay ────────────────────────────────────────── */
.tfcr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.tfcr-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.tfcr-modal h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    padding-right: 32px;
    color: #111827;
}

.tfcr-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    line-height: 1;
}
.tfcr-close:hover { background: #e5e7eb; }

.tfcr-pts-summary {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}
.tfcr-pts-summary strong { color: #111827; }

/* ── Shipping toggle ──────────────────────────────────────── */
.tfcr-ship-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.tfcr-ship-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    transition: border-color .15s, background .15s;
}
.tfcr-ship-opt:has(input:checked) {
    border-color: #059669;
    background: #f0fdf4;
    color: #065f46;
}
.tfcr-ship-opt input { display: none; }

/* ── Form fields ──────────────────────────────────────────── */
#tfcr-pos-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.tfcr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tfcr-input {
    width: 100%;
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    font-family: inherit;
    resize: vertical;
}
.tfcr-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5,150,105,.12);
}

/* ── Alerts ───────────────────────────────────────────────── */
.tfcr-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}
.tfcr-alert-warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.tfcr-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.tfcr-alert-ok    { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
