
/* =========================================================
   PyMonitor Tech 2.0 - Complete UI Theme
   Dark Tech / Responsive / Cyan Blue
   只负责视觉，不改变监控逻辑
========================================================= */

:root {
    --bg: #080d18;
    --bg-deep: #060a12;
    --surface: #101a2b;
    --surface-2: #142137;
    --surface-3: #192941;
    --border: rgba(133, 170, 215, .14);
    --border-hover: rgba(67, 190, 255, .42);

    --text: #eaf2ff;
    --muted: #8294ad;
    --subtle: #52647d;

    --blue: #459cff;
    --cyan: #42d9f5;
    --green: #35dfa3;
    --red: #ff627c;
    --yellow: #ffc66d;
    --purple: #9d8bff;

    --radius: 16px;
    --radius-sm: 11px;

    --shadow:
        0 12px 35px rgba(0, 0, 0, .22);

    --glow:
        0 0 25px rgba(66, 217, 245, .10);
}

/* ---------- 基础 ---------- */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(ellipse at 15% 0%, rgba(38, 102, 175, .15), transparent 38%),
        radial-gradient(ellipse at 95% 25%, rgba(31, 174, 194, .08), transparent 35%),
        var(--bg);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Microsoft YaHei",
        sans-serif;
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: .2s ease;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

::selection {
    color: #fff;
    background: rgba(69, 156, 255, .45);
}

/* ---------- 背景光效 ---------- */

.ambient {
    position: fixed;
    z-index: -1;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    opacity: .12;
}

.ambient.a1 {
    top: -180px;
    left: -150px;
    background: #268dff;
}

.ambient.a2 {
    right: -180px;
    bottom: -180px;
    background: #18c9d8;
}

/* ---------- 顶部导航 ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 5%;
    background: rgba(8, 13, 24, .88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: #f2f7ff;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.5px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(66, 217, 245, .35);
    border-radius: 11px;
    color: var(--cyan);
    background: linear-gradient(145deg, rgba(69, 156, 255, .20), rgba(66, 217, 245, .07));
    box-shadow: 0 0 20px rgba(66, 217, 245, .12);
    font-size: 22px;
}

.brand .accent {
    color: var(--cyan);
}

.brand small {
    display: none;
}

/* 品牌只显示图标和 PyMonitor */
.brand > span:not(.brand-icon) {
    font-size: 0;
}

.brand > span:not(.brand-icon)::before {
    content: "PyMonitor";
    font-size: 19px;
    color: #f2f7ff;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #a7b7cc;
    font-size: 13px;
    font-weight: 600;
}

.topbar nav a:hover {
    color: #fff;
    border-color: var(--border);
    background: rgba(69, 156, 255, .09);
}

/* 设置入口固定在左下角 */
.topbar nav a[href*="settings"] {
    position: fixed;
    z-index: 80;
    left: 22px;
    bottom: 22px;
    min-height: 46px;
    padding: 10px 17px;
    border: 1px solid rgba(66, 217, 245, .30);
    border-radius: 13px;
    color: #d9f7ff;
    background: rgba(16, 32, 51, .96);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
    backdrop-filter: blur(15px);
}

.topbar nav a[href*="settings"]::before {
    content: "⚙";
    margin-right: 9px;
    color: var(--cyan);
    font-size: 17px;
}

.topbar nav a[href*="settings"]:hover {
    border-color: var(--cyan);
    background: #172d45;
}

/* ---------- 主内容 ---------- */

.wrap {
    width: min(1160px, 90%);
    min-height: calc(100vh - 130px);
    margin: 0 auto;
    padding: 36px 0 65px;
}

h1,
h2,
h3,
h4 {
    margin-top: 0;
    color: var(--text);
    line-height: 1.35;
}

h1 {
    font-size: clamp(25px, 4vw, 34px);
    letter-spacing: -.8px;
}

h2 {
    font-size: 21px;
}

h3 {
    font-size: 16px;
}

p {
    color: #a5b5ca;
}

.muted {
    color: var(--muted);
}

.accent {
    color: var(--cyan);
}

.eyebrow {
    margin-bottom: 12px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ---------- 页面标题 ---------- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding: 27px 30px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 19px;
    background:
        radial-gradient(circle at 90% 10%, rgba(66, 217, 245, .13), transparent 35%),
        linear-gradient(120deg, #111f34, #101a2b 65%, #10243a);
    box-shadow: var(--shadow);
}

.hero::after {
    content: "";
    position: absolute;
    right: -45px;
    bottom: -100px;
    width: 240px;
    height: 240px;
    border: 1px solid rgba(66, 217, 245, .12);
    border-radius: 50%;
    box-shadow:
        0 0 0 25px rgba(66, 217, 245, .025),
        0 0 0 50px rgba(66, 217, 245, .02);
    pointer-events: none;
}

.hero h1 {
    margin-bottom: 8px;
}

.hero p {
    margin-bottom: 0;
}

.hero-side {
    position: relative;
    z-index: 1;
    color: var(--cyan);
    font-size: 13px;
    font-weight: 700;
}

/* ---------- 统计卡片 ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat {
    position: relative;
    min-width: 0;
    padding: 21px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #142239, #101a2b);
    box-shadow: var(--shadow);
    transition: transform .22s ease, border-color .22s ease;
}

.stat:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
}

.stat::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -45px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(69, 156, 255, .08);
    filter: blur(12px);
}

.stat > * {
    position: relative;
    z-index: 1;
}

.stat .label,
.stat small {
    color: var(--muted);
    font-size: 12px;
}

.stat strong,
.stat .value {
    display: block;
    margin-top: 7px;
    color: #f1f7ff;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat.good strong,
.stat.good .value {
    color: var(--green);
}

.stat.bad strong,
.stat.bad .value {
    color: var(--red);
}

/* ---------- 区块标题 ---------- */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin: 30px 0 17px;
}

.section-head h2,
.section-head h3 {
    margin: 0;
}

.section-head p {
    margin: 4px 0 0;
    font-size: 12px;
}

/* ---------- 通用面板 ---------- */

.panel {
    padding: 23px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(20, 34, 55, .96), rgba(14, 24, 40, .96));
    box-shadow: var(--shadow);
}

.add-panel {
    margin-bottom: 25px;
}

.add-form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}

.add-form .grow {
    flex: 1 1 200px;
    min-width: 0;
}

/* ---------- 表单 ---------- */

label {
    display: block;
    margin: 0 0 7px;
    color: #b9c8dc;
    font-size: 13px;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 13px;
    outline: none;
    color: #edf5ff;
    border: 1px solid rgba(132, 163, 203, .22);
    border-radius: 10px;
    background: #0b1423;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

input::placeholder,
textarea::placeholder {
    color: #62748d;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--cyan);
    background: #0e1b2d;
    box-shadow: 0 0 0 3px rgba(66, 217, 245, .10);
}

select option {
    color: #fff;
    background: #101a2b;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* ---------- 按钮 ---------- */

.btn,
button {
    transition: .2s ease;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 41px;
    padding: 9px 17px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #dceaff;
    background: #1a2b43;
    font-weight: 700;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
    background: #203955;
}

.btn.primary {
    color: #04131c;
    border-color: transparent;
    background: linear-gradient(110deg, #48b6ff, #42e0e4);
    box-shadow: 0 5px 18px rgba(66, 190, 245, .18);
}

.btn.primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 7px 24px rgba(66, 190, 245, .28);
}

.btn.full {
    width: 100%;
}

.btn.danger {
    color: #ff9baa;
    border-color: rgba(255, 98, 124, .25);
    background: rgba(255, 98, 124, .09);
}

/* ---------- 监控列表 ---------- */

.monitor-list {
    display: grid;
    gap: 13px;
}

.monitor-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
    padding: 19px 21px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: linear-gradient(110deg, #142239, #101b2d);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
    transition: transform .2s, border-color .2s, background .2s;
}

.monitor-card:hover {
    transform: translateY(-2px);
    border-color: rgba(69, 156, 255, .38);
    background: linear-gradient(110deg, #172943, #122139);
}

.monitor-card::after {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 5px 5px 0;
    background: var(--blue);
    opacity: .75;
}

.monitor-card:has(.status-orb.up)::after {
    background: var(--green);
}

.monitor-card:has(.status-orb.down)::after {
    background: var(--red);
}

.monitor-card:has(.status-orb.paused)::after {
    background: var(--yellow);
}

.monitor-main {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 15px;
    min-width: 0;
}

.monitor-name {
    margin: 0 0 4px;
    color: #edf5ff;
    font-size: 15px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.url {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #8298b5;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 15px;
    margin-top: 9px;
    color: #8fa2bb;
    font-size: 11px;
}

.monitor-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 85px;
    padding: 7px 11px;
    border: 1px solid rgba(53, 223, 163, .18);
    border-radius: 20px;
    color: var(--green);
    background: rgba(53, 223, 163, .08);
    font-size: 12px;
    font-weight: 750;
}

.monitor-state.down {
    color: var(--red);
    border-color: rgba(255, 98, 124, .22);
    background: rgba(255, 98, 124, .08);
}

.monitor-state.paused {
    color: var(--yellow);
    border-color: rgba(255, 198, 109, .22);
    background: rgba(255, 198, 109, .08);
}

/* ---------- 状态圆点 ---------- */

.status-orb {
    position: relative;
    display: inline-block;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 12px rgba(255, 198, 109, .35);
}

.status-orb.up {
    background: var(--green);
    box-shadow: 0 0 13px rgba(53, 223, 163, .65);
}

.status-orb.down {
    background: var(--red);
    box-shadow: 0 0 13px rgba(255, 98, 124, .55);
}

.status-orb.pending {
    background: var(--yellow);
}

.status-orb.paused {
    background: #8b9bb0;
    box-shadow: none;
}

.status-orb.up::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(53, 223, 163, .45);
    border-radius: 50%;
    animation: status-pulse 2s infinite;
}

.status-orb.down::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(255, 98, 124, .35);
    border-radius: 50%;
}

@keyframes status-pulse {
    0% {
        transform: scale(.7);
        opacity: .9;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* ---------- 操作按钮 ---------- */

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
    flex-shrink: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: #a9bbd2;
    background: rgba(255, 255, 255, .025);
}

.icon-btn:hover {
    color: #fff;
    border-color: var(--border-hover);
    background: rgba(69, 156, 255, .12);
}

/* ---------- 故障事件 ---------- */

.incident-list {
    display: grid;
    gap: 10px;
}

.incident-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(16, 26, 43, .72);
}

.incident-mark {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 10px rgba(255, 98, 124, .45);
}

/* ---------- 登录页面 ---------- */

body:has(.login-shell) {
    background:
        radial-gradient(ellipse at 50% 15%, rgba(42, 119, 194, .20), transparent 45%),
        radial-gradient(ellipse at 10% 90%, rgba(25, 193, 207, .09), transparent 35%),
        var(--bg-deep);
}

body:has(.login-shell) .topbar {
    justify-content: flex-start;
}

body:has(.login-shell) .topbar nav {
    display: none;
}

.login-shell {
    width: min(440px, 100%);
    margin: 65px auto 30px;
    padding: 36px;
    border: 1px solid rgba(104, 164, 216, .22);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(20, 35, 57, .97), rgba(11, 21, 36, .98));
    box-shadow:
        0 25px 80px rgba(0, 0, 0, .38),
        0 0 45px rgba(66, 190, 245, .06);
}

.login-shell h1 {
    margin: 0 0 8px;
    font-size: 31px;
}

.login-shell > p {
    margin: 0 0 27px;
    font-size: 13px;
}

.login-shell .form {
    display: grid;
    gap: 12px;
    padding: 22px;
}

.login-shell .form label {
    margin-bottom: -7px;
}

.login-shell .form button {
    margin-top: 10px;
}

.login-shell .tiny {
    margin-top: 23px;
    text-align: center;
    font-size: 10px;
    letter-spacing: 2px;
}

/* ---------- 详情 / 设置 / 状态页 ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    color: #d9e7f8;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: #91a6c1;
    background: rgba(69, 156, 255, .05);
    font-size: 12px;
    font-weight: 700;
}

td {
    font-size: 13px;
}

tr:hover td {
    background: rgba(69, 156, 255, .035);
}

form {
    max-width: 100%;
}

form .panel {
    margin-bottom: 18px;
}

.flash {
    margin: 0 0 17px;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #dceaff;
    background: #14243a;
}

.flash.success {
    color: var(--green);
    border-color: rgba(53, 223, 163, .25);
    background: rgba(53, 223, 163, .07);
}

.flash.error,
.flash.danger {
    color: #ff9baa;
    border-color: rgba(255, 98, 124, .25);
    background: rgba(255, 98, 124, .07);
}

/* ---------- 底部 ---------- */

footer {
    padding: 20px 15px 25px;
    color: #60738d;
    text-align: center;
    font-size: 10px;
    letter-spacing: 1.4px;
}

footer span {
    margin: 0 6px;
    color: var(--cyan);
}

footer small {
    margin-left: 8px;
    color: #53647b;
}

.pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 9px var(--green);
}

/* ---------- 滚动条 ---------- */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #080d18;
}

::-webkit-scrollbar-thumb {
    border: 2px solid #080d18;
    border-radius: 10px;
    background: #2b405c;
}

::-webkit-scrollbar-thumb:hover {
    background: #42658d;
}

/* ---------- 平板 ---------- */

@media (max-width: 900px) {
    .wrap {
        width: 92%;
        padding-top: 25px;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        padding: 23px;
    }

    .monitor-card {
        flex-wrap: wrap;
    }

    .monitor-main {
        flex-basis: 100%;
    }

    .monitor-state {
        margin-left: 27px;
    }

    .actions {
        margin-left: auto;
    }
}

/* ---------- 手机 ---------- */

@media (max-width: 650px) {
    body {
        font-size: 13px;
    }

    .topbar {
        min-height: 59px;
        padding: 0 17px;
    }

    .brand {
        font-size: 17px;
    }

    .brand-icon {
        width: 33px;
        height: 33px;
        font-size: 19px;
    }

    .brand > span:not(.brand-icon)::before {
        font-size: 17px;
    }

    .topbar nav {
        gap: 3px;
    }

    .topbar nav a {
        min-height: 34px;
        padding: 6px 8px;
        font-size: 11px;
    }

    .topbar nav a[href*="settings"] {
        left: 13px;
        bottom: 14px;
        min-height: 43px;
        padding: 8px 13px;
    }

    .wrap {
        width: auto;
        margin: 0 15px;
        padding: 22px 0 75px;
    }

    .hero {
        display: block;
        margin-bottom: 19px;
        padding: 21px 19px;
        border-radius: 15px;
    }

    .hero h1 {
        font-size: 25px;
    }

    .hero-side {
        margin-top: 15px;
    }

    .stats {
        gap: 10px;
        margin-bottom: 23px;
    }

    .stat {
        padding: 15px;
        border-radius: 13px;
    }

    .stat strong,
    .stat .value {
        font-size: 25px;
    }

    .section-head {
        margin: 23px 0 13px;
    }

    .section-head h2 {
        font-size: 18px;
    }

    .panel {
        padding: 17px;
        border-radius: 14px;
    }

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

    .add-form .grow {
        width: 100%;
    }

    .monitor-list {
        gap: 10px;
    }

    .monitor-card {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 12px;
        padding: 16px 14px 16px 17px;
        border-radius: 13px;
    }

    .monitor-main {
        grid-column: 1 / -1;
        gap: 12px;
    }

    .monitor-name {
        font-size: 14px;
    }

    .monitor-state {
        grid-column: 1;
        justify-self: start;
        margin-left: 24px;
        min-width: 0;
        padding: 6px 10px;
        font-size: 11px;
    }

    .actions {
        grid-column: 2;
        justify-content: flex-end;
        gap: 5px;
    }

    .icon-btn {
        min-width: 31px;
        min-height: 31px;
        padding: 5px 7px;
        font-size: 12px;
    }

    .login-shell {
        width: auto;
        margin: 40px 15px 25px;
        padding: 24px 18px;
        border-radius: 17px;
    }

    .login-shell h1 {
        font-size: 27px;
    }

    .login-shell .form {
        padding: 17px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    footer {
        padding-bottom: 75px;
        font-size: 9px;
    }
}

/* ---------- 小屏手机 ---------- */

@media (max-width: 380px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat {
        padding: 12px;
    }

    .stat strong,
    .stat .value {
        font-size: 22px;
    }

    .monitor-card {
        padding: 14px 11px 14px 14px;
    }

    .meta {
        gap: 5px 9px;
    }
}
