/* 苹果风格的全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 苹果设计系统颜色 */
    --primary-blue: #007AFF;
    --primary-purple: #5856D6;
    --success-green: #34C759;
    --warning-orange: #FF9500;
    --error-red: #FF3B30;
    --background-primary: #F2F2F7;
    --background-secondary: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --text-tertiary: #C7C7CC;
    --border-color: #C6C6C8;
    --shadow-light: rgba(0, 0, 0, 0.04);
    --shadow-medium: rgba(0, 0, 0, 0.08);
    --shadow-heavy: rgba(0, 0, 0, 0.12);
    
    /* 圆角 */
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 16px;
    --radius-xl: 20px;
    
    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* 字体 */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background-primary);
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-time {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 主要内容区域 */
.main {
    flex: 1;
    padding: var(--spacing-xl) var(--spacing-lg);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 查询卡片 */
.query-card {
    background: var(--background-secondary);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px var(--shadow-light);
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
}

.card-header {
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-md);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.card-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* 输入区域 */
.input-section {
    padding: var(--spacing-lg);
}

.input-group {
    margin-bottom: var(--spacing-lg);
}

.input-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 48px 16px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-medium);
    font-size: 16px;
    font-family: var(--font-family);
    background: var(--background-secondary);
    transition: all 0.2s ease;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-small);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.toggle-password:hover {
    background: var(--background-primary);
    color: var(--text-primary);
}

/* 查询按钮 */
.query-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
    border: none;
    border-radius: var(--radius-medium);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.query-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
}

.query-btn:active {
    transform: translateY(0);
}

.query-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 结果区域 */
.result-section {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.result-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px 12px;
    background: rgba(52, 199, 89, 0.1);
    border-radius: var(--radius-small);
    font-size: 14px;
    font-weight: 500;
    color: var(--success-green);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 余额信息 */
.balance-info {
    margin-bottom: var(--spacing-lg);
}

.balance-card {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-large);
    margin-bottom: var(--spacing-md);
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: var(--spacing-xs);
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.balance-amount-usd {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: var(--spacing-sm);
}

.change-value-usd {
    font-size: 14px;
    opacity: 0.8;
    margin-left: var(--spacing-xs);
}

.balance-change {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 14px;
    opacity: 0.9;
}

.change-icon {
    font-weight: bold;
}

.balance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.stat-item {
    background: var(--background-primary);
    padding: var(--spacing-md);
    border-radius: var(--radius-medium);
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 令牌信息 */
.token-info {
    background: var(--background-primary);
    border-radius: var(--radius-medium);
    padding: var(--spacing-md);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-label {
    font-size: 14px;
    color: var(--text-secondary);
}

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

/* 错误区域 */
.error-section {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: rgba(255, 59, 48, 0.05);
}

.error-icon {
    flex-shrink: 0;
}

.error-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--error-red);
    margin-bottom: var(--spacing-xs);
}

.error-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 底部 */
.footer {
    background: var(--background-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: var(--spacing-lg);
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-blue);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--background-secondary);
    border-radius: var(--radius-large);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 40px var(--shadow-heavy);
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-small);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--background-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-body p {
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        padding: var(--spacing-md);
    }
    
    .main {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .query-card {
        margin: 0;
    }
    
    .card-header {
        padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md);
    }
    
    .input-section {
        padding: var(--spacing-md);
    }
    
    .result-section {
        padding: var(--spacing-md);
    }
    
    .balance-amount {
        font-size: 28px;
    }
    
    .balance-stats {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .card-header h1 {
        font-size: 24px;
    }
    
    .balance-amount {
        font-size: 24px;
    }
    
    .modal-content {
        width: 95%;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --background-primary: #000000;
        --background-secondary: #1C1C1E;
        --text-primary: #FFFFFF;
        --text-secondary: #98989D;
        --text-tertiary: #636366;
        --border-color: #38383A;
        --shadow-light: rgba(0, 0, 0, 0.2);
        --shadow-medium: rgba(0, 0, 0, 0.4);
        --shadow-heavy: rgba(0, 0, 0, 0.6);
    }
    
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
}