/* NVD 漏洞查询系统样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
main {
    margin-bottom: 40px;
}

/* Search Card */
.search-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.search-card h2 {
    margin-bottom: 25px;
    color: #667eea;
    font-size: 1.8rem;
}

/* Form */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Info Section */
.info-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
}

.info-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.info-section p {
    line-height: 1.6;
    color: #666;
}

/* API Note */
.api-note {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px 25px;
    margin-top: 20px;
}

.api-note h4 {
    color: #764ba2;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.api-note ul {
    list-style: none;
    padding-left: 0;
}

.api-note li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #666;
    line-height: 1.5;
}

.api-note li:before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #667eea;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border-left: 4px solid;
}

.alert-error {
    background: #fee;
    border-color: #c33;
    color: #c33;
}

.alert-info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.alert-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.alert strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.alert p {
    margin: 0;
    line-height: 1.6;
}

/* Vulnerabilities List */
.vulnerabilities-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 25px;
}

.vulnerability-card {
    border-radius: 8px;
    border: 2px solid;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.vulnerability-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.vulnerability-card.severity-critical {
    border-color: #c33;
    background: #fff5f5;
}

.vulnerability-card.severity-high {
    border-color: #f57c00;
    background: #fff8f0;
}

.vulnerability-card.severity-medium {
    border-color: #fbc02d;
    background: #fffff0;
}

.vulnerability-card.severity-low {
    border-color: #4caf50;
    background: #f5fff5;
}

.vuln-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 10px;
}

.vuln-header h3 {
    color: #333;
    font-size: 1.3rem;
    font-family: 'Courier New', monospace;
}

.cvss-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.cvss-badge small {
    margin-left: 5px;
    font-size: 0.8rem;
    opacity: 0.9;
}

.cvss-badge.severity-critical {
    background: #c33;
}

.cvss-badge.severity-high {
    background: #f57c00;
}

.cvss-badge.severity-medium {
    background: #fbc02d;
    color: #333;
}

.cvss-badge.severity-low {
    background: #4caf50;
}

.vuln-body {
    padding: 20px;
}

.vuln-description {
    margin-bottom: 15px;
}

.vuln-description strong {
    color: #555;
    display: block;
    margin-bottom: 8px;
}

.vuln-description p {
    color: #666;
    line-height: 1.6;
}

.vuln-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.meta-item {
    display: flex;
    gap: 8px;
    font-size: 0.9rem;
}

.meta-label {
    font-weight: 600;
    color: #555;
}

/* Back Link */
.back-link {
    margin-top: 25px;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.9;
}

footer a {
    color: white;
    text-decoration: underline;
}

footer a:hover {
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .search-card {
        padding: 20px;
    }

    .vuln-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .vuln-meta {
        flex-direction: column;
        gap: 10px;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-form {
        width: 100%;
    }

    .btn-export {
        width: 100%;
    }
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.export-form {
    display: inline-block;
    margin: 0;
}

.btn-export {
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-export:active {
    transform: translateY(0);
}

.btn-export-json {
    border-color: #3498db;
    color: #3498db;
}

.btn-export-json:hover {
    background: #3498db;
    color: white;
}

.btn-export-csv {
    border-color: #27ae60;
    color: #27ae60;
}

.btn-export-csv:hover {
    background: #27ae60;
    color: white;
}

/* Sort Note */
.sort-note {
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
    margin-left: 8px;
}

/* Vulnerability Products */
.vuln-products {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
}

.vuln-products strong {
    display: block;
    margin-bottom: 10px;
    color: #555;
}

.vuln-products ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vuln-products li {
    padding: 6px 0;
}

.vuln-products code {
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #667eea;
    word-break: break-all;
}

/* Severity Unknown */
.vulnerability-card.severity-unknown {
    border-color: #999;
    background: #f5f5f5;
}

.cvss-badge.severity-unknown {
    background: #999;
}

/* ==================== Navigation Bar ==================== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-trial {
    background: #fff3cd;
    color: #856404;
}

.user-formal {
    background: #d4edda;
    color: #155724;
}

.nav-logout {
    color: #dc3545;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-logout:hover {
    background: #ffe6e6;
    text-decoration: none;
}

/* ==================== Auth Card ==================== */
.auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    margin: 40px auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #667eea;
}

.auth-subtitle {
    font-size: 1.1rem;
    color: #666;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ==================== Trial Notice ==================== */
.trial-notice {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.trial-notice h4 {
    color: #1976d2;
    margin-bottom: 10px;
}

.trial-notice p {
    color: #555;
    margin: 5px 0;
}

/* ==================== Trial Banner ==================== */
.trial-banner {
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.trial-active {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1976d2;
}

.trial-expired {
    background: #ffebee;
    border-left: 4px solid #c33;
    color: #c33;
}

.trial-expired p {
    margin: 10px 0 5px 0;
}

.contact-link {
    display: inline-block;
    margin-top: 10px;
    color: #c33;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    background: white;
    border-radius: 8px;
    transition: all 0.3s;
}

.contact-link:hover {
    background: #c33;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

/* ==================== 移动端优化 ==================== */

/* 小屏幕手机 (小于 480px) */
@media (max-width: 479px) {
    body {
        padding: 10px;
    }

    .container {
        max-width: 100%;
    }

    /* 导航栏优化 */
    .navbar {
        padding: 12px 15px;
        margin-bottom: 15px;
    }

    .nav-brand {
        font-size: 1rem;
        flex-wrap: wrap;
    }

    .nav-icon {
        font-size: 1.2rem;
    }

    .nav-user {
        gap: 10px;
    }

    .user-info {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }

    .user-badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .nav-logout {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* 搜索卡片优化 */
    .search-card {
        padding: 20px 15px;
    }

    .search-card h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    /* 表单优化 */
    .form-group input {
        padding: 14px 12px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    .form-group label {
        font-size: 0.9rem;
    }

    /* 按钮优化 */
    .btn-primary {
        padding: 16px 24px;
        font-size: 1rem;
        min-height: 48px; /* 移动端最小触摸目标 */
    }

    /* 试用期横幅优化 */
    .trial-banner {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .trial-banner strong {
        font-size: 1rem;
    }

    .trial-banner p {
        font-size: 0.85rem;
    }

    .contact-link {
        padding: 8px 16px;
        font-size: 0.9rem;
        display: block;
        text-align: center;
    }

    /* 信息区域优化 */
    .info-section {
        padding: 18px 15px;
    }

    .info-section h3 {
        font-size: 1.15rem;
    }

    .info-section p {
        font-size: 0.9rem;
    }

    /* API提示优化 */
    .api-note {
        padding: 15px;
    }

    .api-note h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .api-note li {
        font-size: 0.85rem;
        padding: 6px 0 6px 20px;
    }

    .api-note li:before {
        left: 5px;
        font-size: 1rem;
    }

    /* 漏洞卡片优化 */
    .vulnerability-card {
        margin-bottom: 15px;
    }

    .vuln-header {
        padding: 12px 15px;
    }

    .vuln-header h3 {
        font-size: 1.1rem;
        word-break: break-all;
    }

    .cvss-badge {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .cvss-badge small {
        display: none; /* 小屏幕隐藏英文标签 */
    }

    .vuln-body {
        padding: 15px;
    }

    .vuln-description p {
        font-size: 0.9rem;
    }

    .vuln-meta {
        gap: 12px;
        font-size: 0.8rem;
    }

    /* 导出按钮优化 */
    .export-buttons {
        gap: 10px;
    }

    .btn-export {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    /* 页脚优化 */
    footer {
        padding: 15px;
        font-size: 0.85rem;
    }

    /* 认证卡片优化 */
    .auth-card {
        padding: 20px 15px;
        margin: 15px 10px;
    }

    .auth-header h1 {
        font-size: 1.6rem;
    }

    .auth-subtitle {
        font-size: 0.95rem;
    }

    /* 警告框优化 */
    .alert {
        padding: 15px;
        font-size: 0.9rem;
    }

    .alert strong {
        font-size: 1rem;
    }
}

/* 中等屏幕手机 (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    body {
        padding: 15px;
    }

    .navbar {
        padding: 15px 20px;
    }

    .search-card {
        padding: 25px 20px;
    }

    .form-group input {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    .btn-primary {
        min-height: 48px;
    }

    .vuln-header h3 {
        font-size: 1.2rem;
    }

    .auth-card {
        padding: 30px 25px;
    }
}

/* 平板设备 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
    }

    .navbar {
        padding: 18px 25px;
    }

    .nav-brand {
        font-size: 1.3rem;
    }

    .search-card {
        padding: 30px 25px;
    }

    .form-group input {
        font-size: 16px;
    }

    .btn-primary {
        min-height: 48px;
    }
}

/* 移动端通用优化 (所有移动设备) */
@media (max-width: 1024px) {
    /* 触摸友好的交互 */
    .btn-primary,
    .btn-secondary,
    .btn-export,
    .nav-logout,
    button,
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 输入框优化 */
    input[type="text"],
    input[type="password"],
    input[type="email"] {
        font-size: 16px !important; /* 防止iOS缩放 */
        -webkit-appearance: none;
        border-radius: 8px;
    }

    /* 改善可点击区域 */
    .cvss-badge {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
    }

    /* 移除hover效果在触摸设备上 */
    @media (hover: none) {
        .btn-primary:hover,
        .btn-secondary:hover,
        .btn-export:hover {
            transform: none;
        }

        .btn-primary:active,
        .btn-secondary:active,
        .btn-export:active {
            transform: scale(0.98);
            opacity: 0.8;
        }
    }

    /* 横屏模式优化 */
    @media (orientation: landscape) and (max-height: 500px) {
        body {
            padding: 5px;
        }

        .navbar {
            padding: 8px 15px;
            margin-bottom: 10px;
        }

        .search-card {
            padding: 15px;
        }

        .search-card h2 {
            font-size: 1.3rem;
            margin-bottom: 15px;
        }

        .form-group {
            margin-bottom: 8px;
        }

        .trial-banner {
            padding: 10px;
            margin-bottom: 10px;
        }
    }
}

/* ==================== 原有响应式样式 ==================== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .search-card {
        padding: 20px;
    }

    .vuln-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .vuln-meta {
        flex-direction: column;
        gap: 10px;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-form {
        width: 100%;
    }

    .btn-export {
        width: 100%;
    }

    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .nav-user {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .auth-card {
        padding: 25px;
        margin: 20px;
    }

    .trial-banner {
        padding: 15px;
    }
}

/* ==================== 安全区域适配 (iPhone X+) ==================== */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }

    .navbar {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }

    footer {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* ==================== 暗色模式适配 ==================== */
@media (prefers-color-scheme: dark) {
    /* 自动适配暗色模式 */
}

/* ==================== 减少动画 (用户偏好) ==================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== 高对比度模式 ==================== */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid currentColor;
    }

    .vulnerability-card {
        border-width: 3px;
    }
}
