/**
 * SkyCert - 自定义样式
 */

/* ============ 全局 ============ */
:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --accent: #198754;
    --bg-light: #f8f9fa;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-light);
}

main {
    flex: 1;
}

/* ============ 导航栏 ============ */
.bg-primary-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 50%, #084298 100%) !important;
}

.navbar-brand {
    font-size: 1.1rem;
}

/* ============ 英雄横幅 ============ */
.hero-banner {
    background: linear-gradient(135deg, #0d6efd 0%, #198754 100%);
    padding: 2rem 0;
}

.hero-banner h1 {
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ============ 查询卡片 ============ */
.search-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    overflow: hidden;
}

.search-card .card-body {
    padding: 2rem;
}

/* ============ 结果卡片 ============ */
.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.results-bar h5 {
    margin: 0;
    font-size: 1rem;
    color: #495057;
}

.results-bar h5 strong {
    font-size: 1.35rem;
    color: var(--primary);
    margin: 0 .15rem;
}

.result-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    overflow: hidden;
}

.result-card .card-body {
    padding: 1.35rem 1.5rem;
}

.result-head {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.cert-photo {
    flex: 0 0 auto;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    background-color: #e9ecef;
}

.result-id {
    flex: 1 1 auto;
    min-width: 0;
}

.result-id h5 {
    margin-bottom: .35rem;
}

.result-status {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 1rem;
    border-radius: 12px;
    min-width: 132px;
}

.result-status i {
    font-size: 1.7rem;
    line-height: 1;
}

.result-status strong {
    display: block;
    font-size: .9rem;
    line-height: 1.3;
}

.result-status small {
    display: block;
    font-size: .72rem;
    opacity: .75;
}

.result-valid .result-status   { background: #e7f4ed; color: #146c43; }
.result-expired .result-status { background: #fff3e0; color: #8a5300; }
.result-revoked .result-status { background: #fdecee; color: #b02a37; }
.result-unknown .result-status { background: #f1f3f5; color: #495057; }

.result-valid .card-body   { border-left: 4px solid #198754; }
.result-expired .card-body { border-left: 4px solid #fd7e14; }
.result-revoked .card-body { border-left: 4px solid #dc3545; }
.result-unknown .card-body { border-left: 4px solid #adb5bd; }

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .9rem 1.25rem;
    margin: 1.2rem 0 0;
    padding-top: 1.1rem;
    border-top: 1px dashed #e9ecef;
}

.result-grid dt {
    font-size: .75rem;
    font-weight: 400;
    color: #868e96;
}

.result-grid dd {
    margin: 0;
    font-size: .95rem;
    font-weight: 600;
    color: #212529;
    word-break: break-all;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    letter-spacing: .3px;
}

.copy-btn {
    border: 1px solid #ced4da;
    background: #fff;
    color: #6c757d;
    font-size: .7rem;
    line-height: 1;
    padding: .25rem .45rem;
    border-radius: 6px;
    vertical-align: .1em;
    cursor: pointer;
}

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

/* ============ 空状态 / 错误 ============ */
.empty-state {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.empty-state > i {
    font-size: 3rem;
    color: #adb5bd;
}

.empty-state.error > i {
    color: #dc3545;
}

.empty-state h5 {
    margin: 1rem 0 .6rem;
}

.empty-state ul {
    display: inline-block;
    text-align: left;
    margin: 0;
    padding-left: 1.1rem;
    font-size: .875rem;
    color: #6c757d;
    line-height: 1.9;
}

.form-hint {
    font-size: .8rem;
}

.form-hint a {
    color: var(--primary);
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

.result-gender {
    font-size: .85rem;
    font-weight: 400;
    color: #868e96;
    margin-left: .35rem;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.5rem;
    margin-top: 1rem;
    font-size: .78rem;
    color: #868e96;
}

.result-meta i {
    margin-right: .2rem;
}

.result-meta b {
    color: #495057;
    font-weight: 600;
}

.result-note {
    margin: .6rem 0 0;
    font-size: .78rem;
    color: #8d949c;
    line-height: 1.6;
}

/* ============ 查询须知 / 状态说明 / FAQ ============ */
.notice-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.05);
}

.notice-title {
    margin-bottom: 1rem;
}

.notice-list {
    margin: 0;
    padding-left: 1.15rem;
    color: #495057;
    font-size: .9rem;
    line-height: 2;
}

.notice-list strong {
    color: #212529;
}

.notice-list code {
    color: var(--primary-dark);
    background: #eef4ff;
    padding: .1rem .3rem;
    border-radius: 4px;
    font-size: .85em;
}

.section-title {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.state-card {
    height: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    border-top: 3px solid #dee2e6;
}

.state-card i {
    font-size: 1.5rem;
    line-height: 1;
}

.state-card h6 {
    margin: .6rem 0 .4rem;
}

.state-card p {
    margin: 0;
    font-size: .78rem;
    color: #6c757d;
    line-height: 1.6;
}

.state-valid   { border-top-color: #198754; }
.state-valid i { color: #198754; }
.state-expired   { border-top-color: #fd7e14; }
.state-expired i { color: #fd7e14; }
.state-revoked   { border-top-color: #dc3545; }
.state-revoked i { color: #dc3545; }
.state-none   { border-top-color: #adb5bd; }
.state-none i { color: #adb5bd; }

.faq-accordion {
    --bs-accordion-border-radius: 12px;
    --bs-accordion-btn-focus-box-shadow: none;
}

.faq-accordion .accordion-item {
    border-color: #e9ecef;
    margin-bottom: .5rem;
    border-radius: 12px !important;
    overflow: hidden;
}

.faq-accordion .accordion-button {
    font-size: .92rem;
    font-weight: 600;
    color: #212529;
    background: #fff;
}

.faq-accordion .accordion-button:not(.collapsed) {
    color: var(--primary-dark);
    background: #f4f8ff;
}

.faq-accordion .accordion-body {
    font-size: .875rem;
    color: #495057;
    line-height: 1.8;
}

/* ============ 证书二维码（后台） ============ */
.qr-box {
    min-height: 120px;
}

.qr-img {
    width: 100%;
    max-width: 240px;
    height: auto;
    image-rendering: pixelated;
}

/* ============ 验证结果 ============ */
.verify-result {
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
}

.verify-result.valid {
    background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
    border: 2px solid #198754;
}

.verify-result.invalid {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    border: 2px solid #dc3545;
}

.verify-result .icon {
    font-size: 4rem;
}

/* ============ 统计卡片 ============ */
.stat-card {
    border: none;
    border-radius: 12px;
    padding: 1.5rem;
    color: #fff;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-card.bg-primary-stat {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
}

.stat-card.bg-success-stat {
    background: linear-gradient(135deg, #198754, #20c997);
}

.stat-card.bg-warning-stat {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.stat-card.bg-danger-stat {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
}

/* ============ 管理后台侧边栏布局 ============ */
.admin-layout {
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    background: #212529;
    min-height: 100%;
    padding-top: 1rem;
}

.admin-sidebar .nav-link {
    color: #adb5bd;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin: 0.15rem 0.5rem;
    transition: all 0.2s;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.admin-sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 0.5rem;
}

/* ============ 表格 ============ */
.table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    overflow: hidden;
}

.table-container .table {
    margin-bottom: 0;
}

.table-container .table th {
    background: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

/* ============ 登录页 ============ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #198754 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.login-card .card-body {
    padding: 2.5rem;
}

/* ============ 打印样式 ============ */
@media print {
    .navbar, .footer, .btn, .no-print, #search, .info-section {
        display: none !important;
    }
    #results {
        display: block !important;
        margin: 0 !important;
    }
    .hero-banner {
        background: #0d6efd !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    body {
        background: #fff;
    }
    .result-card, .empty-state {
        box-shadow: none;
        border: 1px solid #dee2e6;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .result-status, .badge {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .hero-banner {
        padding: 1.5rem 0;
    }
    .hero-banner h1 {
        font-size: 1.3rem;
    }
    .stat-card .stat-number {
        font-size: 1.5rem;
    }
    .result-card .card-body {
        padding: 1rem 1rem 1.15rem;
    }
    .result-head {
        flex-wrap: wrap;
        gap: .75rem;
    }
    .cert-photo {
        width: 64px;
        height: 64px;
        border-width: 2px;
    }
    .result-status {
        order: 3;
        width: 100%;
        min-width: 0;
        padding: .5rem .75rem;
    }
    .result-status i {
        font-size: 1.15rem;
    }
    .result-status strong {
        font-size: .82rem;
    }
    .result-status small {
        display: none;
    }
    .result-grid {
        grid-template-columns: 1fr 1fr;
        gap: .75rem 1rem;
        margin-top: 1rem;
        padding-top: .9rem;
    }
    .result-grid dd {
        font-size: .875rem;
    }
    .results-bar {
        flex-wrap: wrap;
        gap: .5rem;
    }
}
