/* 이미 제공된 CSS를 그대로 유지 (문서에 있는 CSS) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    color: #e0e0e0;
    overflow: hidden;
}

header {
    background: linear-gradient(90deg, #16213e 0%, #0f3460 100%);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 2000;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #00d9ff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-status {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.connection-status.connected {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid #28a745;
    color: #28a745;
}

.connection-status.disconnected {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid #dc3545;
    color: #dc3545;
}

.connection-status.connecting {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
    color: #ffc107;
}

.main-container {
    display: flex;
    height: calc(100vh - 48px);
    position: relative;
}

#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

.sidebar {
    width: 60px;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 15px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1500;
    transition: width 0.3s ease;
}

.sidebar:hover {
    width: 200px;
}

.tab-button {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.tab-button:hover {
    background: rgba(0, 209, 255, 0.1);
    border-color: #00d9ff;
    color: #00d9ff;
    transform: translateX(5px);
}

.tab-button.active {
    background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%);
    border-color: #00d9ff;
    color: white;
    box-shadow: 0 0 20px rgba(0, 209, 255, 0.5);
}

.tab-button .tab-label {
    position: absolute;
    left: 60px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 14px;
    pointer-events: none;
}

.sidebar:hover .tab-button .tab-label {
    opacity: 1;
}

.panel-container {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1400;
    overflow-y: auto;
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.panel-container.active {
    transform: translateX(0);
}

.panel-container::-webkit-scrollbar {
    width: 6px;
}

.panel-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.panel-container::-webkit-scrollbar-thumb {
    background: rgba(0, 209, 255, 0.3);
    border-radius: 3px;
}

.panel-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 209, 255, 0.3);
}

.panel-header h3 {
    font-size: 18px;
    color: #00d9ff;
    font-weight: 600;
}

.close-panel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #888;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.close-panel-btn:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #dc3545;
    transform: rotate(90deg);
}

.data-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.data-group h4 {
    color: #00d9ff;
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: 600;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.data-label {
    color: #888;
    font-size: 13px;
}

.data-value {
    color: #00d9ff;
    font-weight: 600;
    font-size: 14px;
}

.btn {
    background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 209, 255, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.floating-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000; /* 모든 패널보다 위에 표시 */
}

.floating-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.floating-btn.joystick {
    background: linear-gradient(135deg, #00b894 0%, #00a080 100%);
}

.floating-btn.joystick.active {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
}

.floating-btn.emergency {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 6px 20px rgba(231, 76, 60, 0.8); }
}

#joystickModal {
    display: none;
    position: fixed;
    bottom: 100px; /* 플로팅 버튼 위에 표시 */
    right: 20px;
    width: 180px;
    height: 180px;
    background: rgba(30, 30, 40, 0.98);
    border: 3px solid rgba(0, 209, 255, 0.5);
    border-radius: 50%;
    z-index: 1900;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 40px rgba(0, 209, 255, 0.4);
}

#joystickBase {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle, #1a1a2e 0%, #0f0f1e 100%);
}

#joystickKnob {
    position: absolute;
    width: 40%;
    height: 40%;
    background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%);
    border-radius: 50%;
    top: 30%;
    left: 30%;
    cursor: grab;
    box-shadow: 0 0 20px rgba(0, 209, 255, 0.8);
    touch-action: none;
    user-select: none;
    transition: all 0.1s ease;
}

#joystickKnob:active {
    cursor: grabbing;
    background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
    box-shadow: 0 0 25px rgba(255, 87, 34, 0.9);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .floating-controls {
        bottom: 15px;
        right: 15px;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    #joystickModal {
        width: 150px;
        height: 150px;
        bottom: 80px;
    }
}

#geofenceWarning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 30px 40px;
    border-radius: 15px;
    font-size: 20px;
    font-weight: bold;
    z-index: 2500;
    box-shadow: 0 0 40px rgba(220, 53, 69, 0.6);
    border: 3px solid #ff6b7a;
    text-align: center;
    display: none;
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-2deg); }
    75% { transform: translate(-50%, -50%) rotate(2deg); }
}

.pid-grid {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.pid-grid label {
    color: #888;
    font-size: 13px;
    font-weight: 600;
}

.pid-grid input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.pid-grid input:focus {
    outline: none;
    border-color: #00d9ff;
    box-shadow: 0 0 10px rgba(0, 209, 255, 0.3);
}

.waypoint-marker {
    background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0, 209, 255, 0.6);
}

.mission-marker {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    text-align: center;
    line-height: 35px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.status-safe {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border: 1px solid #28a745;
}

.status-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid #ffc107;
}

.status-danger {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid #dc3545;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 3px solid #00d9ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.deleteBtn, .deleteMissionBtn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.deleteBtn:hover, .deleteMissionBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}

#imuCalibrationModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    padding: 30px;
    border-radius: 15px;
    z-index: 10000;
    display: none;
    color: white;
    min-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 209, 255, 0.3);
}

#calibrationStep1, #calibrationStep2, #calibrationStep3 {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

#calibProgressBar {
    background: #00bfff;
    height: 10px;
    border-radius: 5px;
    transition: width 0.3s;
}

@media (max-width: 1024px) {
    .panel-container {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 50px;
    }
    
    .panel-container {
        width: 100%;
    }
    
    .floating-controls {
        flex-direction: column;
        bottom: 10px;
        right: 10px;
    }
}

/* 🚤 보트 아이콘 스타일 */
.boat-icon-container {
    width: 40px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.boat-icon {
    transition: transform 0.3s ease;
    transform-origin: center center;
}

.boat-icon:hover {
    transform: scale(1.15) !important;
    filter: drop-shadow(0 0 8px rgba(0, 209, 255, 0.8));
}

/* 보트 펄스 효과 */
@keyframes boat-pulse {
    0%, 100% { 
        filter: drop-shadow(0 0 5px rgba(0, 209, 255, 0.5));
    }
    50% { 
        filter: drop-shadow(0 0 12px rgba(0, 209, 255, 0.9));
    }
}

.boat-icon {
    animation: boat-pulse 2s infinite;
}

/* 보트가 움직일 때 */
.boat-icon.moving {
    animation: boat-pulse 0.5s infinite;
}

/* 🛡️ 지오펜스 점 마커 */
.geofence-point-marker {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    border: 3px solid #ffffff;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
    font-size: 14px;
}

.geofence-point-marker:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(255, 107, 107, 1);
}

</style>