/**
 * 证书查询系统 - 前端样式
 * 响应式设计，适配移动端
 */

/* ==================== 基础重置 ==================== */
* {
    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;
    min-height: 100vh;
}

/* ==================== 容器 ==================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 头部 ==================== */
.header {
    text-align: center;
    padding: 80px 20px 40px;
    color: #333;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.header p {
    font-size: 1.1rem;
    color: #666;
}

/* ==================== 卡片样式 ==================== */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid #e8e8e8;
}

/* ==================== 查询表单 ==================== */
.search-section {
    text-align: center;
}

.search-section h2 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #2c3e50;
}

.input-group {
    display: flex;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    min-width: 200px;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input:focus {
    border-color: #409eff;
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

.input-group input::placeholder {
    color: #999;
}

.btn {
    padding: 15px 35px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #409eff;
    color: white;
}

.btn-primary:hover {
    background: #66b1ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(64, 158, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==================== 加载动画 ==================== */
.loading {
    display: none;
    margin-top: 30px;
}

.loading.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #409eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    margin-top: 15px;
    color: #666;
}

/* ==================== 结果区域 ==================== */
.results-section {
    margin-top: 30px;
    display: none;
}

.results-section.active {
    display: block;
}

.results-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.results-header h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.results-header .user-info {
    color: #409eff;
    font-weight: 600;
}

/* ==================== 证书列表 ==================== */
.cert-list {
    list-style: none;
}

.cert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #409eff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cert-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cert-info h4 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 5px;
}

.cert-info .cert-meta {
    font-size: 0.9rem;
    color: #888;
}

.cert-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-view {
    background: #667eea;
    color: white;
    padding: 10px 20px;
    font-size: 0.95rem;
}

.btn-view:hover {
    background: #5a6fd6;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-download {
    background: #28a745;
    color: white;
    padding: 10px 20px;
    font-size: 0.95rem;
}

.btn-download:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* ==================== 空结果提示 ==================== */
.empty-result {
    text-align: center;
    padding: 50px 20px;
    color: #666;
}

.empty-result .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-result h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

/* ==================== 提示消息 ==================== */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ==================== 页脚 ==================== */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.footer a {
    color: white;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer .contact-info {
    margin-top: 10px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer .contact-info span {
    margin: 0 10px;
}

/* ==================== 左上角Logo ==================== */
.site-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.site-logo img {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* ==================== 右上角返回首页 ==================== */
.top-nav {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #409eff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.back-home:hover {
    background: #ecf5ff;
    color: #66b1ff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.back-home span {
    font-size: 1.1rem;
}

/* ==================== 页脚版权居中 ==================== */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-size: 0.9rem;
}

.footer p {
    margin-bottom: 5px;
}

/* ==================== 管理后台入口 ==================== */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #409eff;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.admin-link:hover {
    background: #66b1ff;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 30px 15px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .card {
        padding: 25px 20px;
        border-radius: 12px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input,
    .input-group .btn {
        width: 100%;
    }
    
    .cert-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .cert-info {
        width: 100%;
    }
    
    .cert-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-view,
    .btn-download {
        width: 100%;
        justify-content: center;
    }
    
    .admin-link {
        position: relative;
        bottom: auto;
        right: auto;
        display: block;
        text-align: center;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .search-section h2 {
        font-size: 1.2rem;
    }
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

.cert-item {
    animation: fadeIn 0.3s ease-out;
}
