/* ========== 智能井盖管理平台 - 后台共享布局样式 ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f0f2f5;
}

/* ---------- 顶部 Logo 条（占满整个页面顶部，科技横幅底图；左侧品牌，右侧警报+用户） ---------- */
.logo-bar {
    height: 80px;
    min-height: 80px;
    background: url('/logo-banner.png') center/cover no-repeat;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.logo-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 34px;
    font-weight: bold;
    white-space: nowrap;
}

.logo-bar-brand .logo-mark {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 6px;
    object-fit: contain;
    display: block;
}

.logo-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* LOGO 栏深色背景上的铃铛与用户区域：白色保证可读性 */
.logo-bar .topbar-bell {
    color: rgba(255, 255, 255, 0.85);
}

.logo-bar .topbar-bell:hover {
    color: #fff;
}

.logo-bar .topbar-user:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.logo-bar .user-name {
    color: #fff;
}

.admin-layout {
    display: flex;
    height: calc(100vh - 80px);
    overflow: hidden;
}

/* ---------- 左侧深色导航栏 ---------- */
.admin-sidebar {
    width: 220px;
    min-width: 220px;
    background-color: #001529;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, min-width 0.25s ease;
    overflow: hidden;
}

.admin-sidebar.collapsed {
    width: 64px;
    min-width: 64px;
}

/* 品牌区已移除，其内容（图标+平台名）移入右侧 LOGO 栏左侧；
   菜单直接通顶，顶部加 padding 避免第一个菜单项贴边 */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0 8px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.menu-item,
.menu-group-title {
    display: flex;
    align-items: center;
    height: 46px;
    padding: 0 20px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
}

.menu-item:hover,
.menu-group-title:hover {
    color: #fff;
}

.menu-item.active {
    background-color: #1890ff;
    color: #fff;
}

.menu-item .menu-icon,
.menu-group-title .menu-icon {
    width: 20px;
    min-width: 20px;
    height: 20px;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.admin-sidebar.collapsed .menu-item,
.admin-sidebar.collapsed .menu-group-title {
    padding: 0 22px;
}

.admin-sidebar.collapsed .menu-item .menu-text,
.admin-sidebar.collapsed .menu-group-title .menu-text,
.admin-sidebar.collapsed .menu-group-title .menu-arrow {
    display: none;
}

.menu-group .menu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
    display: inline-flex;
    align-items: center;
}

.menu-group.expanded .menu-arrow {
    transform: rotate(90deg);
}

.menu-sub {
    display: none;
    background-color: #000c17;
}

.menu-group.expanded .menu-sub {
    display: block;
}

.menu-sub .menu-item {
    padding-left: 52px;
    height: 40px;
    font-size: 13px;
}

/* ---------- 右侧主区域 ---------- */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: 60px;
    min-height: 60px;
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 10;
}

.topbar-toggle {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: #595959;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-toggle:hover {
    background-color: #f0f2f5;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #262626;
    white-space: nowrap;
}

.topbar-search {
    flex: 1;
    max-width: 360px;
    margin-left: 16px;
}

.topbar-search input {
    width: 100%;
    height: 34px;
    border: 1px solid #d9d9d9;
    border-radius: 17px;
    padding: 0 16px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.topbar-search input:focus {
    border-color: #1890ff;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 消息铃铛 */
.topbar-bell {
    position: relative;
    cursor: pointer;
    color: #595959;
    font-size: 20px;
    padding: 4px;
    text-decoration: none;
}

.topbar-bell:hover {
    color: #1890ff;
}

.topbar-bell .bell-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background-color: #f5222d;
    color: #fff;
    font-size: 11px;
    text-align: center;
    display: none;
}

.topbar-bell .bell-badge.show {
    display: block;
}

/* 存在待处理报警时铃铛摇摆闪动 */
.topbar-bell.has-alert {
    animation: bell-ring 1s ease-in-out infinite;
    transform-origin: top center;
}
.logo-bar .topbar-bell.has-alert {
    color: #ffa39e;
}
@keyframes bell-ring {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-14deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(6deg); }
    60% { transform: rotate(-6deg); }
    70% { transform: rotate(2deg); }
    80% { transform: rotate(-2deg); }
}

/* 用户下拉 */
.topbar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.topbar-user:hover {
    background-color: #f0f2f5;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #1890ff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.user-name {
    font-size: 14px;
    color: #262626;
}

.user-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    width: 160px;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    display: none;
    z-index: 100;
}

.topbar-user.open .user-dropdown {
    display: block;
}

.user-dropdown .dropdown-info {
    padding: 8px 16px;
    font-size: 12px;
    color: #8c8c8c;
    border-bottom: 1px solid #f0f0f0;
}

.user-dropdown .dropdown-item {
    display: block;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    padding: 10px 16px;
    font-size: 13px;
    color: #262626;
    cursor: pointer;
}

.user-dropdown .dropdown-item:hover {
    background-color: #f5f5f5;
    color: #f5222d;
}

/* ---------- 内容区 ---------- */
.admin-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
    min-height: 0;
}

/* 通用页面卡片 */
.page-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.06);
}

/* 未登录跳转遮罩 */
.auth-loading-mask {
    position: fixed;
    inset: 0;
    background-color: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: #8c8c8c;
    font-size: 14px;
}
