/* 乐器商店页面样式 */

.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: 6px 10px;
    border-radius: 6px;
}

.back-link:hover {
    background: rgba(91, 163, 197, 0.1);
    transform: translateX(-2px);
}

.back-link:active {
    transform: translateX(-4px);
}

.back-icon {
    width: 18px;
    height: 18px;
    color: currentColor;
    transition: transform 0.3s ease;
}

.back-link:hover .back-icon {
    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: 10px;
}

.title-icon {
    width: 28px;
    height: 28px;
    color: var(--primary-color);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* ==================== 代币显示区域 ==================== */
.token-section {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-bottom: 24px;
}

.token-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.token-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-icon {
    width: 24px;
    height: 24px;
    color: #f4c467;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.token-label {
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
}

.token-value {
    color: var(--white);
    font-size: 26px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.exchange-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(244, 196, 103, 0.35);
}

.exchange-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 196, 103, 0.45);
}

.exchange-btn:active {
    transform: translateY(0);
}

.exchange-icon {
    width: 16px;
    height: 16px;
}

/* ==================== 乐器列表 ==================== */
.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: 14px;
    padding: 0;
    box-shadow: 0 2px 12px var(--shadow-color);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
}

.instrument-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-hover);
}

.instrument-item.owned {
    background: linear-gradient(135deg, rgba(52, 193, 26, 0.06), rgba(52, 193, 26, 0.02));
    border-color: rgba(52, 193, 26, 0.4);
}

/* 乐器图片区域 */
.instrument-image-wrapper {
    width: 100%;
    height: 200px;
    background: linear-gradient(145deg, #1a1a2e, #0f0f1a);
    border-radius: 14px 14px 10px 10px;
    border: 3px solid rgba(255, 223, 143, 0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instrument-image {
    width: 88%;
    height: 88%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.instrument-item:hover .instrument-image {
    transform: scale(1.06);
}

/* 音频播放按钮 */
.audio-play-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    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 3px 10px rgba(0, 0, 0, 0.25);
}

.audio-play-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.audio-play-btn:active {
    transform: scale(1.05);
}

.audio-play-btn.playing {
    background: var(--secondary-color);
    animation: pulse 0.8s infinite;
}

.audio-play-btn svg {
    width: 22px;
    height: 22px;
    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 12px rgba(244, 196, 103, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 196, 103, 0);
    }
}

/* 乐器信息区域 */
.instrument-info-wrapper {
    padding: 16px 18px 18px;
    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: 6px;
    font-size: 15px;
    color: var(--text-secondary);
}

/* 价格图标样式 */
.price-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.price-icon-token {
    color: #f4c467;
}

.price-icon-heart {
    color: #ef4444;
}

.price-amount {
    font-weight: 600;
    font-size: 16px;
}

.price-type-token .price-amount {
    color: var(--primary-color);
}

.price-type-hearts .price-amount {
    color: #ef4444;
}

.price-type-free {
    color: #34c11a;
    font-weight: 600;
}

.instrument-action {
    margin-top: auto;
}

/* 购买按钮 */
.purchase-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(244, 196, 103, 0.25);
}

.purchase-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 196, 103, 0.4);
}

.purchase-btn:active:not(:disabled) {
    transform: translateY(0);
}

.purchase-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* 已拥有按钮 */
.owned-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #34c11a, #45d62b);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.owned-icon {
    width: 18px;
    height: 18px;
}

/* ==================== 模态框样式 ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    animation: fadeIn 0.25s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--card-background);
    padding: 0;
    border-radius: 16px;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card-background);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title-icon {
    width: 24px;
    height: 24px;
    color: #f4c467;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--background-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

/* 当前爱心显示 */
.current-hearts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--background-secondary);
    border-radius: 10px;
    margin-bottom: 20px;
}

.hearts-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.hearts-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.hearts-icon {
    width: 20px;
    height: 20px;
    color: #ef4444;
}

/* ==================== 兑换选项样式 ==================== */
.exchange-options {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.exchange-option {
    position: relative;
}

.exchange-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.exchange-option label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--background-secondary);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.exchange-option label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.exchange-option input[type="radio"]:checked + label {
    background: linear-gradient(135deg, rgba(244, 196, 103, 0.12), rgba(244, 196, 103, 0.06));
    border-color: var(--secondary-color);
}

.exchange-option label:hover:not(.disabled) {
    border-color: var(--primary-color);
}

.option-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.option-tokens {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.option-token-icon {
    width: 20px;
    height: 20px;
    color: #f4c467;
}

.option-hearts {
    font-size: 13px;
    color: var(--text-secondary);
}

.option-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tag-icon {
    width: 12px;
    height: 12px;
}

/* 兑换提交按钮 */
.exchange-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(244, 196, 103, 0.35);
}

.exchange-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(244, 196, 103, 0.45);
}

.exchange-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.exchange-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==================== 无爱心/未登录提示 ==================== */
.no-hearts, .login-prompt {
    text-align: center;
    padding: 30px 20px;
}

.no-hearts-icon, .login-icon {
    margin-bottom: 16px;
}

.no-hearts-icon svg {
    color: var(--border-color);
}

.login-icon svg {
    color: var(--primary-color);
}

.no-hearts p, .login-prompt p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.5;
}

.zero-hearts {
    color: #ef4444;
    font-weight: bold;
    font-size: 18px;
}

.hint-text {
    font-size: 13px !important;
    opacity: 0.8;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 2px 8px rgba(91, 163, 197, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 163, 197, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    box-shadow: 0 2px 8px rgba(244, 196, 103, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 196, 103, 0.4);
}

/* ==================== 动画 ==================== */
@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.1), rgba(52, 193, 26, 0.04));
    }
    
    .instrument-image-wrapper {
        background: linear-gradient(145deg, #1a1a2e, #12121c);
    }
    
    .exchange-option label {
        background: var(--background-secondary);
    }
    
    .exchange-option input[type="radio"]:checked + label {
        background: linear-gradient(135deg, rgba(244, 196, 103, 0.18), rgba(244, 196, 103, 0.1));
    }
    
    .audio-play-btn {
        background: rgba(255, 255, 255, 0.92);
    }
}

/* ==================== 响应式设计 ==================== */

/* 平板设备 */
@media (max-width: 768px) {
    .instrument-container {
        padding: 12px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .title-icon {
        width: 24px;
        height: 24px;
    }
    
    .token-section {
        padding: 12px 14px;
        border-radius: 10px;
    }
    
    .token-icon {
        width: 22px;
        height: 22px;
    }
    
    .token-value {
        font-size: 22px;
    }
    
    .instruments-list {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .instrument-image-wrapper {
        height: 180px;
    }
}

/* 移动设备 */
@media (max-width: 480px) {
    .instrument-container {
        padding: 10px;
    }
    
    .page-header {
        margin-bottom: 16px;
    }
    
    .back-link {
        font-size: 13px;
        padding: 5px 8px;
        margin-bottom: 10px;
    }
    
    .back-icon {
        width: 16px;
        height: 16px;
    }
    
    .page-title {
        font-size: 18px;
        gap: 8px;
    }
    
    .title-icon {
        width: 22px;
        height: 22px;
    }
    
    .page-subtitle {
        font-size: 13px;
    }
    
    /* 代币区域优化 */
    .token-section {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .token-display {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .token-info {
        flex: 1;
        min-width: 0;
    }
    
    .token-icon {
        width: 20px;
        height: 20px;
    }
    
    .token-label {
        font-size: 13px;
    }
    
    .token-value {
        font-size: 20px;
    }
    
    .exchange-btn {
        flex: 0 0 100%;
        justify-content: center;
        padding: 10px 16px;
        margin-top: 4px;
    }
    
    /* 乐器列表优化 */
    .instruments-list {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .instrument-item {
        border-radius: 12px;
    }
    
    .instrument-image-wrapper {
        height: 180px;
        border-radius: 12px 12px 8px 8px;
    }
    
    .instrument-info-wrapper {
        padding: 14px 16px 16px;
        gap: 10px;
    }
    
    .instrument-name {
        font-size: 16px;
    }
    
    .instrument-price {
        font-size: 14px;
    }
    
    .price-icon {
        width: 16px;
        height: 16px;
    }
    
    .price-amount {
        font-size: 15px;
    }
    
    .purchase-btn, .owned-btn {
        padding: 11px 18px;
        font-size: 14px;
    }
    
    .audio-play-btn {
        width: 40px;
        height: 40px;
        bottom: 10px;
        right: 10px;
    }
    
    .audio-play-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* 模态框优化 */
    .modal.show {
        padding: 16px;
        align-items: flex-end;
    }
    
    .modal-content {
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        animation: slideUpMobile 0.3s ease;
    }
    
    .modal-header {
        padding: 16px;
        border-radius: 20px 20px 0 0;
    }
    
    .modal-title-icon {
        width: 22px;
        height: 22px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .current-hearts {
        padding: 12px;
    }
    
    .hearts-value {
        font-size: 18px;
    }
    
    .exchange-option label {
        padding: 14px;
        gap: 12px;
    }
    
    .option-tokens {
        font-size: 15px;
    }
    
    .option-token-icon {
        width: 18px;
        height: 18px;
    }
    
    .option-hearts {
        font-size: 12px;
    }
    
    .option-tag {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .exchange-submit-btn {
        padding: 13px;
        font-size: 15px;
    }
    
    .no-hearts, .login-prompt {
        padding: 24px 16px;
    }
    
    .no-hearts-icon svg, .login-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .btn {
        padding: 11px 20px;
        font-size: 14px;
    }
}

/* 移动端模态框动画 */
@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 超小屏幕 */
@media (max-width: 360px) {
    .instrument-container {
        padding: 8px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .token-info {
        gap: 6px;
    }
    
    .token-label {
        font-size: 12px;
    }
    
    .token-value {
        font-size: 18px;
    }
    
    .instrument-image-wrapper {
        height: 160px;
    }
    
    .instrument-name {
        font-size: 15px;
    }
    
    .exchange-option label {
        padding: 12px;
        gap: 10px;
    }
    
    .option-tokens {
        font-size: 14px;
        gap: 6px;
    }
    
    .option-token-icon {
        width: 16px;
        height: 16px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .back-link:active {
        background: rgba(91, 163, 197, 0.15);
    }
    
    .exchange-btn:active {
        transform: scale(0.98);
    }
    
    .purchase-btn:active:not(:disabled),
    .exchange-submit-btn:active:not(:disabled),
    .btn:active {
        transform: scale(0.98);
    }
    
    .audio-play-btn:active {
        transform: scale(0.95);
    }
    
    .exchange-option label:active:not(.disabled) {
        background: rgba(91, 163, 197, 0.1);
    }
}