/* =========================================================
   XTPay 收银台样式 - 设计规范
   间距体系: 4 / 8 / 12 / 16 / 20 / 24
   字号体系: 12 / 13 / 14 / 16 / 20 / 34
   ========================================================= */

/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* 品牌色 */
    --cash-green: #00D632;
    --cash-green-dark: #00A826;
    --cash-green-light: #E8FBEE;

    /* 文字 */
    --text-primary: #1A1D21;
    --text-secondary: #5F6672;
    --text-muted: #9AA1AC;

    /* 背景 / 边框 */
    --bg: #F3F5F7;
    --card: #FFFFFF;
    --field-bg: #F7F8FA;
    --border: #E8EAED;
    --border-light: #F0F1F4;

    /* 功能色 */
    --danger: #EF4444;
    --warn-bg: #FFF8EC;
    --warn-border: #FFE7BA;
    --warn-text: #B25E09;

    /* 圆角 / 阴影 */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== 卡片容器 ===== */
.cashier-container {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== 顶部 ===== */
.cashier-header {
    padding: 20px 20px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.cashier-header .logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cashier-header .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--cash-green), var(--cash-green-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.cashier-header .logo-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.cashier-header .merchant-name {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 警告提示(按钮下方) ===== */
.warning-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--warn-text);
    line-height: 1.4;
}

.warning-banner .warning-icon {
    font-size: 12px;
    flex-shrink: 0;
}

/* ===== 主体区域 ===== */
.cashier-body {
    padding: 20px 20px 4px;
    flex: 1;
}

/* 表单区块 */
.form-section {
    margin-bottom: 20px;
}

/* 区块标签(表单字段) */
.section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* 区块标题(信息列表) */
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* 字段提示 */
.field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.required {
    color: var(--danger);
    font-weight: 700;
}

/* ===== 金额下拉 ===== */
.amount-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--field-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.amount-select-wrap:focus-within {
    border-color: var(--cash-green);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(0, 214, 50, 0.1);
}

.amount-select-wrap .currency-symbol {
    font-size: 22px;
    font-weight: 700;
    color: var(--cash-green);
    padding-left: 16px;
    flex-shrink: 0;
}

.amount-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    flex: 1;
    font-size: 32px;
    font-weight: 800;
    border: none;
    outline: none;
    color: var(--text-primary);
    background: transparent;
    letter-spacing: -0.5px;
    padding: 10px 40px 10px 8px;
    cursor: pointer;
}

.amount-select:focus {
    color: var(--cash-green-dark);
}

.amount-select option {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--cash-green);
    pointer-events: none;
}

/* ===== 账号输入 ===== */
.account-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--field-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.account-input-wrap:focus-within {
    border-color: var(--cash-green);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(0, 214, 50, 0.1);
}

/* Locked $ prefix - not editable, not selectable */
.account-at {
    font-size: 18px;
    font-weight: 700;
    color: var(--cash-green);
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.account-input {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    border: none;
    outline: none;
    color: var(--text-primary);
    background: transparent;
    padding: 13px 0;
    min-width: 0;
}

.account-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 14px;
}

/* ===== 订单信息 ===== */
.info-list {
    background: var(--field-bg);
    border-radius: var(--radius-md);
    padding: 4px 16px;
}

.info-list .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.info-list .info-row:last-child {
    border-bottom: none;
}

.info-list .info-label {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.info-list .info-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-list .info-mono {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
}

/* ===== 支付方式 ===== */
.pay-method-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--cash-green);
    background: var(--cash-green-light);
    border-radius: var(--radius-md);
    cursor: default;
}

.pay-method-item .method-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--cash-green), var(--cash-green-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    flex-shrink: 0;
}

.pay-method-item .method-info {
    flex: 1;
    min-width: 0;
}

.pay-method-item .method-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.pay-method-item .method-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.pay-method-item .method-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--cash-green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
}

/* ===== 底部 ===== */
.cashier-footer {
    padding: 8px 20px 16px;
    border-top: 1px solid var(--border-light);
}

.pay-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--cash-green), var(--cash-green-dark));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0, 214, 50, 0.3);
}

.pay-btn:hover:not(:disabled) {
    filter: brightness(1.05);
}

.pay-btn:active:not(:disabled) {
    transform: scale(0.985);
}

.pay-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.pay-btn .btn-icon {
    font-size: 17px;
}

.pay-btn #btnAmount {
    background: rgba(255, 255, 255, 0.22);
    padding: 1px 10px;
    border-radius: 999px;
    font-size: 14px;
}

/* 安全提示 */
.security-tip {
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.security-tip .lock {
    font-size: 13px;
}

/* ===== Loading ===== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(26, 29, 33, 0.88);
    color: #fff;
    padding: 11px 22px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 9999;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: var(--danger);
}

/* ===== Apple Pay 主题 (wayCode = applepay) ===== */
.theme-apple {
    --cash-green: #000000;
    --cash-green-dark: #1C1C1E;
    --cash-green-light: #F5F5F7;
}

.apple-logo {
    width: 1em;
    height: 1em;
    display: block;
}

.theme-apple .cashier-header .logo-icon,
.theme-apple .pay-method-item .method-icon,
.theme-apple .pay-btn {
    background: #000;
}

.theme-apple .cashier-header .logo-icon .apple-logo {
    margin-top: -2px;
}

.theme-apple .pay-method-item .method-icon .apple-logo {
    font-size: 22px;
    margin-top: -2px;
}

.theme-apple .pay-btn .btn-icon .apple-logo {
    font-size: 18px;
    margin-top: -3px;
}

.theme-apple .amount-select-wrap:focus-within,
.theme-apple .account-input-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.theme-apple .pay-btn {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.theme-apple .pay-btn:disabled {
    background: var(--text-muted);
    box-shadow: none;
}

/* ===== 响应式: PC ===== */
@media (min-width: 768px) {
    .cashier-container {
        max-width: 440px;
    }
}

/* ===== 响应式: H5 全宽 ===== */
@media (max-width: 480px) {
    body {
        padding: 0;
        align-items: stretch;
    }

    .cashier-container {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .cashier-footer {
        margin-top: auto;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}
