/* css/style.css */
/* 全局设定重置与字体排版 */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8fafc; /* slate-50 */
    color: #0f172a; /* slate-900 (高对比度深色文本) */
    overflow-x: hidden;
}

.map-container {
    width: 95%;
    max-width: 1200px;
    margin: 40px auto;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05); /* 优雅且柔和的阴影 */
    border-radius: 12px;
    padding: 24px;
    position: relative;
}

.header-title {
    font-size: 24px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 8px;
    color: #1e293b; /* slate-800 */
}

.header-subtitle {
    color: #475569; /* slate-600 (柔和的副标题颜色) */
    font-size: 14px;
    margin-bottom: 24px;
}

/* =========================================
   SVG 地图核心样式
   ========================================= */
.svg-map {
    width: 100%;
    height: auto;
    border: 1px solid #e2e8f0; /* slate-200 */
    border-radius: 8px;
    background-color: #ffffff;
    
    /* 轻质网格背景辅助对齐 */
    background-size: 20px 20px;
    background-image: linear-gradient(to right, #f1f5f9 1px, transparent 1px),
                      linear-gradient(to bottom, #f1f5f9 1px, transparent 1px);
}

/* 房间图块与建筑底图基础样式 */
.room-group, .floor-bg-group {
    cursor: pointer; /* 交互元素必须提供手型光标 */
}

.floor-bg-group {
    cursor: default; /* 背景不可交互 */
}

.floor-bg-rect {
    fill: #f1f5f9;       /* slate-100: 浅灰色代表整体建筑轮廓 */
    stroke: #e2e8f0;     /* slate-200 */
    stroke-width: 4;     /* 较粗的边框，体现外墙 */
    pointer-events: none; /* 事件穿透，防止阻碍背后的 svgMap 接收点击取消事件 */
}

.room-rect {
    fill: #f8fafc;       /* slate-50 */
    stroke: #cbd5e1;     /* slate-300 */
    stroke-width: 2;
    transition: fill 0.2s ease, stroke-width 0.2s ease, stroke 0.2s ease; /* 流畅微交互 */
}

/* 文本居中与基础字体 */
.room-text {
    fill: #334155;       /* slate-700 */
    font-size: 16px;
    font-weight: 500;
    text-anchor: middle;     /* 水平居中 */
    dominant-baseline: central; /* 垂直居中 */
    pointer-events: none; /* 穿透文字点击，防止事件阻断 */
    user-select: none;    /* 防选中 */
}

/* === 状态反馈 (Hover & Active) === */
.room-group:hover .room-rect {
    fill: #f0f9ff;       /* sky-50: 轻微淡蓝背景 */
    stroke: #7dd3fc;     /* sky-300 */
    stroke-width: 3;
}

.room-group.active .room-rect {
    fill: #e0f2fe;       /* sky-100: 激活时的蓝色 */
    stroke: #0284c7;     /* sky-600 */
    stroke-width: 3;
}
.room-group.active .room-text {
    fill: #0c4a6e;       /* sky-900: 文字也变深蓝 */
    font-weight: 600;
}

/* === LED 显示屏特殊样式 === */
.led-rect {
    fill: #dc2626;           /* 纯红色填充 */
    stroke: #991b1b;         /* 深红描边 */
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px rgba(220, 38, 38, 0.4));
}
.room-rect.led-rect {
    fill: rgba(220, 38, 38, 0.2);
    stroke: #dc2626;
}
.room-rect.led-rect:hover {
    fill: rgba(220, 38, 38, 0.4);
}
.room-group.led-device text { fill: #fca5a5; font-weight: bold; }

/* 门 / 通道 特有样式 */
.room-rect.door-rect {
    fill: #fcd34d;
    stroke: #d97706;
}
.room-rect.door-rect:hover {
    fill: #fde68a;
    transform: none; /* 悬停时门不放大 */
    filter: none;
}
.room-group.door-device text { fill: #92400e; font-weight: bold; font-size: 13px; }

.led-text {
    fill: #ffffff;
    font-size: 9px;
    font-weight: 700;
    writing-mode: vertical-rl;  /* 竖排文字，适应窄条形状 */
    letter-spacing: 1px;
}
.led-device:hover .led-rect {
    fill: #ef4444;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
    stroke-width: 2;
}
.led-device.active .led-rect {
    fill: #b91c1c;
    filter: drop-shadow(0 0 10px rgba(185, 28, 28, 0.7));
}


/* =========================================
   玻璃态 (Glassmorphism) 信息浮窗 
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4); /* 暗色的毛玻璃背景辅助 */
    backdrop-filter: blur(4px); /* 背景模糊 */
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.room-modal {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 360px;
    
    /* 玻璃态风格 (Glassmorphism) */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    border-radius: 12px;
    z-index: 100;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Modal 显示状态 */
.room-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.modal-overlay.show {
    opacity: 1;
}

.modal-header {
    background: #f8fafc; /* slate-50 */
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

.modal-content {
    padding: 20px;
    line-height: 1.6;
}

.info-row {
    margin-bottom: 12px;
    font-size: 14px;
    color: #475569;     /* slate-600 */
}
.info-row strong {
    color: #1e293b;     /* slate-800 */
    font-weight: 600;
}
.info-row span {
    word-break: break-all;
}

.device-section {
    margin-top: 20px;
}
.device-header {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;     /* slate-500 */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

/* 设备明细资料卡片 */
.device-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.device-name-header {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #cbd5e1;
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dev-info-line {
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.4;
}

.dev-label {
    color: #475569;
}

.dev-val {
    color: #1e293b;
    font-weight: 500;
}

.dev-val.link {
    color: #0ea5e9; /* sky-500 */
    text-decoration: none;
    cursor: pointer;
}

.dev-val.link:hover {
    text-decoration: underline;
    color: #0284c7; /* sky-600 */
}

/* 关闭按钮 */
.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8; /* slate-400 */
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    line-height: 1;
}
.close-btn:hover {
    color: #0f172a; /* slate-900 */
}
