/* ========================================
   HT黄金现货交易所 - Premium Dark Theme
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #09090b;
    --bg-secondary: #0f0f12;
    --bg-card: #141419;
    --bg-elevated: #1a1a21;
    --bg-hover: #1f1f28;
    
    --gold: #d4af37;
    --gold-light: #f0d875;
    --gold-dark: #a68928;
    --gold-glow: rgba(212, 175, 55, 0.15);
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --border: rgba(255, 255, 255, 0.06);
    --border-gold: rgba(212, 175, 55, 0.2);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    --transition: 0.2s ease;
}

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Subtle grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        linear-gradient(rgba(212, 175, 55, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -1;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--gold-light);
}

/* ========================================
   Header
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #000;
}

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

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wallet-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.wallet-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--gold-glow);
}

.wallet-btn.connected {
    background: var(--bg-elevated);
    color: var(--gold);
    border: 1px solid var(--border-gold);
}

/* Hamburger Menu Button */
.menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    gap: 5px;
    padding: 8px;
}

.menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-btn.open span:nth-child(2) {
    opacity: 0;
}

.menu-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 999;
    padding: 8px 16px;
    transform: translateY(-100%);
    opacity: 0;
    transition: var(--transition);
}

.mobile-menu.open {
    transform: translateY(0);
    opacity: 1;
}

.mobile-menu-link {
    display: block;
    padding: 14px 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.mobile-menu-link:hover, .mobile-menu-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* ========================================
   Main Layout
   ======================================== */
.main {
    padding-top: 60px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    text-align: center;
    padding: 60px 0 40px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.hero-title .gold {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 32px;
}

/* Rate Display */
.rate-display {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 16px 28px;
    margin-bottom: 40px;
}

.rate-item {
    text-align: center;
}

.rate-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.rate-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--gold);
}

.rate-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* ========================================
   Trade Card
   ======================================== */
.trade-section {
    max-width: 480px;
    margin: 0 auto;
}

.trade-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.trade-title {
    font-size: 1rem;
    font-weight: 600;
}

.trade-badge {
    font-size: 0.75rem;
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Input Group */
.input-group {
    margin-bottom: 12px;
}

.input-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.input-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    transition: var(--transition);
}

.input-box:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.input-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 500;
    outline: none;
    width: 100%;
}

.input-box input::placeholder {
    color: var(--text-muted);
}

.input-currency {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.currency-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.currency-icon.usdt {
    background: #26a17b;
    color: #fff;
}

.currency-icon.gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #000;
}

/* Swap Arrow */
.swap-arrow {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.swap-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Info Box */
.info-box {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px;
    margin: 16px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none;
    border-radius: var(--radius);
    color: #000;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px var(--gold-glow);
}

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

.submit-btn.secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.submit-btn.secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--gold);
    box-shadow: none;
}

.submit-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.submit-btn.danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    box-shadow: none;
}

/* ========================================
   Order / Payment Page
   ======================================== */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.back-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.page-title {
    font-size: 1.15rem;
    font-weight: 600;
}

/* Order Summary Card */
.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.order-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-no {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.order-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
}

.order-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.order-status.paid {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.order-status.completed {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.order-status.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.order-body {
    padding: 24px;
}

.order-amount {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.amount-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.amount-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 600;
    color: var(--gold);
}

.amount-value small {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

.order-details {
    display: grid;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

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

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.order-footer {
    padding: 20px 24px;
    background: var(--bg-secondary);
    display: flex;
    gap: 12px;
}

/* Payment Section */
.payment-section {
    margin-top: 20px;
}

.payment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.payment-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wallet-address-box {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}

.wallet-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.wallet-address {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--gold);
    word-break: break-all;
}

.copy-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ========================================
   Records Table
   ======================================== */
.records-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table th,
.records-table td {
    padding: 14px 20px;
    text-align: left;
}

.records-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.records-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--border);
}

.records-table tbody tr {
    transition: var(--transition);
    cursor: pointer;
}

.records-table tbody tr:hover {
    background: var(--bg-hover);
}

.records-table .order-no-cell {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* ========================================
   Connect Prompt
   ======================================== */
.connect-prompt {
    max-width: 400px;
    margin: 80px auto;
    text-align: center;
}

.connect-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
}

.connect-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.connect-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.connect-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* ========================================
   Notification
   ======================================== */
.notification {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    font-size: 0.9rem;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification.success { border-color: var(--success); }
.notification.error { border-color: var(--danger); }
.notification.info { border-color: var(--gold); }

.notification-icon { font-size: 1.1rem; }
.notification.success .notification-icon { color: var(--success); }
.notification.error .notification-icon { color: var(--danger); }
.notification.info .notification-icon { color: var(--gold); }

/* ========================================
   Loading
   ======================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 640px) {
    html { font-size: 13px; }
    
    .header { padding: 0 16px; }
    .nav { display: none; }
    .menu-btn { display: flex; }
    .mobile-menu { display: block; }
    
    .container { padding: 24px 16px; }
    
    .hero { padding: 40px 0 24px; }
    .hero-title { font-size: 2rem; }
    
    .rate-display {
        flex-direction: column;
        gap: 12px;
        padding: 16px 20px;
    }
    .rate-divider { width: 100%; height: 1px; }
    
    .trade-card { padding: 20px 16px; }
    
    .records-table th,
    .records-table td {
        padding: 12px;
        font-size: 0.8rem;
    }
    
    .order-header {
        padding: 16px;
    }
    
    .order-body {
        padding: 16px;
    }
    
    .amount-value {
        font-size: 1.6rem;
    }
}