/**
 * 合同电子签章工具 - 管理后台样式
 * 简约现代风格，主色 #0078D4
 */

/* ====== 基础重置 ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

a {
    color: #0078D4;
    text-decoration: none;
}

a:hover {
    color: #005a9e;
}

/* ====== 登录页面 ====== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #0078D4 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 28px;
    color: #0078D4;
    margin-bottom: 8px;
}

.login-header p {
    color: #999;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #0078D4;
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

/* ====== 布局 ====== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ====== 侧边栏 ====== */
.sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.65);
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    color: #fff;
    background: #0078D4;
}

.nav-icon {
    margin-right: 10px;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-info {
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 8px;
    font-size: 13px;
}

/* ====== 主内容区 ====== */
.content {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
}

.content-header {
    background: #fff;
    padding: 16px 24px;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.content-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.content-body {
    padding: 24px;
    flex: 1;
}

/* ====== 卡片 ====== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 24px;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #333;
}

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

/* ====== 统计卡片 ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 32px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.stat-label {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* ====== 表格 ====== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background: #fafafa;
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.data-table tr:hover {
    background: #f9f9ff;
}

.data-table .empty {
    text-align: center;
    color: #999;
    padding: 32px;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-table td:first-child {
    color: #666;
    width: 150px;
}

.info-table code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #d4380d;
}

.actions-cell {
    white-space: nowrap;
}

/* ====== 表单 ====== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
    font-size: 13px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #0078D4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

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

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

/* ====== 按钮 ====== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background: #0078D4;
    color: #fff;
}

.btn-primary:hover {
    background: #006abc;
    color: #fff;
}

.btn-default {
    background: #f0f0f0;
    color: #333;
}

.btn-default:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #d93636;
    color: #fff;
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #3f9e0f;
    color: #fff;
}

.btn-text {
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    padding: 4px 8px;
    font-size: 13px;
}

.btn-text:hover {
    color: #fff;
    opacity: 1;
}

.btn-block {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

/* ====== 徽章 ====== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.badge-danger {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.badge-warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}

.badge-default {
    background: #f5f5f5;
    color: #999;
    border: 1px solid #d9d9d9;
}

/* ====== 提示框 ====== */
.alert {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.alert-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

.alert-info {
    background: #e6f7ff;
    border: 1px solid #91d5ff;
    color: #0078D4;
}

/* ====== 程序开关 ====== */
.switch-container {
    text-align: center;
    padding: 40px 20px;
}

.switch-status {
    margin-bottom: 24px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-active {
    background: #52c41a;
    box-shadow: 0 0 8px rgba(82, 196, 26, 0.5);
}

.dot-inactive {
    background: #ff4d4f;
    box-shadow: 0 0 8px rgba(255, 77, 79, 0.5);
}

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

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
}

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

.modal-header h3 {
    margin-bottom: 0;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

/* ====== Toast 通知 ====== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-success {
    background: #52c41a;
}

.toast-error {
    background: #ff4d4f;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header h2 {
        font-size: 14px;
        text-align: center;
    }

    .nav-item span:not(.nav-icon) {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px 8px;
    }

    .nav-icon {
        margin-right: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .content {
        margin-left: 60px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}
