/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더 스타일 */
.dashboard-header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.current-time {
    font-size: 1.1rem;
    font-weight: 500;
}

/* 메인 컨텐츠 레이아웃 */
.dashboard-main {
    flex: 1;
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 80px);
}

/* 상태 요약 패널 */
.status-summary {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: fit-content;
}

.status-summary h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.3rem;
}

.status-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.status-card.normal {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.status-card.danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    animation: danger-pulse 2s infinite;
}

.status-card.warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.status-card.uninstalled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

@keyframes danger-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.count {
    font-size: 1.8rem;
    font-weight: bold;
    display: block;
}

.percentage {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 2D 디지털 트윈 그리드 */
.digital-twin-grid {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.digital-twin-grid h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.3rem;
}

.grid-container {
    flex: 1;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    min-height: 600px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

/* 비계 구조 컨테이너 */
.scaffold-structure {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 30px;
    background: #f8fafc;
}

/* 배경 건물 실루엣 (제거) */
.building-background {
    display: none;
}

/* 수직재 (기둥) */
.vertical-post {
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: #cbd5e1;
    border-radius: 2px;
    transition: all 0.2s ease;
    z-index: 1;
}

.vertical-post::before {
    display: none;
}

.vertical-post.highlighted {
    background: #3b82f6;
    width: 4px;
}

/* 기둥 상단 캡 (제거) */
.post-cap {
    display: none;
}

/* 기둥 하단 베이스 (제거) */
.post-base {
    display: none;
}

/* 수평 발판 */
.horizontal-platform {
    position: absolute;
    height: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    border-radius: 4px;
}

.horizontal-platform:hover {
    transform: translateY(-2px);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.horizontal-platform.hovered {
    animation: platform-pulse 0.8s ease-in-out;
}

@keyframes platform-pulse {
    0%, 100% { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
    50% { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
}

/* 발판 내부 구조 */
.platform-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* 발판 그리드 패턴 (제거) */
.platform-grid {
    display: none;
}

/* 발판 테두리 (제거) */
.platform-border {
    display: none;
}

/* 안전 난간 (제거) */
.safety-rail {
    display: none;
}

/* 발판 상태별 스타일 */
.horizontal-platform.normal .platform-inner {
    background: #10b981;
    border-color: #059669;
}

.horizontal-platform.danger .platform-inner {
    background: #ef4444;
    border-color: #dc2626;
    animation: danger-pulse 2s infinite;
}

.horizontal-platform.warning .platform-inner {
    background: #f59e0b;
    border-color: #d97706;
}

.horizontal-platform.uninstalled .platform-inner {
    background: #f1f5f9;
    border-color: #cbd5e1;
    border-style: dashed;
    opacity: 0.7;
}

@keyframes danger-pulse {
    0%, 100% { 
        opacity: 1;
    }
    50% { 
        opacity: 0.7;
    }
}

/* 센서 인디케이터 */
.sensor-indicators {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    z-index: 3;
}

.sensor-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.2s ease;
    align-self: center;
    justify-self: center;
}

.sensor-dot.active {
    background: #10b981;
}

.sensor-dot.inactive {
    background: #ef4444;
}

/* sensor-blink 애니메이션 제거 */

/* 발판 라벨 */
.platform-label {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 4;
}

.horizontal-platform:hover .platform-label {
    opacity: 1;
}

.floor-label {
    color: #cbd5e1;
    margin-right: 4px;
}

.pos-label {
    color: #f1f5f9;
}

/* 상태 인디케이터 도트 */
.status-indicator-dot {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 5;
}

.horizontal-platform.normal .status-indicator-dot {
    background: #10b981;
}

.horizontal-platform.danger .status-indicator-dot {
    background: #ef4444;
    animation: status-alert 2s infinite;
}

.horizontal-platform.warning .status-indicator-dot {
    background: #f59e0b;
}

.horizontal-platform.uninstalled .status-indicator-dot {
    background: #94a3b8;
}

@keyframes status-alert {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 대각선 브레이싱 (제거) */
.diagonal-bracing {
    display: none;
}

/* 브레이싱 관련 CSS 제거 */

/* 범례 */
.grid-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 6px;
    border-radius: 3px;
}

.legend-color.normal { background: #27ae60; }
.legend-color.danger { background: #e74c3c; }
.legend-color.warning { background: #f39c12; }
.legend-color.uninstalled { background: #95a5a6; }

/* 알림 패널 */
.alert-panel {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: 70vh;
}

.alert-panel h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.3rem;
}

.alert-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.alert-item {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.alert-item:hover {
    background: #e9ecef;
}

.alert-item.danger {
    border-left-color: #e74c3c;
}

.alert-item.warning {
    border-left-color: #f39c12;
}

.alert-time {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 0.3rem;
}

.alert-message {
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.alert-location {
    font-size: 0.9rem;
    color: #6c757d;
}

.alert-controls {
    display: flex;
    gap: 0.5rem;
}

/* 버튼 스타일 */
.btn-primary, .btn-secondary, .btn-success {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 80%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: #3498db;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    font-weight: bold;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 1.5rem;
}

.scaffold-info {
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row label {
    font-weight: 600;
    color: #2c3e50;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.normal {
    background: #d5edda;
    color: #155724;
}

.status-badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.status-badge.uninstalled {
    background: #e2e3e5;
    color: #383d41;
}

/* 센서 상태 */
.sensor-status {
    margin-bottom: 1.5rem;
}

.sensor-status h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.sensor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.sensor-point {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px solid #e9ecef;
}

.sensor-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #95a5a6;
}

.sensor-indicator.active {
    background: #27ae60;
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.5);
}

.sensor-indicator.inactive {
    background: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.5);
}

/* 상태 변경 이력 */
.status-history {
    margin-bottom: 1.5rem;
}

.status-history h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.history-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.history-item {
    padding: 0.8rem;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    color: #6c757d;
    font-weight: 600;
}

/* 조치 관리 */
.action-management h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.action-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.action-input textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.action-input textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .dashboard-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    
    .status-summary,
    .alert-panel {
        max-height: none;
    }
    
    .status-cards {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .status-card {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .dashboard-main {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .sensor-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}