:root {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
    --color-primary: #2563eb;
    --color-secondary: #64748b;
    --color-danger: #dc2626;
    --color-success: #16a34a;
    --bg-light: #f8fafc;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg-light);
    color: #0f172a;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3 {
    margin-top: 0;
}

.top-bar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-bar__inner {
    width: 80%;
    min-width: 80%;
    max-width: 95%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    box-sizing: border-box;
}

.top-bar__left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.top-bar h1 {
    font-size: 20px;
    margin: 0;
}

.top-bar__right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--color-secondary);
}

.container {
    width: 80%;
    min-width: 80%;
    max-width: 95%;
    margin: 24px auto;
    padding: 0 24px;
}

.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.tab {
    padding: 10px 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--color-secondary);
}

.tab.active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

.panel {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--color-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: #fff;
}

input:focus,
textarea:focus {
    border-color: var(--color-primary);
    outline: none;
}

textarea[readonly] {
    background: #f1f5f9;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    color: #fff;
    background: var(--color-primary);
    text-decoration: none;
}

a.button {
    text-decoration: none;
    color: #fff;
}

.button.secondary {
    background: var(--color-secondary);
}

.button.danger {
    background: var(--color-danger);
}

.button.small {
    padding: 6px 10px;
    font-size: 13px;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button:hover {
    opacity: 0.9;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert.success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--color-success);
}

.alert.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-danger);
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

textarea {
    width: 100%;
    min-height: 140px;
}

.articles-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.bulk-actions {
    margin: 0;
}

.search-bar {
    display: flex;
    gap: 12px;
    margin: 0;
    flex: 1;
    min-width: 300px;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 14px;
}

th {
    background: #f8fafc;
    text-align: left;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.snippet {
    margin-top: 6px;
    color: var(--color-secondary);
    font-size: 13px;
}

.article-title-link {
    color: var(--color-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.article-title-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.actions {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    justify-content: center;
    min-height: 100%;
}

.actions-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.actions-row .button {
    white-space: nowrap;
}

.inline-form {
    display: inline-block;
    margin: 0;
    vertical-align: middle;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status.published {
    background: rgba(22, 163, 74, 0.1);
    color: var(--color-success);
}

.status.draft {
    background: rgba(100, 116, 139, 0.1);
    color: var(--color-secondary);
}

.pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-link {
    padding: 6px 12px;
    border-radius: 6px;
    min-width: 36px;
    text-align: center;
    display: inline-block;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--color-secondary);
    background: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-link:hover {
    background: var(--bg-light);
    border-color: var(--color-primary);
}

.page-link.current {
    background: var(--color-primary);
    color: #fff;
    cursor: default;
    border-color: var(--color-primary);
}

.page-link.current:hover {
    background: var(--color-primary);
    opacity: 1;
}

.page-ellipsis {
    padding: 6px 4px;
    color: var(--color-secondary);
}

.page-info {
    font-size: 13px;
    color: var(--color-secondary);
}

.empty-state {
    text-align: center;
    color: var(--color-secondary);
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #eff6ff, #fff);
}

.auth-card {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    width: 360px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.product-name {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
}

.auth-card button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
}

.button-link {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.button-link:hover {
    opacity: 0.8;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card button {
    width: 100%;
}

.auth-switch {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--color-secondary);
}

.auth-switch a {
    color: var(--color-primary);
}

.preview-page {
    background: #fff;
    padding: 24px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto 24px;
    max-width: 800px;
    width: 100%;
}

.preview-header .meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--color-secondary);
}

.article-preview {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.article-preview h1 {
    margin-bottom: 16px;
    font-size: 28px;
}

.article-content img {
    max-width: 100%;
    border-radius: 6px;
    display: block;
    margin: 12px 0;
}

/* 过期状态样式 */
.expires-info {
    font-size: 13px;
    color: var(--color-secondary);
    margin-left: 12px;
}

.expires-info.expired {
    color: var(--color-danger);
    font-weight: 600;
}

.expires-status {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.expires-status p {
    margin: 8px 0;
}

.status.active {
    background: rgba(22, 163, 74, 0.1);
    color: var(--color-success);
}

.status.expired {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-danger);
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 32px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
}

.modal-close {
    color: var(--color-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 24px;
}

.card-prices {
    margin-bottom: 24px;
}

.card-prices h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.card-prices ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-prices li {
    padding: 8px 0;
    font-size: 16px;
    border-bottom: 1px solid var(--border);
}

.card-prices li:last-child {
    border-bottom: none;
}

.customer-service {
    text-align: center;
}

.customer-service p {
    margin: 12px 0;
}

.qr-code {
    width: 200px;
    height: 200px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 16px auto;
    display: block;
}

.qr-hint {
    font-size: 14px;
    color: var(--color-secondary);
}

.activation-form {
    max-width: 600px;
}

.activation-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.activation-input-row label {
    flex: 1;
    margin: 0;
}

.activation-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.generated-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.card-code {
    padding: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: monospace;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: var(--color-primary);
}

.card-hint {
    font-size: 14px;
    color: var(--color-secondary);
    margin-top: 12px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .activation-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .activation-buttons {
        width: 100%;
    }

    .activation-buttons .button {
        flex: 1;
    }

    .articles-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        flex-direction: column;
        min-width: 100%;
    }

    .table-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .actions-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .preview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
}

/* 编辑表单样式 */
.edit-form {
    max-width: 1000px;
    margin: 0 auto;
}

.edit-form label {
    display: block;
    margin-bottom: 20px;
}

.edit-form label > span {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.edit-form input[type="text"] {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.edit-form textarea {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.edit-form .button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.copy-buttons {
    display: flex;
    gap: 10px;
    margin: 20px auto; /* 修改：上下20px，左右自动居中 */
    justify-content: center;
    max-width: 400px; /* 可选：限制最大宽度 */
}

.copy-buttons .button {
    font-size: 14px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.copy-buttons .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.copy-buttons .button i {
    font-style: normal;
    font-size: 16px;
}

/* 复制状态提示 */
.copy-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 9999;
    animation: fadeInOut 2s ease-in-out;
    display: none;
    font-weight: 500;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* 操作列样式优化 */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.actions .button.small {
    padding: 4px 8px;
    font-size: 12px;
}

/* 文章预览页面优化 */
.preview-page .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.preview-page .meta {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 14px;
}
