/* ============================================================
   沿海水产养殖防灾减损服务平台 - 全局样式
   海洋蓝主题 | 响应式(PC侧边栏 / 移动底部导航)
   ============================================================ */
:root {
    --primary: #0e7ac4;
    --primary-dark: #0a4d8c;
    --primary-light: #e8f3fb;
    --teal: #12b8a6;
    --bg: #eef4f9;
    --card: #ffffff;
    --text: #1f2d3d;
    --text-2: #5c6b7a;
    --text-3: #93a1b0;
    --border: #e2eaf2;
    --danger: #ef4444;
    --danger-hi: #b91c1c;
    --warn: #f59e0b;
    --ok: #10b981;
    --info: #3b82f6;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(14, 82, 148, .08);
    --shadow-hover: 0 8px 24px rgba(14, 82, 148, .14);
    --sidebar-w: 232px;
    --topbar-h: 60px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
.hidden { display: none !important; }
.text-muted { color: var(--text-2); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-primary { color: var(--primary); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.content { max-width: 1280px; margin: 0 auto; padding: 20px 22px 90px; }

/* ---------- 侧边栏 (PC) ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 100;
    background: linear-gradient(180deg, #0a4d8c 0%, #0e7ac4 60%, #12a5c4 100%);
    color: #fff; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px; padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.sidebar .brand .logo {
    width: 38px; height: 38px; border-radius: 10px; flex: none;
    background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.sidebar .brand b { font-size: 15px; line-height: 1.3; display: block; }
.sidebar .brand small { font-size: 11px; opacity: .8; }
.nav { padding: 10px 10px 20px; }
.nav .nav-title { font-size: 11px; opacity: .65; padding: 12px 10px 6px; letter-spacing: 1px; }
.nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 2px 0;
    border-radius: 9px; color: rgba(255,255,255,.85); font-size: 13.5px; transition: all .2s;
}
.nav a i { width: 20px; text-align: center; font-size: 15px; }
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav a.active { background: #fff; color: var(--primary-dark); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.nav a .badge-dot { margin-left: auto; }

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky; top: 0; z-index: 90; height: var(--topbar-h);
    background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .region-chip {
    display: flex; align-items: center; gap: 6px; background: var(--primary-light);
    color: var(--primary-dark); padding: 6px 12px; border-radius: 20px; font-size: 12.5px;
}
.topbar .user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.topbar .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--teal));
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.notice-bell { position: relative; font-size: 18px; color: var(--text-2); cursor: pointer; padding: 6px; }
.notice-bell .count {
    position: absolute; top: 0; right: -2px; min-width: 16px; height: 16px; border-radius: 8px;
    background: var(--danger); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid var(--border); overflow: hidden;
}
.card-hover { transition: all .25s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card .card-head {
    display: flex; align-items: center; gap: 10px; padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.card .card-head h3 { font-size: 15px; font-weight: 700; flex: 1; display: flex; align-items: center; gap: 8px; }
.card .card-head h3 i { color: var(--primary); }
.card .card-body { padding: 16px 18px; }
.card .card-body.no-pad { padding: 0; }
.card-title-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ---------- 统计卡 ---------- */
.stat-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; }
.stat-card .icon {
    width: 46px; height: 46px; border-radius: 12px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 21px; color: #fff;
}
.stat-card .num { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-card .label { font-size: 12.5px; color: var(--text-2); }
.bg-blue { background: linear-gradient(135deg, #3b82f6, #0e7ac4); }
.bg-teal { background: linear-gradient(135deg, #12b8a6, #0d9488); }
.bg-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-red { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.bg-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-gray { background: linear-gradient(135deg, #64748b, #475569); }
.bg-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* ---------- 风险徽章 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-ok { background: #e8f8f0; color: #047857; }
.badge-warn { background: #fef3e2; color: #b45309; }
.badge-danger { background: #feecec; color: #b91c1c; }
.badge-hi { background: #f5e3e3; color: #7f1d1d; }
.badge-info { background: #e8f1fd; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-teal { background: #e4f7f4; color: #0f766e; }
.risk-bar { height: 8px; border-radius: 4px; background: #e8eef4; overflow: hidden; }
.risk-bar i { display: block; height: 100%; border-radius: 4px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center;
    padding: 8px 16px; border-radius: 9px; border: 1px solid transparent;
    font-size: 13.5px; cursor: pointer; transition: all .2s; font-family: inherit;
    background: var(--primary); color: #fff; white-space: nowrap;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--ok); }
.btn-warn { background: var(--warn); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.form-group label .req { color: var(--danger); }
.form-control {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text); transition: border .2s, box-shadow .2s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,122,196,.12); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
    text-align: left; padding: 10px 12px; background: #f6fafd; color: var(--text-2);
    font-weight: 600; font-size: 12.5px; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f0f5f9; vertical-align: middle; }
.tbl tr:hover td { background: #fafdff; }
.tbl .num { font-weight: 700; }

/* ---------- 列表 ---------- */
.list-item {
    display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid #f0f5f9; align-items: flex-start;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-icon {
    width: 36px; height: 36px; border-radius: 10px; flex: none; display: flex;
    align-items: center; justify-content: center; font-size: 16px;
}
.list-item .li-title { font-weight: 600; font-size: 13.5px; }
.list-item .li-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.list-item .li-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ---------- 天气卡 ---------- */
.weather-hero {
    background: linear-gradient(135deg, #0a4d8c 0%, #0e7ac4 45%, #12a5c4 100%);
    color: #fff; border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden;
}
.weather-hero::after {
    content: ''; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px;
    border-radius: 50%; background: rgba(255,255,255,.08);
}
.weather-hero::before {
    content: ''; position: absolute; right: 60px; bottom: -70px; width: 160px; height: 160px;
    border-radius: 50%; background: rgba(255,255,255,.06);
}
.weather-hero .w-city { font-size: 14px; opacity: .9; display: flex; gap: 8px; align-items: center; }
.weather-hero .w-main { display: flex; align-items: center; gap: 20px; margin-top: 10px; }
.weather-hero .w-temp { font-size: 52px; font-weight: 800; line-height: 1; }
.weather-hero .w-desc { font-size: 17px; opacity: .95; }
.weather-hero .w-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 12.5px; opacity: .92; }
.weather-hero .w-meta span i { margin-right: 4px; opacity: .85; }

/* ---------- 登录页 ---------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #06395f 0%, #0a4d8c 40%, #0e7ac4 75%, #12a5c4 100%);
    padding: 20px; position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px;
    border-radius: 50%; background: rgba(255,255,255,.06);
}
.login-page::after {
    content: ''; position: absolute; left: -80px; bottom: -140px; width: 380px; height: 380px;
    border-radius: 50%; background: rgba(255,255,255,.05);
}
.login-box {
    width: 100%; max-width: 400px; background: #fff; border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 34px 32px; position: relative; z-index: 2;
}
.login-box .brand { text-align: center; margin-bottom: 24px; }
.login-box .brand .logo {
    width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--teal)); color: #fff;
    font-size: 28px; display: flex; align-items: center; justify-content: center;
}
.login-box .brand h1 { font-size: 19px; font-weight: 800; }
.login-box .brand p { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.tabs { display: flex; background: #f1f6fb; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tabs button {
    flex: 1; border: none; background: transparent; padding: 9px; border-radius: 8px;
    font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.tabs button.active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.demo-tip { background: var(--primary-light); border-radius: 9px; padding: 10px 12px; font-size: 12px; color: var(--primary-dark); margin-top: 16px; line-height: 1.7; }

/* ---------- 底部导航 (移动) ---------- */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 0; font-size: 10.5px; color: var(--text-3);
}
.bottom-nav a i { font-size: 19px; }
.bottom-nav a.active { color: var(--primary); font-weight: 700; }

/* ---------- AI 聊天 ---------- */
.chat-box { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 130px); min-height: 420px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { display: flex; gap: 10px; max-width: 86%; }
.chat-msg .avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex;
    align-items: center; justify-content: center; color: #fff; font-size: 15px;
}
.chat-msg .bubble {
    padding: 10px 14px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
}
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.user .avatar { background: linear-gradient(135deg, var(--primary), var(--teal)); }
.chat-msg.user .bubble { background: var(--primary); color: #fff; border-top-right-radius: 3px; }
.chat-msg.ai .avatar { background: linear-gradient(135deg, #64748b, #475569); }
.chat-msg.ai .bubble { background: #fff; border: 1px solid var(--border); border-top-left-radius: 3px; box-shadow: var(--shadow); }
.chat-input { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); background: #fff; }
.chat-quick { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px 0; }
.chat-quick .chip {
    padding: 5px 12px; border-radius: 16px; background: var(--primary-light); color: var(--primary-dark);
    font-size: 12px; cursor: pointer; border: none; font-family: inherit;
}
.chat-quick .chip:hover { background: #d8e9f7; }
.typing::after {
    content: '…'; animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 35, 55, .5); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 88vh;
    display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: modalIn .2s ease;
}
.modal-lg { max-width: 760px; }
@keyframes modalIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .m-head { display: flex; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal .m-head h3 { font-size: 15.5px; flex: 1; }
.modal .m-head .close { border: none; background: #f1f5f9; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--text-2); }
.modal .m-body { padding: 18px; overflow-y: auto; }
.modal .m-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
    background: #1f2d3d; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toastIn .25s ease; max-width: 86vw;
}
.toast.ok { background: #0d9488; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--text-3); }
.empty i { font-size: 40px; display: block; margin-bottom: 10px; opacity: .5; }
.loading { text-align: center; padding: 30px; color: var(--text-3); }
.spinner { display: inline-block; width: 26px; height: 26px; border: 3px solid var(--primary-light); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 信息条 ---------- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert i { margin-top: 2px; }
.alert-info { background: #e8f1fd; color: #1d4ed8; }
.alert-warn { background: #fef3e2; color: #92400e; }
.alert-danger { background: #feecec; color: #991b1b; }
.alert-ok { background: #e8f8f0; color: #065f46; }

/* ---------- 步骤条 ---------- */
.steps { display: flex; gap: 6px; margin: 4px 0 16px; }
.steps .step { flex: 1; text-align: center; font-size: 12px; color: var(--text-3); position: relative; }
.steps .step::before { content: ''; position: absolute; top: 13px; left: 0; right: 0; height: 2px; background: var(--border); z-index: 0; }
.steps .step:first-child::before { left: 50%; }
.steps .step:last-child::before { right: 50%; }
.steps .step .dot {
    width: 26px; height: 26px; border-radius: 50%; background: #e8eef4; color: var(--text-3);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
    position: relative; z-index: 1; margin-bottom: 4px;
}
.steps .step.done .dot, .steps .step.active .dot { background: var(--primary); color: #fff; }
.steps .step.done::before { background: var(--primary); }

/* ---------- 图例 ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c3d4e3; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 991px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .content { padding: 14px 12px 90px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-6 { grid-template-columns: repeat(3, 1fr); }
    .bottom-nav { display: flex; }
    .topbar { padding: 0 12px; height: 54px; }
    .topbar .page-title { font-size: 15px; }
    .weather-hero .w-temp { font-size: 40px; }
    .chat-msg { max-width: 94%; }
}
@media (max-width: 575px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .grid-6 { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .topbar .region-chip span.hide-xs { display: none; }
    .stat-card .num { font-size: 19px; }
    .content { padding: 12px 10px 84px; }
    .weather-hero { padding: 16px 18px; }
    .weather-hero .w-main { gap: 14px; }
}
