/* ============================================
   虚拟币兑换工具 - 样式表
   Cryptocurrency Exchange Tool - Stylesheet
   ============================================ */

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

:root {
    --primary-color: #1a73e8;
    --secondary-color: #f57c00;
    --success-color: #34a853;
    --danger-color: #d33b27;
    --warning-color: #fbbc04;
    --dark-color: #202124;
    --light-color: #f8f9fa;
    --border-color: #dadce0;
    --text-color: #3c4043;
    --text-light: #5f6368;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.16);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--light-color);
    line-height: 1.6;
}

/* ============================================
   通用样式
   ============================================ */

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

.section {
    padding: 40px 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 15px;
    color: var(--text-light);
}

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

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

/* ============================================
   头部导航
   ============================================ */

header {
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

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

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

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

/* ============================================
   主要内容区域
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    color: white;
    margin-bottom: 20px;
    font-size: 3rem;
}

.hero p {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* ============================================
   兑换表单
   ============================================ */

.exchange-container {
    max-width: 600px;
    margin: 40px auto;
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.input-group {
    display: flex;
    gap: 10px;
}

input[type="text"],
input[type="number"],
select {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

input[type="number"] {
    font-size: 1.1rem;
}

select {
    cursor: pointer;
    background-color: white;
}

.switch-button {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.switch-button:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
}

.switch-button:active {
    transform: rotate(180deg);
}

/* ============================================
   按钮样式
   ============================================ */

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

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

.btn-primary:hover {
    background-color: #1557b0;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

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

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

.btn-secondary:hover {
    background-color: #e65100;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* ============================================
   结果显示
   ============================================ */

.result-box {
    margin-top: 30px;
    padding: 25px;
    background-color: var(--light-color);
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
    display: none;
}

.result-box.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.result-box.error {
    border-left-color: var(--danger-color);
    background-color: #fce4e4;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
    color: var(--text-color);
}

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

.result-value.error {
    color: var(--danger-color);
}

.exchange-rate {
    background-color: white;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 0.95rem;
    color: var(--text-light);
}

/* ============================================
   汇率表格
   ============================================ */

.rates-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.rates-table thead {
    background-color: var(--light-color);
}

.rates-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.rates-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.rates-table tbody tr:hover {
    background-color: var(--light-color);
}

.coin-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.coin-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.rate-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
}

/* ============================================
   加载动画
   ============================================ */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

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

.spinner {
    text-align: center;
    padding: 20px;
}

/* ============================================
   提示信息
   ============================================ */

.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
}

.alert.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   页脚
   ============================================ */

footer {
    background-color: var(--dark-color);
    color: white;
    padding: 40px 0;
    margin-top: 60px;
}

footer p {
    color: rgba(255,255,255,0.7);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: rgba(255,255,255,0.7);
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    color: rgba(255,255,255,0.5);
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .exchange-container {
        padding: 25px;
        margin: 20px auto;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .switch-button {
        width: 100%;
        height: 45px;
    }
    
    .nav-links {
        gap: 15px;
    }
    
    .rates-table {
        font-size: 0.9rem;
    }
    
    .rates-table th,
    .rates-table td {
        padding: 10px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .exchange-container {
        padding: 20px;
        margin: 15px auto;
    }
    
    .section {
        padding: 25px 0;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .result-value {
        font-size: 1.1rem;
    }
}

/* ============================================
   打印样式
   ============================================ */

@media print {
    header, footer, .nav-links {
        display: none;
    }
    
    .exchange-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .btn {
        display: none;
    }
}
