body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0; /* Remove body padding as container will handle it */
}

.container {
    max-width: 900px; /* Match main container width */
    margin: 0 auto;
    padding: 2rem;
    padding-top: 100px; /* Adjust for fixed navbar height */
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px rgba(0,0,0,0.05); /* Match card shadow */
    margin-bottom: 2rem; /* Add margin bottom for consistency */
}

/* Remove old header styles as they are replaced by navbar */
/* header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 20px;
} */

h1 {
    color: var(--secondary-color);
    font-size: 1.5rem; /* Match other h1 */
    margin-bottom: 1.5rem; /* Add margin bottom */
}

/* Remove old back-link style */
/* .back-link {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
} */

#history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem; /* Add some top margin */
}

#history-table th, #history-table td {
    border: 1px solid var(--border-color);
    padding: 12px; /* Increase padding for better readability */
    text-align: left;
}

#history-table th {
    background-color: var(--navbar-bg); /* Use navbar background for table header */
    color: var(--secondary-color); /* Darker text for header */
    font-weight: 600; /* Make header text bolder */
}

#history-table tr:nth-child(even) {
    background-color: #f9f9f9; /* Subtle stripe for readability */
}

#history-table tr:hover {
    background-color: #f0f0f0; /* Hover effect */
}

.action-btn {
    cursor: pointer;
    padding: 8px 15px; /* Adjust padding */
    border: none;
    border-radius: 8px; /* Match global border-radius */
    color: var(--white);
    margin-right: 8px; /* Adjust margin */
    transition: var(--transition);
    font-size: 0.9rem; /* Adjust font size */
}

.download-btn {
    background-color: var(--primary-color);
}

.download-btn:hover {
    background-color: #1764CC; /* Darker primary on hover */
}

.delete-btn {
    background-color: var(--error-color);
}

.delete-btn:hover {
    background-color: #D93025; /* Darker error on hover */
}

/* 新增的标题样式 */
.section-title {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* 文档表格样式 */
#optimized-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

#optimized-table th, #optimized-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

#optimized-table th {
    background-color: var(--navbar-bg);
    color: var(--secondary-color);
    font-weight: 600;
}

#optimized-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

#optimized-table tr:hover {
    background-color: #f0f0f0;
}

/* 没有记录时的样式 */
.no-records {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* 标签页样式 */
.tabs-container {
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #8A2BE2;
    background: #f8f9ff;
}

.tab-btn.active {
    color: #8A2BE2;
    border-bottom-color: #8A2BE2;
    background: #f8f9ff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 文档列表样式 - 紧凑一行布局 */
.documents-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-item-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.document-item-inline:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #ccc;
}

.document-item-inline.processing {
    border-left: 4px solid #ff9500;
    background: #fff8f0;
}

.doc-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 500;
    color: #333;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.doc-type {
    color: #666;
    font-size: 13px;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.doc-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.doc-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.status-completed {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-processing {
    background: #fff3e0;
    color: #f57c00;
}

.doc-date {
    color: #666;
    font-size: 13px;
    min-width: 80px;
}

.doc-actions {
    display: flex;
    gap: 8px;
}

.doc-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #1976d2;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.doc-action-btn:hover {
    background: #1565c0;
}

.doc-action-disabled {
    padding: 6px 12px;
    border-radius: 4px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
}

/* 临时用户访问样式 */
.guest-access-section {
    max-width: 800px;
    margin: 0 auto;
}

.access-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.method {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.method-header h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 18px;
}

.method-header p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.access-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}

.access-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.access-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.access-btn.primary {
    background: #1976d2;
    color: white;
}

.access-btn.primary:hover {
    background: #1565c0;
}

.access-btn.secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.access-btn.secondary:hover {
    background: #e0e0e0;
}

.verify-section {
    margin-top: 16px;
}

.register-prompt {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
    border: 1px solid #d0e4ff;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.register-prompt h3 {
    margin: 0 0 12px 0;
    color: #1976d2;
}

.register-prompt ul {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.register-prompt li {
    margin: 8px 0;
    color: #333;
    font-size: 14px;
}

.register-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.register-btn, .login-btn {
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.register-btn {
    background: #1976d2;
    color: white;
}

.register-btn:hover {
    background: #1565c0;
}

.login-btn {
    background: white;
    color: #1976d2;
    border: 1px solid #1976d2;
}

.login-btn:hover {
    background: #f0f7ff;
}

/* 临时文档显示样式 */
.temp-header {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
}

.temp-header h3 {
    margin: 0 0 8px 0;
    color: #f57c00;
}

.temp-notice {
    margin: 0;
    color: #ef6c00;
    font-size: 14px;
}

.temp-footer {
    text-align: center;
    margin-top: 24px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
}

.temp-warning {
    margin: 0 0 12px 0;
    color: #f57c00;
    font-size: 13px;
}

/* 响应式处理 */
@media (max-width: 768px) {
    .document-item-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        white-space: normal;
    }

    .doc-main {
        width: 100%;
    }

    .doc-name {
        max-width: none;
    }

    .doc-meta {
        width: 100%;
        justify-content: space-between;
    }

    .access-methods {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .register-actions {
        flex-direction: column;
    }
}

/* 订单卡片样式（保留兼容性） */
.orders-container {
    display: grid;
    gap: 20px;
}

.order-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.order-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.order-info h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
}

.order-meta {
    font-size: 14px;
    color: #666;
    margin: 2px 0;
}

.order-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-processing {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-paid {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-pending {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.order-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.order-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #8A2BE2;
    color: white;
}

.btn-primary:hover {
    background: #7B1FA2;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* 加载和空状态样式 */
.loading-state, .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8A2BE2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #333;
}

.empty-state a {
    color: #8A2BE2;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        padding-top: 80px;
    }

    #history-table, #optimized-table {
        font-size: 0.9rem;
    }

    #history-table th, #history-table td,
    #optimized-table th, #optimized-table td {
        padding: 0.5rem;
    }

    .action-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 120px;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .order-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .order-actions {
        justify-content: center;
    }
}
