/* 乐器商店页面样式 */

.instrument-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* 页面头部 - 新增返回按钮样式 */
.page-header {
    margin-bottom: 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-bottom: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.back-link:hover {
    background: rgba(91, 163, 197, 0.1);
    transform: translateX(-2px);
}

.back-arrow {
    font-size: 16px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.back-link:hover .back-arrow {
    transform: translateX(-3px);
}

.page-title {
    color: var(--text-color);
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-icon {
    font-size: 28px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* 顶部代币栏 - 与music页面样式一致 */
.token-section {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-bottom: 20px;
}

.token-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.token-label {
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
}

.token-value {
    color: var(--white);
    font-size: 24px;
    font-weight: bold;
    margin-right: auto;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.exchange-btn {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(244, 196, 103, 0.3);
}

.exchange-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(244, 196, 103, 0.4);
}

/* 乐器列表 - 改为网格布局 */
.instruments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 0 auto;
}

/* 乐器卡片 - 重新设计 */
.instrument-item {
    background: var(--card-background);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.instrument-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px var(--shadow-hover);
}

.instrument-item.owned {
    background: linear-gradient(135deg, rgba(52, 193, 26, 0.05), rgba(52, 193, 26, 0.02));
    border: 1px solid #34c11a;
}

/* 乐器图片区域 */
.instrument-image-wrapper {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 12px 12px 8px 8px;
    border: 3px solid rgba(255, 223, 143, 0.6);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instrument-image {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.instrument-item:hover .instrument-image {
    transform: scale(1.05);
}

/* 音频播放按钮 */
.audio-play-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.audio-play-btn:hover {
    background: white;
    transform: scale(1.1);
}

.audio-play-btn.playing {
    background: var(--secondary-color);
    animation: pulse 0.6s infinite;
}

.audio-play-btn svg {
    width: 20px;
    height: 20px;
    fill: #333;
}

.audio-play-btn.playing svg {
    fill: white;
}

/* 播放动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 196, 103, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 196, 103, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 196, 103, 0);
    }
}

/* 乐器信息区域 */
.instrument-info-wrapper {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instrument-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
}

.instrument-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}

.price-icon {
    font-size: 16px;
}

.price-amount {
    font-weight: 600;
}

.price-type-token {
    color: var(--primary-color);
}

.price-type-hearts {
    color: #ef4444;
}

.price-type-free {
    color: #34c11a;
}

.instrument-action {
    margin-top: auto;
}

.purchase-btn {
    width: 100%;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.purchase-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(244, 196, 103, 0.3);
}

.purchase-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.owned-btn {
    width: 100%;
    padding: 10px 20px;
    background: #34c11a;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-background);
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card-background);
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
}

.close {
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

/* 兑换选项样式 */
.exchange-options {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.exchange-option {
    position: relative;
}

.exchange-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.exchange-option label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--background-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.exchange-option input[type="radio"]:checked + label {
    background: linear-gradient(135deg, rgba(244, 196, 103, 0.1), rgba(244, 196, 103, 0.05));
    border-color: var(--secondary-color);
}

.exchange-option label:hover {
    border-color: var(--primary-color);
}

.option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-tokens {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.option-hearts {
    font-size: 12px;
    color: var(--text-secondary);
}

.option-tag {
    padding: 3px 8px;
    background: var(--secondary-color);
    color: white;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.exchange-submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(244, 196, 103, 0.3);
}

.exchange-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 196, 103, 0.4);
}

.exchange-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.current-hearts {
    text-align: center;
    padding: 10px;
    background: var(--background-secondary);
    border-radius: 6px;
    margin-bottom: 15px;
}

.current-hearts span {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

/* 其他样式 */
.no-hearts, .login-prompt {
    text-align: center;
    padding: 20px;
}

.no-hearts p, .login-prompt p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 14px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    .instrument-item {
        background: var(--card-background);
    }
    
    .instrument-item.owned {
        background: linear-gradient(135deg, rgba(52, 193, 26, 0.08), rgba(52, 193, 26, 0.03));
    }
    
    .exchange-option label {
        background: var(--background-secondary);
    }
    
    .exchange-option input[type="radio"]:checked + label {
        background: linear-gradient(135deg, rgba(244, 196, 103, 0.15), rgba(244, 196, 103, 0.08));
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-title {
        font-size: 20px;
    }
    
    .title-icon {
        font-size: 24px;
    }
    
    .token-display {
        gap: 10px;
    }
    
    .token-value {
        font-size: 20px;
    }
    
    .instruments-list {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .instrument-image-wrapper {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 18px;
    }
    
    .instruments-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* 修复代币显示错位问题 */
    .token-display {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
    }
    
    .token-label {
        order: 1;
        flex: 0 0 auto;
        font-size: 12px;
    }
    
    .token-value {
        order: 2;
        flex: 0 0 auto;
        font-size: 18px;
        margin-right: 0;
    }
    
    .exchange-btn {
        order: 3;
        flex: 0 0 100%;
        font-size: 12px;
        padding: 5px 12px;
        text-align: center;
    }
    
    .instrument-image-wrapper {
        height: 160px;
    }
    
    .instrument-name {
        font-size: 16px;
    }
}