/* ========================================
   Works — 个人作品页（与主页风格一致）
   注：依赖 home.css 提供容器样式与 CSS 变量
   ======================================== */

/* 页面内容区 */
.works-page-content {
    padding: 32px 24px;
}

.works-page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.works-page-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.works-page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 300;
}

.works-page-subtitle strong {
    color: var(--text);
    font-weight: 500;
}

/* 工具栏 */
.works-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.filter-tabs {
    display: flex;
    gap: 4px;
}

.filter-tab {
    padding: 6px 14px;
    border: 1px solid transparent;
    background: none;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.filter-tab:hover {
    background: var(--bg-warm);
}

.filter-tab.active {
    background: var(--text);
    color: var(--bg-card);
    border-color: var(--text);
}

.works-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0 12px;
    width: 260px;
}

.works-search-box input {
    flex: 1;
    padding: 7px 0;
    border: none;
    font-size: 12px;
    background: transparent;
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.works-search-box input::placeholder {
    color: var(--text-muted);
}

.works-search-box button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
}

/* 作品列表 */
.works-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.work-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: border-color 0.2s;
    position: relative;
    cursor: pointer;
}

.work-card:hover {
    border-color: var(--accent);
}

.work-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.work-card-type {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.work-card-type.type-lyrics {
    background: var(--bg-warm);
    color: var(--text-secondary);
}

.work-card-type.type-instrumental {
    background: var(--accent-light);
    color: var(--accent);
    opacity: 0.8;
}

.work-card-actions-top {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.work-card:hover .work-card-actions-top {
    opacity: 1;
}

.btn-card {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-card:hover {
    background: var(--bg-warm);
}

.btn-del {
    color: var(--danger);
}

.btn-del:hover {
    background: #fff0f0;
    border-color: #fcc;
}

.work-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.work-card-method {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.work-card-date {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 300;
}

/* Loading & Empty */
.works-loading {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
    font-size: 13px;
    grid-column: 1 / -1;
}

.works-empty {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
}

.works-empty.hidden {
    display: none;
}

.empty-icon {
    font-size: 40px;
    color: var(--border);
    margin-bottom: 16px;
}

.works-empty h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.works-empty p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 300;
}

/* Pagination */
.works-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.page-btn:hover {
    background: var(--bg-warm);
}

.page-btn.active {
    background: var(--text);
    color: var(--bg-card);
    border-color: var(--text);
}

/* ========================================
   Modal — 作品详情弹窗
   ======================================== */
body.modal-open {
    overflow: hidden;
}

.work-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.work-modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
}

.modal-detail-box {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 880px;
    max-width: 96vw;
    height: 80vh;
    max-height: 640px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 10;
}

.modal-detail-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-type-tag {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 8px;
}

.modal-type-tag.type-lyrics {
    background: var(--bg-warm);
    color: var(--text-secondary);
}

.modal-type-tag.type-instrumental {
    background: var(--accent-light);
    color: var(--accent);
}

.modal-detail-header h2 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.modal-detail-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.modal-detail-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.modal-detail-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid var(--border-light);
}

.detail-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.detail-tab-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.detail-tab-btn:hover {
    color: var(--text-secondary);
}

.detail-tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--text);
    font-weight: 500;
}

.detail-tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.detail-tab-content.active {
    display: flex;
}

.detail-content-scroll {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.detail-lyrics-block {
    font-size: 13px;
    line-height: 2;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.detail-style-block {
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    background: var(--bg-warm);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0;
}

.detail-content-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-detail-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    background: var(--bg-warm);
}

.sidebar-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-section h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-params {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.param-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.param-key {
    color: var(--text-muted);
}

.param-val {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-actions {
    padding: 14px 20px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-copy-all,
.btn-share {
    width: 100%;
}

/* ========================================
   Share Modal — 分享卡片弹窗
   ======================================== */
.share-modal {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-modal.hidden {
    display: none;
}

.share-modal-box {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 480px;
    max-width: 96vw;
    max-height: 90vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.share-preview-wrap {
    padding: 28px 28px 20px;
    background: var(--bg-warm);
    display: flex;
    justify-content: center;
}

.share-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 340px;
    padding: 28px 24px;
    text-align: center;
}

.share-preview-line {
    width: 40px;
    height: 3px;
    background: var(--text);
    margin: 0 auto 16px;
    border-radius: 2px;
}

.share-preview-brand {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 500;
}

.share-preview-card h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.share-preview-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.share-preview-body {
    text-align: center;
    margin-bottom: 16px;
}

.share-preview-body pre {
    font-size: 12px;
    line-height: 2;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    max-height: 260px;
    overflow: auto;
    text-align: center;
}

.share-preview-divider {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}

.share-preview-divider span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
}

.share-preview-qr {
    width: 100px;
    height: 100px;
    margin: 0 auto 8px;
    background: var(--bg-warm);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-preview-qr img {
    max-width: 100%;
    max-height: 100%;
}

.share-preview-qr-text {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.share-modal-actions {
    padding: 16px 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-modal-tip {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .works-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .works-page-content {
        padding: 20px 14px;
    }
    .works-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .works-search-box {
        width: 100%;
    }
    .works-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .modal-detail-box {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    .modal-detail-body {
        flex-direction: column;
    }
    .modal-detail-main {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    .modal-detail-sidebar {
        width: 100%;
    }
    .share-modal-box {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    .share-preview-card {
        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .works-list {
        grid-template-columns: 1fr;
    }
}