/* 网安巡检助手 - 全局样式 */
:root {
    --primary: #1a73e8;
    --primary-light: #e8f0fe;
    --bg: #ffffff;
    --surface: #ffffff;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --text-secondary: #5f6368;
    --danger: #d93025;
    --warning: #f9ab00;
    --success: #188038;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ========== 顶部标题栏 ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ========== 内容区域 ========== */
.main {
    flex: 1;
    padding: 72px 16px 80px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.page {
    display: none;
    animation: fadeIn 0.25s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 区块样式 ========== */
.section-block {
    margin-bottom: 24px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
}

/* ========== 公告卡片 ========== */
.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.announcement-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.announcement-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.announcement-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.announcement-card-title {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    line-height: 1.4;
}

.announcement-card-summary {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 4px;
}

.announcement-card-date {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ========== 等级标签 ========== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.badge-emergency, .badge-severe, .badge-high, .badge-waiting {
    background: #fce8e6;
    color: var(--danger);
}

.badge-notice, .badge-mid, .badge-processing {
    background: #fef7e0;
    color: #e37400;
}

.badge-normal, .badge-low, .badge-closed {
    background: #e6f4ea;
    color: var(--success);
}

/* ========== 漏洞卡片 ========== */
.vuln-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vuln-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: var(--transition);
}

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

.vuln-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.vuln-card-name {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}

.vuln-card-cve {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: monospace;
}

.vuln-card-scope {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.vuln-card-suggestion {
    font-size: 12px;
    color: var(--text-secondary);
    background: #f8f9fa;
    border-radius: 6px;
    padding: 10px 12px;
    line-height: 1.6;
    white-space: pre-line;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 20px;
}

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

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-item {
    position: relative;
    cursor: pointer;
}

.radio-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-item span {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    transition: var(--transition);
    background: var(--surface);
    user-select: none;
}

.radio-item input:checked + span {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    background: var(--surface);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    resize: vertical;
    min-height: 100px;
    transition: var(--transition);
    background: var(--surface);
    font-family: inherit;
    line-height: 1.6;
}

.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

/* ========== 上传区域 ========== */
.upload-area {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.image-preview:empty {
    display: none;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-upload {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

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

/* ========== 提交按钮 ========== */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 1px;
}

.btn-submit:hover {
    background: #1557b0;
    box-shadow: 0 4px 12px rgba(26,115,232,0.3);
}

.btn-submit:active {
    transform: scale(0.98);
}

/* ========== 工单列表 ========== */
.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
}

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

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-card-no {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.order-card-type {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 4px;
}

.order-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.order-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 知识库 ========== */
.search-bar {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    background: var(--surface);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    color: var(--text-secondary);
}

.cat-tab.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.knowledge-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.knowledge-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.knowledge-card-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.knowledge-card-summary {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.knowledge-card-footer {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.knowledge-tag {
    font-size: 11px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ========== 底部Tab栏 ========== */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 10px;
    transition: var(--transition);
}

.tab-item.active {
    color: var(--primary);
}

.tab-icon {
    width: 22px;
    height: 22px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    text-align: center;
    max-width: 80%;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ========== 加载动画 ========== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ========== Modal弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0 4px;
}

.modal-body {
    padding: 16px 20px 24px;
    overflow-y: auto;
    line-height: 1.7;
    font-size: 14px;
}

/* ========== 响应式 ========== */
@media (min-width: 768px) {
    .main {
        padding: 72px 24px 80px;
    }
    
    .modal-content {
        border-radius: 16px;
        margin-bottom: 40px;
        max-height: 70vh;
    }
}