/* ============================================================
   LiLog Cloud - 全局深色主题样式
   移动优先 / 高性能 / 零依赖
   ============================================================ */

/* --- Reset & Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* 直接设置为深色主题变量 */
    --primary: #3b82f6;
    --primary-light: #2563eb20;
    --success: #5CDD8B;
    --danger: #DC3545;
    --warning: #ffc107;
    --bg: #121212;               /* 全局背景色 */
    --card-bg: #1e1e1e;          /* 卡片背景色 */
    --text: #f3f4f6;             /* 主要文字色 */
    --text-muted: #9ca3af;       /* 次要文字色 */
    --border: #374151;           /* 边框色 */
    --input-bg: #2d2d2d;         /* 输入框背景色 */
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 15px rgba(0,0,0,0.2); /* 深色模式阴影更重 */
    --header-h: 56px;
    --nav-h: 60px;
    --transition: 0.2s ease;
}

html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding-bottom: calc(var(--nav-h) + 20px);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* --- Utilities --- */
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 2px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.me-2 { margin-right: 8px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.py-20 { padding-top: 20px; padding-bottom: 20px; }
.p-0 { padding: 0 !important; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-70 { width: 70%; }
.w-90 { width: 90%; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-start { text-align: left; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: #0dcaf0 !important; }
.text-secondary { color: #6b7280 !important; }
.text-muted { color: var(--text-muted) !important; }
.text-dark { color: var(--text) !important; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: 0.8rem; }
.pos-relative { position: relative; }
.z-1 { position: relative; z-index: 1; }
.overflow-hidden { overflow: hidden; }
.fs-20 { font-size: 20px; }

.flex-row { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.items-center { align-items: center; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* --- Header --- */
.app-header {
    background: var(--card-bg);
    height: var(--header-h);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.app-logo {
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo img { height: 28px; width: auto; }

.pc-nav { display: none; }

@media (min-width: 768px) {
    .pc-nav {
        display: flex !important;
        gap: 24px;
        margin-left: auto;
    }
    .pc-nav a {
        color: var(--text-muted);
        font-weight: 500;
        transition: color var(--transition);
    }
    .pc-nav a:hover, .pc-nav a.active { color: var(--primary); }
    .bottom-nav { display: none !important; }
    .tab-content { max-width: 800px; margin: 20px auto; }
}

/* --- Bottom Nav --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--nav-h);
    background: rgba(30,30,30,0.98);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-btn {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 33%;
    cursor: pointer;
    transition: color 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn i { font-size: 22px; margin-bottom: 4px; }
.nav-btn.active { color: var(--primary); font-weight: 600; }

/* --- Tab Content --- */
.tab-content {
    display: none;
    padding: 15px;
    animation: fadeIn 0.15s ease;
}

.tab-content.active { display: block; }

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

/* --- Card --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    border: none;
    position: relative;
    overflow: visible;
}

.card-dashed {
    background: var(--card-bg) !important;
    border: 2px dashed #666 !important;
    box-shadow: none !important;
}

/* --- Deco Images --- */
.deco-img {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    width: 65px;
}

.deco-bl { bottom: 0; left: 0; }
.deco-br { bottom: 0; right: 0; width: 70px; }

/* --- Input / Select --- */
.input, .select {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), background var(--transition);
    -webkit-appearance: none;
}

.input:focus, .select:focus {
    border-color: #4b5563;
    background: var(--card-bg);
}

.input-sm { padding: 7px 10px; font-size: 0.85rem; }

.label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.3); }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: var(--success); color: #fff; }
.btn-light { background: var(--border); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { background: var(--input-bg); }
.btn-outline-danger { background: var(--card-bg); border: 1px solid rgba(220,53,69,0.3); color: var(--danger); box-shadow: var(--shadow); }

.btn-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 16px;
}

/* --- Switch --- */
.switch-wrap {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 42px;
    border: 1px solid var(--border);
    gap: 6px;
    cursor: pointer;
}

.switch-wrap input[type="checkbox"] {
    width: 36px; height: 20px;
    appearance: none; -webkit-appearance: none;
    background: #4b5563;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.switch-wrap input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch-wrap input[type="checkbox"]:checked { background: var(--primary); }
.switch-wrap input[type="checkbox"]:checked::after { transform: translateX(16px); }
.switch-label { font-size: 0.85rem; font-weight: 700; }

.switch-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.switch-inline input[type="checkbox"] {
    width: 36px; height: 20px;
    appearance: none; -webkit-appearance: none;
    background: #4b5563;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.switch-inline input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch-inline input[type="checkbox"]:checked { background: var(--primary); }
.switch-inline input[type="checkbox"]:checked::after { transform: translateX(16px); }

/* --- Progress Bar --- */
.progress-bar-track {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.progress-bar-fill.danger { background: var(--danger); }

/* --- Badge --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge-muted { background: var(--input-bg); color: var(--text-muted); }

/* --- List Item --- */
.list-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background var(--transition);
}

.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--input-bg); }

/* --- Auth --- */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: none;
    background: none;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.auth-pane { display: none; }
.auth-pane.active { display: block; animation: fadeIn 0.2s ease; }

/* --- Alert --- */
.alert-error {
    background: rgba(220,53,69,0.15);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-align: center;
}

.alert-warn {
    background: rgba(255,193,7,0.15);
    color: #fbbf24;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

/* --- Avatar --- */
.avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    color: #fff;
    font-weight: bold;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* --- VIP Badge --- */
.vip-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 5px;
    display: inline-block;
}

.vip-on { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.vip-off { background: var(--border); color: var(--text-muted); }

/* --- Plan Card --- */
.plan-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--input-bg);
}

.plan-pro {
    border-color: var(--warning);
    background: rgba(255,193,7,0.15);
}

.hot-tag {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.qr-img {
    max-width: 200px;
    border-radius: 8px;
    margin: 0 auto 8px;
}

/* --- Box Light --- */
.box-light {
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    padding: 12px;
}

/* --- Footer --- */
.footer-copyright {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 30px;
    padding-bottom: 12px;
}

.footer-copyright strong { color: var(--text-muted); }

/* ============================================================
   Monitor Items
   ============================================================ */

.monitor-item {
    padding: 16px;
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.monitor-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

.monitor-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    line-height: 1;
}

.bg-up { background-color: var(--success); }
.bg-down { background-color: var(--danger); }
.bg-warn { background-color: var(--warning); color: #fff; }

.monitor-name {
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
    font-size: 0.95rem;
}

.ssl-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ssl-badge:active { transform: scale(0.95); }
.ssl-safe { background: rgba(16,185,129,0.2); color: #10b981; }
.ssl-warn { background: rgba(245,158,11,0.2); color: #f59e0b; }
.ssl-danger { background: rgba(220,38,38,0.2); color: #dc2626; }
.ssl-gray { background: var(--input-bg); color: var(--text-muted); }

.keyword-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.monitor-latency {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    white-space: nowrap;
}

.monitor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Dropdown --- */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: var(--input-bg);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background var(--transition);
}

.dropdown-toggle:active { background: var(--border); }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    min-width: 100px;
    z-index: 50;
    overflow: hidden;
    margin-top: 4px;
}

.dropdown-menu.show { display: block; animation: fadeIn 0.15s; }

.dropdown-menu-item {
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
    display: block;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    color: var(--text);
}

.dropdown-menu-item:active { background: var(--input-bg); }
.dropdown-menu-item.danger { color: var(--danger); }

/* --- Bars --- */
.bars-container {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 35px;
    width: 100%;
    overflow: visible;
    padding-bottom: 2px;
    position: relative;
}

.bar {
    flex: 1;
    min-width: 4px;
    border-radius: 3px;
    transition: all 0.15s;
    opacity: 0.85;
    cursor: pointer;
    position: relative;
}

.bar:hover { opacity: 1; transform: scaleY(1.15); z-index: 2; }
.bar:active { opacity: 0.6; }

.bar-up { background: var(--success); }
.bar-down { background: var(--danger); }
.bar-empty { background: var(--border); }

/* --- Bar Popover --- */
.bar-popover {
    position: absolute;
    background: #121212;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    line-height: 1.2;
    bottom: 45px;
    left: 0;
    white-space: nowrap;
    z-index: 60;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    font-family: monospace;
    pointer-events: none;
}

.bar-popover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: var(--arrow-x, 50%);
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #121212 transparent transparent transparent;
}

/* --- Skeleton --- */
.skeleton-card { pointer-events: none; }

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #2d2d2d 25%, #374151 50%, #2d2d2d 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-badge {
    width: 48px;
    height: 22px;
    background: linear-gradient(90deg, #2d2d2d 25%, #374151 50%, #2d2d2d 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 20px;
}

.skeleton-bars {
    height: 35px;
    background: linear-gradient(90deg, #2d2d2d 25%, #374151 50%, #2d2d2d 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   Modal System (零依赖, 替代 Bootstrap Modal)
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.15s;
}

.modal-box {
    display: none;
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalIn 0.2s ease;
}

.modal-box.active { display: block; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

.modal-body { padding: 20px; }
.modal-footer { padding: 10px 20px 20px; }

/* --- Article Card --- */
.article-card {
    display: block;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.02);
    transition: transform var(--transition);
}

.article-card:active { transform: scale(0.99); }

.article-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.article-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    flex-shrink: 0;
}

.article-text { flex: 1; overflow: hidden; }

.article-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.3;
}

.article-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Responsive --- */
@media (max-width: 400px) {
    .card { padding: 15px; }
    .deco-img { width: 50px !important; opacity: 0.5 !important; }
    .monitor-name { font-size: 0.85rem; }
    .article-img { width: 60px; height: 60px; }
    .nav-btn i { font-size: 20px; }
    .nav-btn span { font-size: 9px; }
}