/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础变量定义 */
:root {
    --primary-color: #165DFF;
    --primary-dark: #0E42D2;
    --primary-light: #4080FF;
    --secondary-color: #36CFC9;
    --success-color: #52C41A;
    --warning-color: #FAAD14;
    --error-color: #F5222D;
    --text-primary: #1F2329;
    --text-secondary: #4E5969;
    --text-placeholder: #86909C;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F2F3F5;
    --bg-tertiary: #F7F8FA;
    --border-color: #D9D9D9;
    --border-light: #E8E8E8;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.12);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 基础字体样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器样式 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
}

.header p {
    font-size: 16px;
    opacity: 0.9;
}

/* 主内容区域 */
.main {
    min-height: calc(100vh - 200px);
}

/* 卡片样式 */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 32px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-medium);
}

/* 表单样式 */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: var(--bg-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
    background-color: #f8f9fa;
}

.form-group input::placeholder {
    color: var(--text-placeholder);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-placeholder);
}

/* 输入框错误状态 */
.form-group input:invalid,
.form-group input.input-error {
    border-color: var(--error-color) !important;
    background-color: #fff5f5;
}

/* 输入框错误状态下的焦点 */
.form-group input:invalid:focus,
.form-group input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(245, 34, 45, 0.1);
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 160px;
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

/* 历史记录链接 */
.history-link {
    margin-top: 24px;
    text-align: center;
}

.history-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.history-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 全屏加载状态 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-content {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    transform: translateY(-20px);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { 
        transform: translateY(-30px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* 大型加载动画 */
.spinner-large {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* 结果页面样式 */
.result-container {
    margin-top: 24px;
}

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

.result-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-section {
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
}

.result-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

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

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

.result-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
}

.result-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.status-success {
    background-color: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.status-warning {
    background-color: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.status-error {
    background-color: rgba(245, 34, 45, 0.1);
    color: var(--error-color);
}

/* 历史记录页面样式 */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.history-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.history-table th,
.history-table td {
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.history-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover {
    background-color: var(--bg-tertiary);
}

.history-table a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.history-table a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 32px;
    gap: 8px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.pagination .active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 返回首页链接 */
.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 24px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.back-link::before {
    content: '←';
    margin-right: 8px;
    font-size: 16px;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    max-width: 400px;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards, fadeOut 0.3s 3.7s forwards;
}

.message-success {
    border-left: 4px solid var(--success-color);
}

.message-error {
    border-left: 4px solid var(--error-color);
}

@keyframes slideIn {
    to { transform: translateX(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* 证书链样式 */
.certificate-chain {
    margin-top: 16px;
}

.certificate-item {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
}

.certificate-item h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.certificate-detail {
    margin-bottom: 8px;
    font-size: 13px;
}

.certificate-detail strong {
    color: var(--text-secondary);
    margin-right: 8px;
}

/* 底部样式 */
.footer {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 24px 0;
    text-align: center;
    margin-top: 60px;
    border-top: 1px solid var(--border-light);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 32px 0;
        margin-bottom: 32px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .header p {
        font-size: 14px;
    }
    
    .card {
        padding: 24px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .result-header,
    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .result-title,
    .history-title {
        font-size: 20px;
    }
    
    .result-section {
        padding: 16px;
    }
    
    .result-section h3 {
        font-size: 16px;
    }
    
    .result-table th,
    .result-table td,
    .history-table th,
    .history-table td {
        padding: 12px;
        font-size: 13px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .pagination button {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    /* 移动端通知调整 */
    .message {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 通知提示样式增强 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    background-color: var(--success-color);
    border-left: 4px solid #38a169;
}

.notification.error {
    background-color: var(--error-color);
    border-left: 4px solid #c53030;
}

.notification.info {
    background-color: var(--primary-color);
    border-left: 4px solid var(--primary-dark);
}

.notification.warning {
    background-color: var(--warning-color);
    border-left: 4px solid #d69e2e;
}

/* 卡片悬停效果增强 */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* 表格行悬停效果 */
.result-table tr:hover,
.history-table tr:hover {
    background-color: var(--bg-tertiary);
    transform: scale(1.01);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-group input {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .container {
        padding: 0 16px;
    }
}