/* 盘歌商行 · AI造歌 - 样式表 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    padding-bottom: 70px;
}

/* 顶部导航 */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: white;
    box-shadow: var(--shadow-md);
}

.header-left, .header-right {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-left:active, .header-right:active {
    background: rgba(255,255,255,0.2);
}

.back-icon {
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.user-icon {
    font-size: 20px;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.header-left.hidden {
    visibility: hidden;
}

/* 主内容区 */
.app-main {
    min-height: calc(100vh - 50px - 70px);
    padding: 16px;
}

.page {
    animation: fadeIn 0.3s ease;
}

.page.hidden {
    display: none;
}

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

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 60px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    z-index: 99;
}

.bottom-nav.hidden {
    display: none;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    padding: 8px 0;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 11px;
}

/* 登录注册页 */
.auth-container {
    padding: 40px 20px;
}

.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: var(--shadow-lg);
}

.app-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

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

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 4px;
}

.auth-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.auth-tabs .tab.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.auth-form.hidden {
    display: none;
}

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

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: var(--bg-secondary);
    transition: all 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-tip {
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    margin-top: 16px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:active {
    background: rgba(99, 102, 241, 0.1);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    margin-right: 6px;
}

/* 用户卡片 */
.user-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-lg);
    padding: 20px;
    color: white;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 12px;
}

.user-detail {
    flex: 1;
}

.nickname {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.membership-badge {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(255,255,255,0.25);
    border-radius: 12px;
    font-size: 12px;
}

.usage-info {
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.usage-text {
    font-size: 14px;
}

.usage-text b {
    font-size: 20px;
    font-weight: 700;
    margin: 0 4px;
}

/* Section */
.section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.section-title .optional {
    font-weight: normal;
    font-size: 13px;
    color: var(--text-light);
}

/* 风格选择 */
.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.style-card {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.style-card:active {
    transform: scale(0.95);
}

.style-card.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.style-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.style-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.style-card.active .style-name {
    color: var(--primary-color);
}

/* 时长选择 */
.duration-options {
    display: flex;
    gap: 12px;
}

.duration-option {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.duration-option:active {
    transform: scale(0.95);
}

.duration-option.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.duration-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.duration-option.active .duration-value {
    color: var(--primary-color);
}

.duration-unit {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 描述输入 */
.desc-input {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-secondary);
    resize: none;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.desc-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

/* 生成按钮 */
.generate-btn {
    height: 54px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
}

.generate-tip {
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    margin-top: 12px;
}

/* 歌曲列表 */
.songs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.songs-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.songs-count {
    color: var(--text-secondary);
    font-size: 13px;
}

.songs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.song-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.song-item:active {
    background: var(--bg-secondary);
}

.song-cover {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.song-info {
    flex: 1;
    min-width: 0;
}

.song-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

.song-status {
    flex-shrink: 0;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
}

.status-pending {
    background: #fef3c7;
    color: #d97706;
}

.status-generating {
    background: #dbeafe;
    color: #2563eb;
}

.status-completed {
    background: #d1fae5;
    color: #059669;
}

.status-failed {
    background: #fee2e2;
    color: #dc2626;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 个人中心 */
.profile-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    color: white;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.profile-avatar {
    width: 70px;
    height: 70px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-membership {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(255,255,255,0.25);
    border-radius: 14px;
    font-size: 12px;
}

.profile-stats {
    display: flex;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

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

/* 菜单列表 */
.menu-list {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

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

.menu-item:active {
    background: var(--bg-secondary);
}

.menu-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-size: 15px;
}

.menu-arrow {
    color: var(--text-light);
    font-size: 20px;
}

.menu-item.logout .menu-text {
    color: var(--danger-color);
}

/* 会员页 */
.vip-banner {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    color: white;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.vip-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.vip-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.plan-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.plan-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.plan-card:active {
    transform: scale(0.98);
}

.plan-card.recommended {
    border-color: var(--accent-color);
}

.plan-card.recommended::before {
    content: '推荐';
    position: absolute;
    top: 0;
    right: 20px;
    background: var(--accent-color);
    color: white;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 0 0 8px 8px;
}

.plan-info {
    flex: 1;
}

.plan-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.plan-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.plan-price {
    text-align: right;
}

.price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

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

.activate-section {
    text-align: center;
    margin-bottom: 20px;
}

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

.activate-tip a {
    color: var(--primary-color);
    text-decoration: none;
}

.plan-detail {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.plan-detail h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.plan-detail ul {
    list-style: none;
}

.plan-detail li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* 订单列表 */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-item {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.order-no {
    font-size: 13px;
    color: var(--text-secondary);
}

.order-status {
    font-size: 13px;
    font-weight: 500;
}

.order-status.paid {
    color: var(--success-color);
}

.order-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-product {
    font-size: 15px;
    font-weight: 500;
}

.order-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.order-date {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

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

.modal-close {
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

/* 播放器弹窗 */
.player-modal .player-cover {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: var(--shadow-lg);
    animation: spin 10s linear infinite;
    animation-play-state: paused;
}

.player-modal .player-cover.playing {
    animation-play-state: running;
}

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

.player-info {
    text-align: center;
    margin-bottom: 20px;
}

.player-style {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.player-duration {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}

/* Loading */
.loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1500;
}

.loading-mask.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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