/* =========================================
   SECURE EXCHANGE - Claude暖色风格
   Primary: #C45D35 | BG: #FFFCF9
   ========================================= */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #C45D35;
    --primary-hover: #A84D2A;
    --primary-light: #F5E6DE;
    --bg: #FFFCF9;
    --bg-card: #FFFFFF;
    --bg-nav: #FFFFFF;
    --text: #2D2B2A;
    --text-secondary: #8A8580;
    --border: #EDE8E3;
    --success: #2E7D5D;
    --warning: #C47A35;
    --danger: #C43535;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-width: 480px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--primary-hover);
}

/* Nav */
.nav {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 252, 249, 0.92);
}

.nav-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    margin-right: auto;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    border-bottom-color: var(--primary);
}

.nav-auth {
    display: flex;
    gap: 0.5rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden { display: none !important; }

/* Main */
.main {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
    width: 100%;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.2s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hero-sub {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Cards */
.rate-card,
.exchange-card,
.orders-card,
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

/* Rate Card */
.rate-card {
    text-align: center;
    background: linear-gradient(135deg, var(--bg-card), var(--primary-light));
}

.rate-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.rate-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.rate-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.rate-updated {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap input {
    width: 100%;
    padding: 0.7rem 4.5rem 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196, 93, 53, 0.12);
}

.input-wrap input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-suffix {
    position: absolute;
    right: 0.9rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    pointer-events: none;
}

.result-box {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.result-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* Exchange Info */
.exchange-info {
    margin-top: 1.25rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.3rem 0;
}

/* Auth Warning */
.auth-warning {
    background: #FFF8F0;
    border: 1px solid #F0DCC8;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    color: var(--warning);
    margin-bottom: 1rem;
}

/* Auth Card */
.auth-card {
    max-width: 400px;
    margin: 2rem auto;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s;
    outline: none;
}

.auth-card input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196, 93, 53, 0.12);
}

.auth-alt {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Orders */
.orders-list {
    min-height: 100px;
}

.order-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.9rem;
}

.order-item {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.order-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.order-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.order-item-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.order-item-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-pending { background: #FFF8F0; color: var(--warning); }
.status-paid { background: #E8F5F0; color: var(--success); }
.status-completed { background: #E8F5F0; color: var(--success); }
.status-expired { background: #F5EDE8; color: var(--text-secondary); }
.status-cancelled { background: #F5EDE8; color: var(--text-secondary); }

.order-item-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.order-item-details span {
    color: var(--text-secondary);
}

.order-item-details strong {
    color: var(--text);
    font-weight: 600;
}

.orders-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.page-btn {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: fadeIn 0.2s ease;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    line-height: 1;
}

.order-detail {
    margin-top: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

.detail-addr {
    font-family: monospace;
    font-size: 0.78rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    z-index: 300;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    max-width: 90vw;
}

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

.toast.success {
    background: var(--success);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(1rem); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
}

.footer-inner {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 640px) {
    .main {
        padding: 1rem 0.75rem 3rem;
    }

    .rate-value {
        font-size: 2rem;
    }

    .nav-inner {
        padding: 0 0.75rem;
    }

    .nav-links {
        gap: 0.75rem;
    }

    .modal-content {
        padding: 1.5rem;
    }
}
