@font-face {
    font-family: 'GyeonggiCheonnyeon';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_one@1.0/GyeonggiCheonnyeon.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&display=swap');

body { 
    font-family: 'GyeonggiCheonnyeon', 'Noto+Sans+KR', sans-serif; 
    overflow: hidden; 
    transition: filter 0.5s; 
    user-select: none;
    
    overscroll-behavior: none; 
}
#licenseLockScreen { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.98); z-index: 10000; flex-direction: column; align-items: center; justify-content: center; backdrop-blur: 15px; }
.license-card { background: #1e293b; border: 1px solid #334155; padding: 2.5rem; border-radius: 1.5rem; box-shadow: 0 0 60px rgba(0,0,0,1); width: 450px; text-align: center; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.cheat-detected { border: 2px solid #ef4444 !important; animation: pulse-red 2s infinite; }

body.simulation-shutdown .rack-location { border-color: #333; }
body.simulation-shutdown .switch-device:not(.device-ups):not(.device-splitter) { filter: grayscale(100%) opacity(0.3) brightness(0.5); transition: all 0.5s; } 
body.simulation-shutdown .room-block, body.simulation-shutdown .ap-wrapper, body.simulation-shutdown .text-label-block { filter: grayscale(100%) opacity(0.3) brightness(0.5); border-color: #444; transition: all 0.5s; }
body.simulation-shutdown .link-line-path { stroke: #444 !important; stroke-dasharray: 5 5 !important; opacity: 0.2 !important; animation: none !important; }
body.simulation-shutdown .ups-power-flow { background: #222 !important; }
body.simulation-shutdown .device-ups { box-shadow: 0 0 15px rgba(255, 0, 0, 0.3); border-color: #ef4444; }

.switch-device { transition: filter 0.3s ease-out, border-color 0.2s, box-shadow 0.2s; } 
.switch-device.pending-power { filter: grayscale(100%) opacity(0.3) brightness(0.5) !important; pointer-events: none; }
@keyframes power-on-flash { 0% { filter: brightness(2.0); box-shadow: 0 0 15px #fff; } 100% { filter: none; box-shadow: none; } }
.power-on-active { animation: power-on-flash 0.5s ease-out; }

.admin-restricted.btn-disabled { opacity: 0.3 !important; cursor: not-allowed !important; filter: grayscale(100%); }

.rack-location { background: #1e293b; border: 1px solid #334155; border-radius: 0.5rem; margin-bottom: 1rem; overflow: hidden; }
.rack-header { padding: 0.5rem 0.75rem; background: #0f172a; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }

.switch-device { border: 1px solid rgba(255,255,255,0.1); position: relative; cursor: grab; } 
.switch-device:hover { border-color: #facc15; } 
.switch-device.drag-target-active { border-top: 3px solid #60a5fa !important; margin-top: 5px; opacity: 1 !important; }

.block-port { background: #d6d3d1; border: 1px solid #78716c; transition: all 0.1s; cursor: pointer; z-index: 20; width: 2rem; height: 1rem; border-radius: 1px; display: flex; align-items: center; justify-content: center; }
.block-port:hover { border-color: #fff; transform: scale(1.4); z-index: 50; box-shadow: 0 0 5px #facc15; background: #e7e5e4; }
.block-port span { color: #000 !important; font-weight: bold; font-size: 8px; }

.rj45-port { background: #000; border: 1px solid #4a5568; transition: all 0.1s; cursor: pointer; z-index: 20; }
.rj45-port:hover { border-color: #fff; transform: scale(1.6); z-index: 50; box-shadow: 0 0 5px white; } 
.fiber-port { background: #111; border: 1px solid #06b6d4; transition: all 0.1s; cursor: pointer; z-index: 20; width: 1.5rem; height: 1.5rem; border-radius: 50%; }
.fiber-port:hover { border-color: #fff; background: #000; transform: scale(1.6); z-index: 50; box-shadow: 0 0 5px #facc15; }
.sfp-slot-port { background: #111; border: 1px solid #facc15; transition: all 0.1s; cursor: pointer; z-index: 20; width: 2rem; height: 1rem; border-radius: 2px; }
.sfp-slot-port:hover { border-color: #fff; background: #000; transform: scale(1.6); z-index: 50; box-shadow: 0 0 5px #facc15; }
.combo-port { background: #334155; border: 1px solid #64748b; color: #94a3b8; font-size: 8px; font-weight: bold; transition: all 0.1s; cursor: pointer; z-index: 20; }
.combo-port:hover { border-color: #fff; transform: scale(1.6); z-index: 50; box-shadow: 0 0 5px white; } 

.rj45-port.connected, .fiber-port.connected, .sfp-slot-port.connected, .combo-port.connected, .block-port.connected { border-color: var(--line-color, #facc15); box-shadow: 0 0 3px var(--line-color, #facc15); }
.led-light { width: 6px; height: 3px; background: #4a5568; margin: 0 auto 1px auto; } 
.led-light.active { background: #4ade80; box-shadow: 0 0 6px #4ade80; }

.device-firewall { background-color: #7f1d1d; border-color: #991b1b; } 
.device-security-l2 { background-color: #14532d; border-color: #059669; } 
.device-poe-switch { background-color: #1e3a8a; border-color: #2563eb; } 
.device-ups { background-color: #4a5568; border-color: #64748b; color: #fff; } 
.device-fdf { background-color: #0e7490; border-color: #06b6d4; }
.device-block { background-color: #44403c; border-color: #78716c; color: #e7e5e4; }
.device-olt { background-color: #334155; border-color: #475569; }
.device-splitter { background-color: #cbd5e1; border-color: #94a3b8; color: #0f172a !important; }
.device-splitter .led-light { display: none; } 
.device-splitter .fiber-port { border-color: #94a3b8; }

.building-bg { background-color: #0f172a; background-image: linear-gradient(#1e293b 1px, transparent 1px), linear-gradient(90deg, #1e293b 1px, transparent 1px); background-size: 100px 100px; overflow: auto; }

.floor-line { 
    position: absolute; left: 0; width: 100%; 
    border-top: 2px dashed rgba(255, 255, 255, 0.3); 
    pointer-events: none; 
    font-size: 50px; font-weight: 900; 
    color: rgba(255,255,255,0.2); 
    padding-left: 20px; 
    z-index: 5;
}

.room-block { cursor: pointer; user-select: none; position: absolute; border: 2px solid rgba(255,255,255,0.5); z-index: 10; transition: box-shadow 0.1s, transform 0.1s; display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 40px; min-height: 40px; overflow: visible; }
.room-block.selected, .ap-wrapper.selected .ap-block, .text-label-block.selected { border-color: #f87171 !important; box-shadow: 0 0 0 2px #ef4444 !important; }

.room-block.conn-optical { border-color: #22c55e !important; box-shadow: 0 0 15px rgba(34, 197, 94, 0.3); }
.room-block.conn-copper { border-color: #3b82f6 !important; box-shadow: 0 0 10px rgba(59, 130, 246, 0.2); }

.conn-badge { position: absolute; bottom: -6px; right: -4px; font-size: 9px; font-weight: 800; padding: 2px 4px; border-radius: 4px; z-index: 20; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.conn-badge.ont { background: #15803d; color: #fff; border: 1px solid #4ade80; }
.conn-badge.utp { background: #1e40af; color: #fff; border: 1px solid #60a5fa; }

.room-link-btn {
    position: absolute; top: -8px; right: -8px;
    width: 24px; height: 24px;
    background: #334155; border: 1px solid #94a3b8;
    color: #fff; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 10px; cursor: pointer;
    opacity: 0; transition: opacity 0.2s, transform 0.2s;
    z-index: 101; 
    pointer-events: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.room-link-btn:hover { background: #2563eb; transform: scale(1.1); border-color: #fff; }
.room-block:hover .room-link-btn { opacity: 1; } 

.room-title-display { pointer-events: auto; cursor: pointer; position: relative; z-index: 101; }
.room-title-display:hover { text-decoration: underline; color: #93c5fd; }

.resize-handle { position: absolute; bottom: 0; right: 0; width: 15px; height: 15px; background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.5) 50%); cursor: se-resize; z-index: 20; }
.resize-handle:hover { background: linear-gradient(135deg, transparent 50%, #facc15 50%); }

.ap-wrapper { 
    position: absolute; 
    cursor: pointer; 
    user-select: none; 
    z-index: 15; 
    width: 30px; 
    height: 30px; 
}
.ap-block { 
    width: 100%; height: 100%; 
    border-radius: 50%; 
    background-color: #22c55e; 
    border: 2px solid #fff; 
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: white; 
    font-size: 14px; 
    transition: transform 0.2s; 
}
.ap-wrapper:hover .ap-block { transform: scale(1.1); box-shadow: 0 0 15px #4ade80; }

.text-label-block {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 12;
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
    line-height: 1.1;
    font-family: 'GyeonggiCheonnyeon', sans-serif;
}
.text-label-block:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.ap-label { 
    position: absolute;
    top: 32px; 
    left: 50%;
    transform: translateX(-50%); 
    font-size: 10px; 
    color: #cbd5e1; 
    text-shadow: 0 1px 2px black; 
    white-space: nowrap; 
    pointer-events: none; 
}

.link-group { filter: none !important; } 
.link-line-path { transition: stroke-width 0.2s, opacity 0.2s; stroke-width: 1.5px; opacity: 0; fill: none !important; filter: none !important; box-shadow: none !important; backdrop-filter: none !important; stroke-dasharray: 0; stroke-dashoffset: 0; animation: none; }
@keyframes dash-flow { to { stroke-dashoffset: -12; } }
.link-group.active .link-line-path { stroke-width: 4px !important; stroke: var(--active-color) !important; opacity: 1 !important; stroke-dasharray: 8 4; animation: dash-flow 1s linear infinite; filter: none !important; }
.link-text { font-size: 10px; fill: #94a3b8; text-anchor: middle; dominant-baseline: middle; opacity: 0; pointer-events: none; text-shadow: none !important; }
.link-group.active .link-text { fill: var(--active-color); font-weight: bold; font-size: 12px; opacity: 1; }
.link-hit-area { stroke: rgba(255,255,255,0); stroke-opacity: 0; stroke-width: 15px; fill: none !important; cursor: pointer; filter: none !important; }

#svgContainer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

@keyframes flash-highlight { 0%, 100% { box-shadow: 0 0 0 transparent; border-color: rgba(255,255,255,0.5); transform: scale(1); } 50% { box-shadow: 0 0 10px #facc15; border-color: #facc15; background-color: rgba(250, 204, 21, 0.1); transform: scale(1.01); z-index: 50 !important; } }
.blink-active { animation: flash-highlight 0.8s infinite; border-color: #facc15 !important; z-index: 50 !important; }
@keyframes flash-highlight-green { 0%, 100% { box-shadow: 0 0 0 transparent; border-color: #fff; transform: scale(1); } 50% { box-shadow: 0 0 10px #22c55e; border-color: #22c55e; transform: scale(1.1); z-index: 60 !important; } }
.blink-active-green { animation: flash-highlight-green 0.8s infinite; border-color: #22c55e !important; z-index: 60 !important; }
.ap-wrapper.blink-active-green .ap-block { animation: flash-highlight-green 0.8s infinite; border-color: #22c55e !important; }

.dragging { opacity: 0.5; } 

#buildingContainer { position: relative; cursor: crosshair; user-select: none; }
#buildingContent { min-width: 2000px; min-height: 2200px; position: relative; transition: transform 0.2s ease-out; transform-origin: top left; }
#customTooltip { position: fixed; background: rgba(15, 23, 42, 0.95); color: white; padding: 10px 14px; border-radius: 8px; font-size: 12px; pointer-events: none; z-index: 9999; border: 1px solid #475569; opacity: 0; transition: opacity 0.1s; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.color-btn { width: 1.5rem; height: 1.5rem; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-btn.selected { border-color: white; transform: scale(1.1); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
#buildingContainer.drag-over-active { background-color: rgba(60, 120, 240, 0.1); border: 2px dashed #60a5fa; }

#selectionBox {
    position: absolute;
    border: 2px dashed #60a5fa;
    background-color: rgba(96, 165, 250, 0.2);
    pointer-events: none;
    z-index: 999;
    display: none;
}

input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; background: #60a5fa; cursor: pointer; border-radius: 50%; border: 2px solid white; }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; background: #60a5fa; cursor: pointer; border-radius: 50%; border: 2px solid white; }

@media print {
    @page { size: A3 portrait; margin: 10mm; }
    body { background-color: white !important; color: black !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; overflow: visible !important; height: auto !important; }
    .no-print, .resize-handle, #customTooltip, .rack-header i.fa-plus, .rack-header i.fa-pen-to-square, header button, header .fa-school, header p, .admin-btn, .selection-ui { display: none !important; }
    ::-webkit-scrollbar { display: none; }
    header { background: white !important; border-bottom: 2px solid #000 !important; height: auto !important; display: block !important; padding: 10px 0 !important; text-align: center !important; }
    #mainTitle { font-size: 24pt !important; font-weight: 900 !important; color: black !important; display: block !important; text-align: center !important; width: 100% !important; }
    main { display: flex !important; flex-direction: row !important; height: auto !important; overflow: visible !important; width: 100% !important; gap: 10px !important; }
    #leftPanel { width: 380px !important; min-width: 380px !important; height: auto !important; overflow: visible !important; border-right: 1px solid #ccc !important; flex-shrink: 0; display: block !important; background: white !important; }
    #locationsContainer { height: auto !important; overflow: visible !important; padding-bottom: 0 !important; }
    .rack-location { page-break-inside: avoid; margin-bottom: 20px !important; border: 1px solid #000 !important; background: white !important; color: black !important; }
    .rack-header { background: #f0f0f0 !important; border-bottom: 1px solid #000 !important; color: black !important; }
    .rack-header span { color: black !important; }
    .switch-device { box-shadow: none !important; border: 1px solid #000 !important; }
    .ups-text { color: white !important; text-shadow: 1px 1px 2px black !important; }
    .rj45-port, .combo-port, .fiber-port, .sfp-slot-port, .block-port { background-color: #fff !important; border: 1px solid #000 !important; color: black !important; }
    .rj45-port span, .combo-port span, .fiber-port span, .sfp-slot-port span, .block-port span { color: black !important; font-weight: bold !important; }
    #rightPanel { flex-grow: 1 !important; height: auto !important; overflow: visible !important; border: none !important; margin: 0 !important; display: block !important; position: relative !important; background: white !important; }
    #buildingContainer { height: auto !important; overflow: visible !important; background: white !important; background-image: none !important; border: 1px solid #ccc !important; }
    #buildingContent { transform: scale(0.6) !important; transform-origin: top left !important; width: auto !important; height: auto !important; }
    #svgContainer { position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; z-index: 5 !important; display: block !important; }
    .floor-line { color: #ccc !important; border-top-color: #eee !important; }
    .ap-label { color: black !important; text-shadow: none !important; }
    .text-label-block { border: none !important; }
}

.ups-power-flow { height: 60px; background: #0f172a; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; border-radius: 0 0 0.4rem 0.4rem; }
.power-wave { width: 100%; height: 4px; background: linear-gradient(90deg, transparent, #22c55e, #facc15, #3b82f6, transparent); position: absolute; opacity: 0.8; box-shadow: 0 0 15px rgba(255, 255, 255, 0.5); animation: flow 4s linear infinite alternate; }
@keyframes flow { 0% { transform: scaleX(0.5) translateX(-50%); } 100% { transform: scaleX(0.5) translateX(50%); } }
.ups-text { position: relative; z-index: 10; font-size: 10px; font-weight: bold; color: white; text-shadow: 0 0 5px #000; }

.building-bg {
    background-color: #1e293b !important;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), 
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px) !important;
    background-size: 40px 40px !important;
}

.room-block {
    border: none !important;
    
    background-image: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(0,0,0,0.1) 100%);
    
    box-shadow: 
        1px 1px 0px #0f172a, 
        2px 2px 0px #0f172a, 
        3px 3px 0px #0f172a, 
        4px 4px 0px #0f172a, 
        5px 5px 10px rgba(0,0,0,0.5) !important;
        
    transition: all 0.1s ease-out !important;
    border-radius: 4px !important;
    z-index: 20; /* 선보다 위에 보이게 */
}

.room-block:hover {
    transform: translateY(-2px);
    box-shadow: 
        2px 2px 0px #0f172a, 
        4px 4px 0px #0f172a, 
        6px 6px 0px #0f172a, 
        7px 7px 15px rgba(0,0,0,0.6) !important;
    z-index: 50;
}

.room-block.selected {
    transform: translateY(2px);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5) !important; 
    border: 2px solid #ef4444 !important; 
}

.floor-line {
    font-family: 'GyeonggiCheonnyeon', sans-serif;
    color: rgba(255,255,255,0.1) !important;
    border-top: 2px solid rgba(255,255,255,0.1) !important;
    text-shadow: 2px 2px 0px #0f172a;
}

.ap-wrapper {
    z-index: 60 !important; 
    transform: translateZ(10px); 
}
#adminLoginModal, 
#adminMenuModal, 
#portModal, 
#addDeviceModal, 
#roomConnectionModal, 
#commonModal {
    z-index: 100 !important; 
}
#minimapContainer {
    position: fixed;
    bottom: 40px; 
    right: 20px;  
    width: 240px;
    height: 180px;
    background-color: rgba(15, 23, 42, 0.95); 
    border: 2px solid #475569;
    border-radius: 8px;
    z-index: 2000; 
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    display: none; 
}

#minimapContent {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none; 
}
.mini-room {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

#minimapViewport {
    position: absolute;
    border: 2px solid #ef4444; 
    background-color: rgba(239, 68, 68, 0.1); 
    cursor: grab;
    z-index: 10;
    transition: background-color 0.2s;
}
#minimapViewport:hover {
    background-color: rgba(239, 68, 68, 0.2);
}
#minimapViewport:active {
    cursor: grabbing;
    background-color: rgba(239, 68, 68, 0.3);
}
@media (max-width: 1024px) {
    #mobileMenuBtn { display: block !important; }
    #leftPanel {
        position: fixed !important;
        top: 0;
        left: -500px;
        height: 100vh;
        z-index: 5000 !important;
        transition: left 0.3s ease-in-out;
    }
    #leftPanel.active { left: 0 !important; }
    #rightPanel { width: 100vw !important; }
    header button:not(#mobileMenuBtn):not(#adminBtn):not([onclick*="saveDataLocal"]),
    header .w-px, 
    header input[type="file"] {
        display: none !important;
    }
    #adminBtn span { display: none !important; }
    #adminBtn { padding: 6px 10px !important; }
    h1#mainTitle { font-size: 14px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
    header { padding: 0 10px !important; height: 50px !important; }
    #rightPanel .border-b button {
        display: none !important;
    }
    #rightPanel .border-b span {
        display: block !important;
        font-size: 12px !important;
    }
    #mobileFab { display: flex !important; }
    #minimapContainer { bottom: 100px !important; right: 10px !important; width: 150px !important; height: 100px !important; }
    #legendBox { display: none !important; }
} /* <--- 여기가 @media 닫는 괄호입니다. 이 위쪽에 넣으셔야 해요! */

#fabMenu.active { opacity: 1 !important; transform: translateY(0) !important; pointer-events: auto !important; }
#fabIcon.active { transform: rotate(45deg); transition: transform 0.3s; }
}