/* UniSky Payment Links */

:root {
    color-scheme: light;   /* always the light theme, whatever the OS is set to */
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e3e8f0;
    --text: #16202f;
    --muted: #6b7789;
    --brand: #1b6ef3;
    --brand-dark: #1558c8;
    --brand-soft: #eaf1ff;
    --success: #0f9d58;
    --success-soft: #e6f6ed;
    --danger: #d93b3b;
    --danger-soft: #fdecec;
    --warning: #b7791f;
    --warning-soft: #fdf3e2;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* ---------------- topbar ---------------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0;
}

.logo span { color: var(--brand); }

.topbar .sub {
    color: var(--muted);
    font-size: 13px;
}

/* ---------------- layout ---------------- */

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 20px 60px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
    align-items: start;
}

@media (max-width: 900px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 650;
}

.step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    flex: none;
}

.card-hint {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
}

/* ---------------- form bits ---------------- */

.field { display: block; margin-bottom: 14px; }

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.input, .select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.input:focus, .select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(27, 110, 243, .12);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 640px) {
    .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, opacity .15s;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover { background: var(--surface-2); }

.btn-block { width: 100%; }

.btn-lg { padding: 15px 22px; font-size: 16px; }

.btn:disabled, .btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------------- packages ---------------- */

.package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
    gap: 12px;
}

.package {
    position: relative;
    display: block;
    cursor: pointer;
}

.package input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.package-body {
    display: block;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: var(--surface-2);
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.package:hover .package-body { border-color: #c9d6ea; }

.package input:checked + .package-body {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 0 0 3px rgba(27, 110, 243, .1);
}

.package-name {
    display: block;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .03em;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.package input:checked + .package-body .package-name { color: var(--brand); }

.package-price {
    display: block;
    margin-top: 4px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.2;
}

.package-pv {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------------- products ---------------- */

.product-list { display: grid; gap: 10px; }

.product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color .15s, background .15s;
}

.product.is-chosen {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.product.is-blocked { opacity: .45; }

.product-thumb {
    width: 52px;
    height: 52px;
    padding: 4px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--muted);
    overflow: hidden;
    flex: none;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info { flex: 1 1 auto; min-width: 0; }

.product-name {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13.5px;
    letter-spacing: .02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-price { color: var(--muted); font-size: 13px; }

.stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    flex: none;
}

.stepper button {
    width: 34px;
    height: 36px;
    border: 0;
    background: var(--surface-2);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.stepper button:hover:not(:disabled) { background: #eef2f8; }

.stepper button:disabled { opacity: .35; cursor: not-allowed; }

.stepper .qty {
    width: 44px;
    height: 36px;
    border: 0;
    text-align: center;
    font: inherit;
    font-weight: 600;
    background: transparent;
    color: var(--text);
}

/* ---------------- summary ---------------- */

.summary { position: sticky; top: 20px; }

.summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    font-size: 14px;
}

.summary-row + .summary-row { border-top: 1px dashed var(--border); }

.summary-row .label { color: var(--muted); }
.summary-row .value { font-weight: 600; }

.summary-total {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.summary-total .label { font-weight: 600; }

.summary-total .value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.progress {
    height: 8px;
    border-radius: 99px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
    margin: 14px 0 6px;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--brand);
    transition: width .2s ease;
}

.progress-bar.is-full { background: var(--success); }

.summary-note {
    margin: 8px 0 16px;
    font-size: 13px;
    color: var(--muted);
    min-height: 20px;
}

.summary-note.is-ok { color: var(--success); font-weight: 600; }

/* ---------------- alerts ---------------- */

.alert {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 14px;
}

.alert-error { background: var(--danger-soft); color: #a02121; }
.alert-success { background: var(--success-soft); color: #0b6e3f; }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------------- generated link ---------------- */

.link-box {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 640px) {
    .link-box { flex-direction: column; }
}

.link-box .input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

/* ---------------- table ---------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data th, table.data td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
}

table.data tr:last-child td { border-bottom: 0; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending { background: var(--surface-2); color: var(--muted); }
.badge-initiated { background: var(--warning-soft); color: var(--warning); }
.badge-paid { background: var(--success-soft); color: #0b6e3f; }
.badge-failed { background: var(--danger-soft); color: #a02121; }

/* ---------------- customer pay page ---------------- */

.checkout {
    max-width: 560px;
    margin: 0 auto;
    padding: 32px 18px 60px;
}

.checkout-head {
    text-align: center;
    margin-bottom: 22px;
}

.checkout-head h1 {
    margin: 0 0 4px;
    font-size: 21px;
    letter-spacing: -.01em;
}

.pkg-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.item-row:last-of-type { border-bottom: 0; }

.item-qty {
    color: var(--muted);
    font-size: 13px;
}

.item-total { margin-left: auto; font-weight: 600; white-space: nowrap; }

.pay-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 16px;
    border-top: 2px solid var(--border);
}

.pay-total .label { font-weight: 600; }

.pay-total .value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.secure-note {
    margin-top: 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------------- status pages ---------------- */

.status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: #fff;
}

.status-icon.ok { background: var(--success); }
.status-icon.bad { background: var(--danger); }

.status-title { margin: 0 0 6px; font-size: 22px; }

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    font-size: 14px;
    border-bottom: 1px dashed var(--border);
}

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

.detail-row .label { color: var(--muted); }

.detail-row .value {
    font-weight: 600;
    word-break: break-all;
    text-align: right;
}

/* ---------------- login / setup ---------------- */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card { width: 100%; max-width: 400px; margin: 0; }

.login-title { margin: 0 0 4px; font-size: 19px; }

.setup-list {
    margin: 0 0 18px;
    padding-left: 18px;
    color: var(--muted);
    font-size: 14px;
}

.hidden { display: none !important; }
