/* SVAKOM 管理后台 - 自定义样式 */

:root {
    --sidebar-width: 210px;
    --svakom-primary: #6c5ce7;
    --svakom-primary-dark: #5641e0;
    --topbar-height: 56px;
    --left-width: 360px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body.admin-body {
    background: #f0f2f5;
}

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
    background: #fff; border-radius: 16px; padding: 2.5rem 2rem 1.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); text-align: center;
}
.login-logo {
    width: 70px; height: 70px; margin: 0 auto 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 2rem; box-shadow: 0 8px 20px rgba(102,126,234,0.4);
}
.login-title { font-weight: 600; color: #2d3436; margin-bottom: 0.25rem; }
.login-subtitle { color: #b2bec3; font-size: 0.85rem; margin-bottom: 1.5rem; }
.login-form .form-control:focus { border-color: #6c5ce7; box-shadow: 0 0 0 0.2rem rgba(108,92,231,0.15); }
.btn-login {
    background: linear-gradient(135deg, #667eea, #764ba2); border: none;
    padding: 0.65rem; font-weight: 500; letter-spacing: 2px;
}
.btn-login:hover { background: linear-gradient(135deg, #5a6fd6, #6a3f96); }
.alert-sm { padding: 0.5rem 0.75rem; font-size: 0.85rem; margin-bottom: 1rem; }
.login-footer { margin-top: 1.5rem; color: #b2bec3; }

/* ===== 顶部导航栏（固定定位） ===== */
.topbar {
    position: fixed;
    top: 0; left: var(--sidebar-width); right: 0;
    height: var(--topbar-height);
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.topbar .navbar-brand {
    color: #fff; font-size: 1.1rem; font-weight: 600;
    text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.topbar .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar .topbar-right .text-light { color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.topbar .btn-outline-light {
    color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.3);
    font-size: 0.8rem; padding: 4px 12px; border-radius: 6px;
    background: transparent; cursor: pointer; transition: all 0.2s;
}
.topbar .btn-outline-light:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== 提示消息（固定在导航栏下方） ===== */
.alert-bar {
    position: fixed;
    top: var(--topbar-height); left: var(--sidebar-width); right: 0;
    z-index: 999;
    border-radius: 0;
    margin: 0;
    padding: 8px 24px;
    font-size: 0.85rem;
}

/* ===== 左侧面板（固定定位） ===== */
.split-left {
    position: fixed;
    top: var(--topbar-height); left: var(--sidebar-width); bottom: 0;
    width: var(--left-width);
    background: #fff;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 搜索区 */
.search-bar {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.search-bar .input-group { display: flex; gap: 0; }
.search-bar .input-group-text {
    background: #fff; border: 1px solid #dee2e6; border-right: none;
    border-radius: 6px 0 0 6px; padding: 6px 10px; color: #999;
}
.search-bar .form-control {
    border: 1px solid #dee2e6; border-right: none; border-radius: 0;
    padding: 6px 10px; font-size: 0.85rem; flex: 1;
}
.search-bar .form-control:focus {
    outline: none; border-color: var(--svakom-primary);
    box-shadow: none;
}
.search-bar .btn {
    padding: 6px 14px; font-size: 0.85rem; border-radius: 0;
}
.search-bar .btn-primary {
    background: var(--svakom-primary); border: 1px solid var(--svakom-primary);
    color: #fff; cursor: pointer;
}
.search-bar .btn-primary:hover { background: var(--svakom-primary-dark); }
.search-bar .btn-outline-secondary {
    border: 1px solid #dee2e6; border-radius: 0 6px 6px 0;
    background: #fff; color: #666; cursor: pointer;
}
.search-bar .btn-outline-secondary:hover { background: #f5f5f5; }
.search-bar .search-meta {
    display: flex; justify-content: space-between; margin-top: 10px;
    font-size: 0.78rem; color: #999;
}

/* 筛选行 */
.filter-row {
    display: flex; gap: 8px; margin-top: 10px;
}
.filter-select {
    flex: 1; font-size: 0.8rem; padding: 4px 8px;
    border: 1px solid #dee2e6; border-radius: 6px;
    color: #555; cursor: pointer; background: #fff;
}
.filter-select:focus {
    outline: none; border-color: var(--svakom-primary);
    box-shadow: 0 0 0 0.15rem rgba(108,92,231,0.1);
}

/* 案例列表 */
.case-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.case-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: all 0.15s;
}
.case-item:hover { background: #f8f9ff; }
.case-item.active {
    background: #edeafd;
    border-left: 3px solid var(--svakom-primary);
    padding-left: 13px;
}

.case-item .case-id {
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    background: #f1f2f6; padding: 2px 8px; border-radius: 4px;
    color: var(--svakom-primary); font-weight: 600;
    font-size: 0.78rem; letter-spacing: 0.3px;
}
.case-item.active .case-id { background: #fff; }

.case-item .case-time {
    font-size: 0.75rem; color: #999; white-space: nowrap;
}

.case-item .case-desc {
    color: #333; font-size: 0.83rem; margin: 5px 0 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.case-item .case-meta { font-size: 0.73rem; color: #aaa; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 版本/状态徽章 */
.badge-version {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    background: #e8eafc; color: var(--svakom-primary);
    font-size: 0.68rem; font-weight: 600;
}
.badge-resolved {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    background: #d4edda; color: #155724;
    font-size: 0.68rem; font-weight: 600;
}
.badge-pending {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    background: #fff3cd; color: #856404;
    font-size: 0.68rem; font-weight: 600;
}

/* 分页 */
.case-pagination {
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    text-align: center;
}
.case-pagination .pagination {
    display: inline-flex; gap: 4px; margin: 0; list-style: none; padding: 0;
}
.case-pagination .page-item.disabled { opacity: 0.4; pointer-events: none; }
.case-pagination .page-link {
    display: block; padding: 4px 10px; font-size: 0.8rem;
    border: 1px solid #e0e0e0; border-radius: 4px;
    color: var(--svakom-primary); text-decoration: none; transition: all 0.15s;
}
.case-pagination .page-item.active .page-link {
    background: var(--svakom-primary); color: #fff; border-color: var(--svakom-primary);
}
.case-pagination .page-link:hover { background: #f0f0f5; }

/* ===== 右侧详情区（固定定位） ===== */
.split-right {
    position: fixed;
    top: var(--topbar-height);
    left: calc(var(--sidebar-width) + var(--left-width));
    right: 0; bottom: 0;
    background: #fff;
    overflow: hidden;
}

/* 空状态 */
.empty-state {
    height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #ccc;
}
.empty-state i { font-size: 4rem; margin-bottom: 16px; }
.empty-state p { font-size: 0.9rem; }

/* 详情头部 */
.detail-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    position: absolute;
    top: 0; left: 0; right: 0;
    background: #fff;
    z-index: 10;
}

.detail-top-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
}

.case-id-group {
    display: flex; align-items: center; gap: 0; flex-shrink: 0;
}
.case-id-group input {
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-weight: 600; color: var(--svakom-primary);
    font-size: 0.82rem; padding: 5px 10px;
    border: 1px solid #dee2e6; border-radius: 6px 0 0 6px;
    background: #f8f9fa; width: 240px;
}
.case-id-group button {
    padding: 5px 12px; font-size: 0.78rem;
    border: 1px solid #dee2e6; border-left: none; border-radius: 0 6px 6px 0;
    background: #fff; color: #666; cursor: pointer; transition: all 0.15s;
}
.case-id-group button:hover { background: #f0f0f5; }

.detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-actions .btn {
    padding: 5px 12px; font-size: 0.78rem; border-radius: 6px;
    cursor: pointer; transition: all 0.15s; display: inline-flex;
    align-items: center; gap: 4px;
}
.detail-actions .btn-outline-primary {
    border: 1px solid var(--svakom-primary); color: var(--svakom-primary);
    background: #fff;
}
.detail-actions .btn-outline-primary:hover { background: var(--svakom-primary); color: #fff; }
.detail-actions .btn-outline-secondary {
    border: 1px solid #dee2e6; color: #666; background: #fff;
}
.detail-actions .btn-outline-secondary:hover { background: #f0f0f5; }
.detail-actions .btn-outline-danger {
    border: 1px solid #e74c3c; color: #e74c3c; background: #fff;
}
.detail-actions .btn-outline-danger:hover { background: #e74c3c; color: #fff; }
.detail-actions .btn-outline-success {
    border: 1px solid #28a745; color: #28a745; background: #fff;
}
.detail-actions .btn-outline-success:hover { background: #28a745; color: #fff; }
.detail-actions .btn-success {
    border: 1px solid #28a745; color: #fff; background: #28a745;
}
.detail-actions .btn-success:hover { background: #218838; }

.detail-meta-row {
    display: flex; gap: 20px; flex-wrap: wrap;
    font-size: 0.8rem; margin-bottom: 6px;
}
.detail-meta-row .meta-label { color: #999; }
.detail-meta-row .meta-value { color: #333; font-weight: 500; }

.detail-desc-row { font-size: 0.82rem; margin-bottom: 4px; }
.detail-desc-row .desc-label { color: #999; }
.detail-desc-row .desc-value { color: #333; }

.detail-info-row { font-size: 0.82rem; margin-bottom: 4px; display: flex; align-items: center; }
.detail-info-row .info-item { display: flex; align-items: center; gap: 4px; }
.detail-info-row .info-item i { color: #6c757d; }
.detail-info-row .info-label { color: #999; }
.detail-info-row .info-value { color: #333; font-weight: 500; word-break: break-all; }

.device-info-row { margin-top: 6px; }
.device-info-row .toggle-btn {
    background: none; border: none; color: var(--svakom-primary);
    font-size: 0.8rem; cursor: pointer; padding: 0;
}
.device-info-row .device-info-pre {
    background: #f8f9fa; border: 1px solid #e8e8e8; border-radius: 6px;
    padding: 10px; font-size: 11px; max-height: 150px; overflow: auto;
    margin-top: 6px; white-space: pre-wrap; word-break: break-all;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

/* 日志容器（iframe 容器，绝对定位填满 header 下方） */
.log-container {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    overflow: hidden;
    background: #1e1e2e;
}

/* ===== 滚动条 ===== */
.case-list::-webkit-scrollbar,
.device-info-pre::-webkit-scrollbar {
    width: 6px; height: 6px;
}
.case-list::-webkit-scrollbar-track,
.device-info-pre::-webkit-scrollbar-track { background: transparent; }
.case-list::-webkit-scrollbar-thumb,
.device-info-pre::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 3px; }
.case-list::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }

.log-content::-webkit-scrollbar { width: 8px; height: 8px; }
.log-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.15); }
.log-content::-webkit-scrollbar-thumb { background: #45475a; border-radius: 4px; }
.log-content::-webkit-scrollbar-thumb:hover { background: #585b70; }

/* ===== 按钮主题色（通用） ===== */
.btn-primary { background: var(--svakom-primary); border-color: var(--svakom-primary); }
.btn-primary:hover { background: var(--svakom-primary-dark); border-color: var(--svakom-primary-dark); }
.btn-outline-primary { color: var(--svakom-primary); border-color: var(--svakom-primary); }
.btn-outline-primary:hover { background: var(--svakom-primary); border-color: var(--svakom-primary); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    :root { --left-width: 280px; }
    .case-id-group input { width: 160px; }
}

/* ===== 门户页 ===== */
.portal-body {
    background: #f0f2f5;
    overflow: auto;
}
.portal-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 24px 40px;
}
.portal-header {
    text-align: center;
    margin-bottom: 40px;
}
.portal-header h2 {
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 8px;
}
.portal-header p {
    font-size: 0.95rem;
}
.portal-cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}
@media (max-width: 900px) {
    .portal-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .portal-cards { grid-template-columns: 1fr; }
}
.portal-card {
    background: #fff;
    border-radius: 16px;
    padding: 36px 28px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid transparent;
}
.portal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    border-color: var(--svakom-primary);
}
.portal-card-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    margin-bottom: 20px;
}
.portal-card-log .portal-card-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.portal-card-remote .portal-card-icon {
    background: linear-gradient(135deg, #00b894, #00cec9);
}
.portal-card-security .portal-card-icon {
    background: linear-gradient(135deg, #e17055, #d63031);
}
.portal-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 8px;
}
.portal-card p {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 20px;
    line-height: 1.5;
}
.portal-card-enter {
    font-size: 0.85rem;
    color: var(--svakom-primary);
    font-weight: 500;
}

/* ===== 远程监控页 ===== */
.remote-monitor-container {
    padding: 76px 24px 40px;
    max-width: 1100px;
    margin: 0 auto;
    overflow-y: auto;
    height: 100vh;
}
.remote-alert {
    margin-bottom: 20px;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.88rem;
}

/* 指标卡片行 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
@media (max-width: 768px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff; flex-shrink: 0;
}
.stat-icon-blue { background: #3498db; }
.stat-icon-green { background: #00b894; }
.stat-icon-purple { background: #9b59b6; }
.stat-icon-red { background: #e74c3c; }
.stat-value {
    font-size: 1.5rem; font-weight: 700; color: #2d3436;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.78rem; color: #999; margin-top: 2px;
}

/* 消息计数 */
.counters-row {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.section-title {
    font-weight: 600; color: #2d3436; margin-bottom: 16px;
    display: flex; align-items: center; gap: 6px;
}
.counters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.counter-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.counter-label {
    font-size: 0.75rem; color: #888;
}
.counter-value {
    font-size: 1.1rem; font-weight: 600; color: #2d3436;
}

/* 区块通用 */
.section-block {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.remote-table {
    font-size: 0.85rem;
    margin-bottom: 0;
}
.remote-table th {
    color: #888; font-weight: 500; border-bottom: 2px solid #f0f0f0;
}
.remote-table td {
    vertical-align: middle;
    border-color: #f5f5f5;
}
.remote-table code {
    color: var(--svakom-primary);
    background: #f1f2f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ===== 统一侧边栏 ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: #1a1a2e;
    overflow-y: auto;
    z-index: 1001;
    padding: 10px 0 24px;
    display: flex;
    flex-direction: column;
}
.sidebar-group {
    color: rgba(255,255,255,0.35);
    font-size: 0.68rem;
    letter-spacing: 2px;
    padding: 14px 18px 6px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 9px 18px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}
.sidebar-link i { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(102,126,234,0.35), rgba(102,126,234,0.08));
    border-left-color: #667eea;
}

/* ===== 运营管理通用页面（右侧内容区） ===== */
.admin-page {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0; bottom: 0;
    overflow-y: auto;
    padding: 20px 24px;
}
.admin-page .page-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.admin-page .page-head h5 { margin: 0; font-weight: 600; color: #2d3436; }
.admin-page .table-card {
    background: #fff; border-radius: 12px; padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.admin-page .table { font-size: 0.85rem; margin-bottom: 0; }
.admin-page .table th {
    color: #636e72; font-weight: 600; white-space: nowrap;
    border-bottom-width: 1px; padding: 8px 10px;
}
.admin-page .table td { padding: 8px 10px; vertical-align: middle; }
.admin-page .thumb-sm { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; background: #f1f2f6; }
.admin-page .badge-soft { font-size: 0.75rem; padding: 4px 10px; border-radius: 20px; }
.admin-page .badge-soft.on  { background: #e6f9ee; color: #00b894; }
.admin-page .badge-soft.off { background: #fdeeee; color: #d63031; }
.admin-page .badge-soft.mid { background: #fff6e5; color: #e17055; }
.admin-page .pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.admin-page .pager .page-link { color: #6c5ce7; }
.admin-page .pager .page-item.active .page-link { background: #6c5ce7; border-color: #6c5ce7; }
.admin-page .form-inline-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-page .btn-primary-soft {
    background: linear-gradient(135deg, #667eea, #764ba2); border: none; color: #fff;
}
.admin-page .btn-primary-soft:hover { opacity: 0.9; }
.admin-page .modal-body .form-label { font-size: 0.82rem; color: #636e72; }
