/* ===== SSLSafe 工具箱公共样式（自 toolbox.html 内联样式抽取，供各工具独立页面共用） ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: rgba(99, 102, 241, 0.15);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }

/* 全局字体设置 - 微软雅黑 */
/* 注意：排除 Font Awesome 图标，避免图标字体被覆盖 */
*:not(i):not([class*="fa"]):not([class*="icon"]) {
    font-family: 'Microsoft YaHei', '微软雅黑', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* 确保图标使用 Font Awesome 字体 */
i, [class*="fa"], [class*="icon"] {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free', 'FontAwesome', sans-serif !important;
}

body {
    background: linear-gradient(180deg, #f0f4f8 0%, #e2e8f0 100%);
    min-height: 100vh;
    font-family: 'Microsoft YaHei', '微软雅黑', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

/* ===== 顶部导航 ===== */
/* 使用与index.html一致的.top-nav样式 */
.top-nav {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(228, 231, 237, 0.8) !important;
    padding: 14px 0 !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
}
.nav-content {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}
.logo-section {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
}

/* 首页按钮样式 - 与语言选择器保持一致 */
.nav-btn-home {
    padding: 9px 18px !important;
    margin: 0 !important;
    border: 1.5px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #374151 !important;
    cursor: pointer;
    outline: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    vertical-align: middle !important;
}
.nav-btn-home:hover {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15) !important;
    background: #f8fafc !important;
}
.nav-btn-home:active,
.nav-btn-home:focus {
    outline: none !important;
    box-shadow: none !important;
}
.nav-btn-home i {
    font-size: 14px !important;
    color: inherit !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}
.nav-btn-home span {
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* ===== 页面布局 ===== */
.tb-layout {
    display: flex;
    gap: 28px;
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 24px 48px;
}

/* ===== 左侧边栏 ===== */
.tb-sidebar {
    width: 270px;
    flex-shrink: 0;
}
.tb-sidebar-card {
    background: var(--bg-sidebar);
    border-radius: var(--radius-xl);
    padding: 24px 16px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 84px;
}
.tb-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 20px;
    padding: 0 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.tb-sidebar-title i {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.tb-sidebar-group { margin-bottom: 20px; }
.tb-sidebar-group-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-left: 10px;
}
.tb-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    font-size: 13px;
    color: #cbd5e1;
    text-decoration: none;
    margin-bottom: 3px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.tb-sidebar-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}
.tb-sidebar-item.active {
    background: var(--bg-sidebar-active);
    color: var(--primary-light);
    font-weight: 600;
}
.tb-sidebar-item i {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    transition: all 0.25s;
}
.tb-sidebar-item:hover i,
.tb-sidebar-item.active i {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
}
.tb-sidebar-item:not(:hover):not(.active) i {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
}

/* ===== 主内容区 ===== */
.tb-main { flex: 1; min-width: 0; }
.tb-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(226,232,240,0.6);
    overflow: hidden;
    animation: tbFadeUp 0.5s ease-out;
}
@keyframes tbFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.tb-header {
    padding: 28px 32px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
}
.tb-header-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
    flex-shrink: 0;
}
.tb-header-text h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}
.tb-header-text p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 6px 0 0;
}
.tb-body {
    padding: 32px;
}

/* ===== Alert ===== */
.tb-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    animation: tbShake 0.4s ease-out;
}
@keyframes tbShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.tb-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}
.tb-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}
.tb-alert i { font-size: 16px; flex-shrink: 0; }

/* ===== 表单 ===== */
.tb-form { max-width: 800px; }
.tb-form-group {
    margin-bottom: 22px;
}
.tb-form-group:last-of-type { margin-bottom: 0; }
.tb-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tb-form-label .tb-label-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: none;
    letter-spacing: 0;
    vertical-align: middle;
}
.tb-input, .tb-textarea, .tb-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}
.tb-input::placeholder, .tb-textarea::placeholder {
    color: var(--text-muted);
}
.tb-input:focus, .tb-textarea:focus, .tb-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}
.tb-textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
}
.tb-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.tb-form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.tb-form-row.tb-row-2 { grid-template-columns: repeat(2, 1fr); }
.tb-form-row.tb-row-1 { grid-template-columns: 1fr; }

/* ===== 按钮 ===== */
.tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
    margin-top: 8px;
}
.tb-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99,102,241,0.45);
}
.tb-btn:active:not(:disabled) {
    transform: translateY(0);
}
.tb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.tb-btn i { font-size: 13px; }

/* ===== 结果区域 ===== */
.tb-result {
    margin-top: 28px;
    animation: tbFadeUp 0.4s ease-out;
}
.tb-result-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.tb-result-title span {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}
.tb-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.tb-copy-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}
.tb-result-box {
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-x: auto;
}
.tb-result-box pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
.tb-result-textarea {
    width: 100%;
    background: #0f172a;
    border: none;
    border-radius: var(--radius-md);
    padding: 20px;
    color: #e2e8f0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.7;
    outline: none;
    resize: vertical;
}
.tb-result-textarea::selection {
    background: rgba(99,102,241,0.3);
}
.tb-result-meta {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}
.tb-result-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tb-result-meta i { color: var(--primary); font-size: 11px; }

/* ===== 表格 ===== */
.tb-table-wrap {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}
.tb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.tb-table th {
    background: #f8fafc;
    padding: 14px 18px;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.tb-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.tb-table tr:last-child td { border-bottom: none; }
.tb-table tr:hover td { background: #f8fafc; }
.tb-table td:first-child {
    font-weight: 600;
    color: var(--text-secondary);
    width: 200px;
    white-space: nowrap;
}
.tb-table td:last-child {
    word-break: break-all;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    color: var(--text-primary);
}

/* ===== 状态卡片 ===== */
.tb-status-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
}
.tb-status-card i { font-size: 22px; }
.tb-status-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    color: #059669;
}
.tb-status-fail {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    color: #dc2626;
}

/* ===== 分隔线 ===== */
.tb-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 24px 0;
}

/* ===== 证书链列表 ===== */
.tb-cert-chain-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tb-cert-chain-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s;
}
.tb-cert-chain-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}
.tb-cert-chain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    background: #fff;
    transition: background 0.2s;
}
.tb-cert-chain-header:hover {
    background: #f1f5f9;
}
.tb-cert-chain-num {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tb-cert-chain-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
}
.tb-cert-chain-subject {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.tb-cert-chain-header i {
    color: var(--text-muted);
    font-size: 14px;
    transition: transform 0.2s;
}
.tb-cert-chain-body {
    padding: 0 18px 18px;
    background: #fff;
}

/* ===== CT 日志列表 ===== */
.tb-ct-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
}
.tb-ct-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    user-select: none;
}
.tb-ct-tab:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}
.tb-ct-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
}

.tb-ct-detail-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.tb-ct-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.tb-ct-detail-table tr {
    border-bottom: 1px solid #f0f0f0;
}
.tb-ct-detail-table tr:last-child {
    border-bottom: none;
}
.tb-ct-label {
    width: 140px;
    padding: 14px 18px;
    font-weight: 600;
    color: var(--text-muted);
    background: #fafafa;
    text-align: right;
    vertical-align: top;
}
.tb-ct-value {
    padding: 14px 18px;
    color: var(--text-primary);
    word-break: break-all;
}
.tb-ct-mono {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
}
.tb-ct-sign-data {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== 文件上传 ===== */
.tb-file-upload { margin-top: 4px; }
.tb-file-label {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 20px; border: 2px dashed var(--border);
    border-radius: var(--radius-md); cursor: pointer;
    transition: all 0.3s; color: var(--text-muted); font-size: 14px;
}
.tb-file-label:hover { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,0.05); }
.tb-file-label i { font-size: 18px; }
.tb-file-input {
    position: absolute; width: 1px; height: 1px;
    opacity: 0; overflow: hidden; pointer-events: none;
}

/* ===== 工具箱首页工具卡片网格 ===== */
.tb-tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.tb-tool-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    margin: 28px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tb-tool-group-title:first-child { margin-top: 0; }
.tb-tool-group-title i { color: var(--primary); font-size: 12px; }
.tb-tool-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.tb-tool-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.tb-tool-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.tb-tool-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.tb-tool-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== 响应式 ===== */
@media screen and (max-width: 900px) {
    .tb-layout { flex-direction: column; padding: 16px; }
    .tb-sidebar { width: 100%; }
    .tb-sidebar-card { position: static; }
    .tb-form-row { grid-template-columns: 1fr; }
    .tb-body { padding: 20px; }
    .tb-header { padding: 20px 24px; }
    .tb-tool-grid { grid-template-columns: 1fr; }
}
