* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

section {
    padding: 30px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* 訂單資訊 */
.order-info {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 16px;
}

.order-number {
    font-weight: 600;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.amount {
    font-size: 24px;
    font-weight: 700;
    color: #e74c3c;
}

.amount-input {
    width: 140px;
    font-size: 24px;
    font-weight: 700;
    color: #e74c3c;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    padding: 6px 12px;
    outline: none;
}

.amount-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.amount-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
    text-align: right;
}

.amount-hint code {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 6px;
    border-radius: 6px;
}

/* 付款方式選擇 */
.payment-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.payment-option {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.payment-option:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.payment-option.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.payment-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.payment-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.payment-desc {
    font-size: 12px;
    color: #666;
}

/* 付款區塊 */
.payment-section {
    margin-top: 30px;
}

/* twMP 進階設定（測試用） */
.twmp-advanced {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
}

.twmp-advanced summary {
    cursor: pointer;
    font-weight: 700;
    color: #333;
}

.twmp-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.twmp-advanced-grid label span {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.twmp-advanced-grid input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

.twmp-advanced-grid input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

.twmp-advanced-hint {
    grid-column: 1 / -1;
    font-size: 12px;
    color: #ff6b00;
    font-weight: 600;
}

.device-selection {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.device-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.device-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* QR Code 容器 */
.qrcode-container {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
}

#qrcode {
    display: inline-block;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.qrcode-instruction {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* 付款狀態 */
.payment-status {
    text-align: center;
    padding: 20px;
}

.status-pending {
    color: #f39c12;
    font-size: 18px;
    font-weight: 600;
}

.status-success {
    color: #27ae60;
    font-size: 18px;
    font-weight: 600;
}

.status-failed {
    color: #e74c3c;
    font-size: 18px;
    font-weight: 600;
}

/* 手機付款 */
.mobile-payment-info {
    text-align: center;
    padding: 40px;
}

.mobile-payment-info p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

/* LINE Pay 付款 */
.linepay-payment-info {
    text-align: center;
    padding: 40px;
}

.linepay-payment-info p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

/* LINE Pay 商店選擇 */
.linepay-store-selection {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.linepay-store-selection p {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.store-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.store-btn {
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.store-btn:hover {
    border-color: #00c300;
    background: #f0fff0;
}

.store-btn.active {
    border-color: #00c300;
    background: #00c300;
    color: white;
}

.store-btn.disabled,
.store-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.store-note {
    font-size: 12px;
    color: #ff6b00;
    margin-top: 10px;
    font-weight: 500;
}

/* LINE Pay 環境選擇 */
.linepay-env-selection {
    text-align: center;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 20px;
}

.env-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.env-btn {
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s;
}

.env-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.env-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.env-btn.danger:hover {
    border-color: #e74c3c;
    background: #fff5f5;
}

.env-btn.danger.active {
    border-color: #e74c3c;
    background: #e74c3c;
    color: white;
}

.env-warning {
    display: none;
    font-size: 12px;
    color: #e74c3c;
    font-weight: 700;
    margin-top: 6px;
}

.env-warning.show {
    display: block;
}

/* TaiwanPay 被掃付款 */
.bescanned-payment-info {
    text-align: center;
    padding: 40px;
}

.bescanned-payment-info p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.scan-input-container {
    margin: 30px 0;
}

.scan-code-input {
    width: 100%;
    max-width: 500px;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.scan-code-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按鈕 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-secondary:hover {
    background: #f0f4ff;
}

/* 結果區塊 */
.result-section {
    text-align: center;
    padding: 40px;
}

.result-section.success {
    background: #d4edda;
    color: #155724;
}

.result-section.failed {
    background: #f8d7da;
    color: #721c24;
}

#result-content {
    font-size: 20px;
    margin-bottom: 30px;
    font-weight: 600;
}

/* 資訊訊息 */
.info-message {
    text-align: center;
    padding: 40px;
}

.info-message p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

/* 工具類 */
.hidden {
    display: none !important;
}

/* 響應式設計 */
@media (max-width: 600px) {
    .payment-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .device-selection {
        flex-direction: column;
    }

    header h1 {
        font-size: 24px;
    }

    section {
        padding: 20px;
    }
}
