/* 全局设计系统与变量 */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* 管理后台布局 */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 320px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

.quote-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.quote-list-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 8px;
    letter-spacing: 0.05em;
}

.quote-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quote-item {
    padding: 12px 16px;
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.quote-item:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.quote-item.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.quote-item.active .quote-item-title {
    color: #ffffff;
}

.quote-item.active .quote-item-meta {
    color: rgba(255, 255, 255, 0.7);
}

.quote-item-info {
    flex: 1;
    overflow: hidden;
    padding-right: 8px;
}

.quote-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.quote-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quote-item-actions {
    display: flex;
    gap: 4px;
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-muted);
    transition: var(--transition);
}

.quote-item.active .btn-icon-sm {
    color: #ffffff;
}

.quote-item.active .btn-icon-sm:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-sm:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--danger-color);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 4px;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

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

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
}

/* 卡片布局与表单 */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 动态明细表格设计 */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

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

.items-table th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    background-color: #f9fafb;
}

.items-table td {
    vertical-align: middle;
}

/* 印章上传与预览 */
.seal-container {
    background-color: #f9fafb;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    transition: var(--transition);
}

.seal-container:hover {
    border-color: var(--primary-color);
}

.seal-preview-box {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.seal-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

/* 美观的 Switch 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* 汇总预览区 */
.summary-box {
    background-color: var(--primary-light);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.summary-total {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}
