:root {
    --gold-primary: #d4a017;
    --gold-dark: #a0780c;
    --gold-light: #f7e98e;
    --gold-gradient: linear-gradient(135deg, #d4a017 0%, #f7e98e 100%);
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --select-shadow: 0 4px 12px rgba(212, 160, 23, 0.15);
    --select-hover-shadow: 0 6px 20px rgba(212, 160, 23, 0.25);
    --border-radius: 16px;
    --border-radius-small: 8px;
}

.gold-price-container {
    width: min(70vw, 960px);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    --text-tertiary: rgba(100, 116, 139, 0.9);
    --background-elevated: rgba(255, 255, 255, 0.9);
}

/* 调整标题样式与摸鱼办保持一致 */
.gold-price-container .title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gold-price-container .subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.gold-price-container .header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

@media (max-width: 1200px) {
    .gold-price-container {
        width: min(85vw, 960px);
    }
}

@media (max-width: 768px) {
    .gold-price-container {
        width: 100%;
        padding: var(--spacing-lg) var(--spacing-md);
        --background-elevated: rgba(255, 255, 255, 0.92);
    }
}

/* Footer样式 */
.footer {
    margin-top: auto;
    padding: var(--spacing-lg) 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: #1a73e8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #1558d6;
}

.footer .copyright {
    margin: 0;
    line-height: 1.6;
}

.footer .footer-icon {
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #000000 !important;
        --surface-color: #1C1C1E !important;
        --text-primary: #FFFFFF !important;
        --text-secondary: #8E8E93 !important;
        --border-color: #38383A !important;
    }
    
    body {
        background-color: #000000 !important;
        color: #FFFFFF !important;
    }
    
    .container {
        background-color: #000000 !important;
    }
    
    .gold-price-container {
        --text-tertiary: rgba(148, 163, 184, 0.85);
        --background-elevated: rgba(30, 41, 59, 0.7);
    }
    
    .card {
        background: var(--surface-color);
        border-color: var(--border-color);
    }
    
    /* 移除了原来的选择框暗色模式样式 */
    
    /* 暗色模式下的切换按钮背景 */
    .unit-toggle,
    .chart-section .range-toggle {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(51, 65, 85, 0.8) 100%);
    }
    
    /* 暗色模式下的输入框和数量输入框 */
    .control-item input,
    .quantity-input {
        background: rgba(30, 41, 59, 0.7);
        color: rgba(255, 255, 255, 0.9);
        border-color: rgba(148, 163, 184, 0.3);
    }
    
    .quantity-input span {
        background: var(--gold-gradient);
        color: white;
    }
    
    /* 暗色模式下的自动刷新控件 */
    .auto-refresh-select {
        background: rgba(30, 41, 59, 0.7);
        color: rgba(255, 255, 255, 0.9);
        border-color: rgba(148, 163, 184, 0.3);
    }
    
    /* 暗色模式下的单位切换按钮 */
    .unit-toggle,
    .currency-toggle {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(51, 65, 85, 0.8) 100%);
        border-color: rgba(148, 163, 184, 0.3);
    }
}

/* 微交互动画 */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.control-item select:hover::after,
.unit-btn.active::after,
.range-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
    pointer-events: none;
    border-radius: inherit;
}

/* 添加脉冲效果 */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(212, 160, 23, 0);
    }
}

.unit-btn.active,
.range-btn.active {
    animation: pulse 2s infinite;
}

.gold-price-container .main-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    padding-bottom: var(--spacing-xxl);
}

.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

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

/* 自动刷新控件样式 */
.auto-refresh-control {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.auto-refresh-control label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auto-refresh-select {
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
    border: 2px solid var(--border-color);
    background: var(--background-elevated);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4a017' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
    min-width: 100px;
}

.auto-refresh-select:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.15);
}

.auto-refresh-select:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.15), 0 0 0 3px rgba(212, 160, 23, 0.2);
    outline: none;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.muted-text {
    color: var(--text-tertiary);
    margin-top: var(--spacing-xxs);
}

.data-source {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin-top: var(--spacing-xxs);
    font-style: italic;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

.icon-button .spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(212, 160, 23, 0.3);
    border-top-color: var(--gold-primary);
    animation: spin 0.8s linear infinite;
}

.icon-button.loading {
    cursor: progress;
    color: var(--gold-dark);
}

.icon-button.loading svg {
    display: none;
}

.icon-button:hover,
.icon-button:focus-visible {
    color: var(--text-primary);
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.2);
}

.price-display {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.price-main {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
}

.price-value {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 700;
    color: var(--gold-primary);
}

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

.price-change {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success-color);
}

.price-change.negative {
    color: var(--danger-color);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

/* 美化控制项标签 */
.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.control-item > span:first-child {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    position: relative;
    padding-left: 12px;
}

.control-item > span:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--gold-gradient);
    border-radius: 2px;
}

.control-help {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* 移除了原来的选择框样式，现在使用切换按钮 */

/* 美化输入框样式 */
.control-item input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    background: var(--background-elevated);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.control-item input:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.15);
}

.control-item input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.15), 0 0 0 4px rgba(212, 160, 23, 0.2);
    outline: none;
}

/* 重新设计单位切换按钮 - 与输入框统一高度 */
.unit-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    gap: 1px;
    position: relative;
    overflow: hidden;
    width: fit-content;
    height: 48px; /* 与数量输入框统一高度 */
}

.unit-btn {
    border: none;
    background: transparent;
    padding: 0 16px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 0;
    text-align: center;
    height: 42px; /* 减去容器padding后的高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.unit-btn.active {
    background: var(--gold-gradient);
    color: white;
    box-shadow: 0 2px 6px rgba(212, 160, 23, 0.4), 
                0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(-0.5px);
}

.unit-btn:hover:not(.active) {
    color: var(--gold-dark);
    background: rgba(212, 160, 23, 0.1);
    transform: translateY(-0.5px);
}

.unit-btn:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

/* 货币切换按钮样式 - 与单位切换按钮一致 */
.currency-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    gap: 1px;
    position: relative;
    overflow: hidden;
    width: fit-content;
    height: 48px; /* 与其他控件统一高度 */
}

.currency-btn {
    border: none;
    background: transparent;
    padding: 0 16px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 0;
    text-align: center;
    height: 42px; /* 减去容器padding后的高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.currency-btn.active {
    background: var(--gold-gradient);
    color: white;
    box-shadow: 0 2px 6px rgba(212, 160, 23, 0.4), 
                0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(-0.5px);
}

.currency-btn:hover:not(.active) {
    color: var(--gold-dark);
    background: rgba(212, 160, 23, 0.1);
    transform: translateY(-0.5px);
}

.currency-btn:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

/* 重新设计数量输入框 - 现代化设计 */
.quantity-input {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-elevated);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    height: 48px;
}

.quantity-input:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.15);
}

.quantity-input:focus-within {
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.15), 0 0 0 4px rgba(212, 160, 23, 0.2);
    background-color: rgba(247, 233, 142, 0.03);
}

.quantity-input input {
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
    color: var(--text-primary);
    min-width: 0;
    height: 100%;
}

.quantity-input input:focus {
    outline: none;
}

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

.quantity-input span {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--gold-gradient);
    color: white;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: -2px 0 8px rgba(212, 160, 23, 0.1);
}

/* 24小时走势图样式 - 与历史价格趋势保持一致 */
.realtime-chart-section .section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.realtime-chart-section h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.realtime-chart-wrapper {
    position: relative;
    min-height: 320px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--surface-color);
    width: 100%;
}

.realtime-chart-wrapper canvas {
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    background: var(--surface-color) !important;
}

.realtime-chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

/* 美化时间范围切换按钮 */
.chart-section .range-toggle {
    display: inline-flex;
    gap: 3px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 4px;
    border-radius: 16px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.range-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    white-space: nowrap;
    min-width: 44px;
    text-align: center;
}

.range-btn.active {
    background: var(--gold-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.4), 
                0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.range-btn:hover:not(.active) {
    color: var(--gold-dark);
    background: rgba(212, 160, 23, 0.1);
    transform: translateY(-1px);
}

.range-btn:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

.chart-wrapper {
    position: relative;
    min-height: 320px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--surface-color);
    width: 100%;
}

/* 图表容器增强 */
.chart-wrapper canvas {
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    background: var(--surface-color) !important;
}

.chart-wrapper:hover canvas {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(212, 160, 23, 0.15);
}

.realtime-chart-wrapper:hover canvas {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(212, 160, 23, 0.15);
}

.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    color: var(--text-secondary);
    font-size: 1rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.insight-card {
    background: var(--background-elevated);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.insight-card h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.insight-card p {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gold-primary);
}

.insight-note {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.insight-disclaimer {
    margin-top: var(--spacing-lg);
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

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

@media (max-width: 768px) {
    .card {
        padding: var(--spacing-md) 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 var(--spacing-md);
    }

    .price-display {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 var(--spacing-md);
    }

    .controls-grid {
        grid-template-columns: 1fr;
        padding: 0 var(--spacing-md);
    }

    .chart-wrapper {
        min-height: 260px;
    }

    .realtime-chart-wrapper {
        min-height: 260px;
    }

    .insights-grid {
        padding: 0 var(--spacing-md);
    }

    .insight-disclaimer {
        padding: 0 var(--spacing-md);
    }

    .gold-shop-section h2 {
        padding: 0 var(--spacing-md);
    }

    .gold-shop-table-wrapper {
        overflow-x: auto;
        border: none;
        border-radius: 0;
    }

    .gold-shop-table th,
    .gold-shop-table td {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* 金店价格表格样式 */
.gold-shop-section {
    /*margin-top: var(--spacing-xl);*/
}

.gold-shop-section h2 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.gold-shop-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.gold-shop-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.gold-shop-table thead {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
    color: white;
}

.gold-shop-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--gold-primary);
}

.gold-shop-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.gold-shop-table tbody tr:hover {
    background-color: var(--background-elevated);
}

.gold-shop-table tbody tr:last-child {
    border-bottom: none;
}

.gold-shop-table td {
    padding: 12px 16px;
    color: var(--text-primary);
    vertical-align: middle;
}

.gold-shop-table .brand-cell {
    font-weight: 600;
    color: var(--gold-primary);
}

.gold-shop-table .price-cell {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.gold-shop-table .category-cell {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.gold-shop-table .date-cell {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.loading-row {
    text-align: center;
    padding: var(--spacing-xl) !important;
}

.loading-row .loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: var(--spacing-sm);
}

.loading-row span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .gold-shop-table-wrapper {
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .gold-shop-table tbody tr:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
}
