/**
 * 证书查询系统 - 后台管理样式
 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

/* ==================== 登录页面 ==================== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-footer p {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
}

/* ==================== 管理后台布局 ==================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.sidebar-header p {
    opacity: 0.7;
    font-size: 0.9rem;
}

.sidebar-nav ul {
    list-style: none;
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav .icon {
    margin-right: 12px;
    font-size: 1.2rem;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.top-bar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-info {
    font-weight: 500;
}

.top-actions {
    display: flex;
    gap: 20px;
}

.top-actions a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.top-actions a:hover {
    color: #667eea;
}

.top-actions .logout {
    color: #e74c3c;
}

.content-wrapper {
    padding: 30px;
}

/* ==================== 通用组件 ==================== */
.page-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #333;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-block {
    width: 100%;
}

.btn-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-link.text-danger {
    color: #e74c3c;
}

/* 表单 */
.form-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-card h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.help-text {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
}

/* 提示框 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 信息卡片 */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #333;
}

.info-card p {
    color: #666;
    margin-bottom: 10px;
}

.info-card ul {
    margin-left: 20px;
    color: #666;
}

.info-card li {
    margin-bottom: 5px;
}

.info-box {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 0 6px 6px 0;
}

.info-box ul {
    margin-left: 20px;
    margin-top: 10px;
}

.info-box code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

/* 数据表格 */
.table-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: #555;
    background: #f8f9fa;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table .actions {
    display: flex;
    gap: 15px;
}

.text-center {
    text-align: center;
}

/* 分页 */
.pagination {
    margin-top: 25px;
}

.pagination ul {
    display: flex;
    list-style: none;
    gap: 5px;
    justify-content: center;
}

.pagination a,
.pagination span {
    display: block;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    color: #667eea;
    background: white;
    border: 1px solid #e0e0e0;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .active span {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .disabled span {
    color: #999;
    cursor: not-allowed;
}

/* 搜索栏 */
.search-bar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-form input,
.search-form select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.search-form input {
    flex: 1;
    min-width: 200px;
}

/* ==================== 控制台 ==================== */
.dashboard {
    max-width: 1400px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #888;
    font-size: 0.9rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dashboard-card h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #333;
}

.empty-text {
    color: #888;
    text-align: center;
    padding: 30px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.quick-actions .btn {
    padding: 12px 20px;
}

.quick-actions .icon {
    margin-right: 8px;
}

/* ==================== 系统设置页面 ==================== */
.settings-page .logo-preview {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.settings-page .logo-preview p {
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.settings-page .logo-preview img {
    max-height: 60px;
    border-radius: 4px;
}

.danger-zone {
    border: 2px solid #f5c6cb;
    background: #fff5f5;
}

.danger-zone h3 {
    color: #dc3545;
}

.danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

.danger-info h4 {
    font-size: 1.1rem;
    color: #dc3545;
    margin-bottom: 8px;
}

.danger-info p {
    color: #666;
    margin-bottom: 5px;
}

.danger-info .warning {
    color: #dc3545;
    font-weight: 600;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

/* ==================== 添加证书页面 ==================== */
.add-cert-page .form-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.add-cert-page .form-section:last-of-type {
    border-bottom: none;
}

.add-cert-page .form-section h3 {
    font-size: 1rem;
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    display: inline-block;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: auto;
    margin-right: 8px;
}

.file-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
}

.file-preview p {
    margin: 0;
    color: #666;
}

#fileName {
    font-weight: 600;
    color: #333;
}

/* ==================== 导入页面 ==================== */
.import-page .note {
    margin-top: 15px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 6px;
    color: #856404;
    font-size: 0.9rem;
}

.result-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-top: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.result-summary {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.result-summary .success {
    color: #28a745;
    font-weight: 500;
}

.result-summary .error {
    color: #dc3545;
    font-weight: 500;
}

.error-list {
    max-height: 300px;
    overflow-y: auto;
}

.error-list h4 {
    margin-bottom: 10px;
    color: #333;
}

.error-list ul {
    list-style: none;
}

.error-list li {
    padding: 8px 0;
    color: #dc3545;
    border-bottom: 1px solid #f0f0f0;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .admin-wrapper {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form input,
    .search-form select {
        width: 100%;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .content-wrapper {
        padding: 20px 15px;
    }
}
