/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f0f2f5;
    overflow-x: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.menu-btn:hover {
    background: rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
}

.api-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.api-link:hover,
.api-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.separator {
    color: rgba(255,255,255,0.5);
    font-size: 14px;
}

/* Container */
.container {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* Left Sidebar */
.left-sidebar {
    width: 80px;
    background: #4a6fa5;
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 11px;
    gap: 6px;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: #3d5a87;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.sidebar-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Main Content */
.main-content {
    margin-left: 80px;
    flex: 1;
    padding: 20px;
    max-width: calc(100% - 80px - 100px);
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.view-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #f5f5f5;
}

.view-btn.active {
    background: #4a6fa5;
    color: white;
    border-color: #4a6fa5;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Category Filter */
.category-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    border-radius: 20px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #f0f2f5;
}

.filter-btn.active {
    color: #4a6fa5;
    font-weight: 600;
    border-bottom: 2px solid #4a6fa5;
    border-radius: 0;
}

/* Sort Bar */
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.sort-bar strong {
    color: #333;
    font-weight: 600;
}

.sort-btn {
    background: #666;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.data-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

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

.card-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #e0e0e0;
}

.card-content {
    padding: 12px;
}

.card-category {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.card-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-tag.relax {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-tag.normal {
    background: #fff3e0;
    color: #ef6c00;
}

.status-tag.busy {
    background: #ffebee;
    color: #c62828;
}

/* Right Panel */
.right-panel {
    position: fixed;
    right: 16px;
    top: 72px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.tool-btn {
    width: 64px;
    height: 64px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.tool-btn:hover {
    background: #f0f4ff;
    transform: scale(1.05);
}

.tool-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tool-btn svg {
    width: 24px;
    height: 24px;
}

.tool-btn span {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Map View */
.map-view {
    display: none;
    position: fixed;
    top: 56px;
    left: 80px;
    right: 0;
    bottom: 0;
}

.map-view.active {
    display: block;
}

#map {
    width: 100%;
    height: 100%;
}

/* Realtime Panel */
.realtime-panel {
    position: absolute;
    left: 16px;
    top: 16px;
    width: 320px;
    max-height: calc(100% - 32px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow-y: auto;
    z-index: 10;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.refresh-btn,
.graph-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.refresh-btn {
    background: #4a6fa5;
    color: white;
    border-color: #4a6fa5;
}

.panel-content {
    padding: 16px;
}

.data-section {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

.data-section:first-child {
    padding-top: 0;
}

.data-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.section-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.data-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 8px;
}

.update-time {
    font-size: 11px;
    color: #999;
}

.data-value {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.population-range,
.sales-range,
.temperature {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.unit {
    font-size: 14px;
    color: #666;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.busy {
    background: #ffebee;
    color: #c62828;
}

.status-badge.normal {
    background: #fff3e0;
    color: #ef6c00;
}

.status-badge.relax {
    background: #e8f5e9;
    color: #2e7d32;
}

.data-sub {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

.highlight {
    font-weight: 600;
    color: #333;
}

/* Top3 */
.top3 {
    margin-top: 12px;
}

.top3-title {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.top3-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
}

.rank {
    color: #666;
}

/* Congestion Item */
.congestion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.rank-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

.rank-badge.rank-1 {
    background: #333;
}

.location {
    flex: 1;
    font-size: 14px;
}

.status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.status.busy {
    background: #ffebee;
    color: #c62828;
}

/* Weather Section */
.weather-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weather-icon {
    font-size: 40px;
}

.weather-data {
    flex: 1;
}

.weather-detail {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 12px;
}

.bad {
    color: #c62828;
    font-weight: 600;
}

/* Parking & Charging */
.parking-status,
.charging-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 12px;
}

.available {
    font-size: 12px;
    color: #666;
}

.count {
    font-weight: 600;
    color: #333;
}

/* Bus Info */
.bus-info {
    margin-top: 8px;
}

.bus-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.bus-num {
    font-weight: 600;
}

.bus-status {
    font-size: 12px;
}

.bus-status.congested {
    color: #c62828;
}

.bus-detail {
    font-size: 11px;
    color: #999;
    padding: 4px 0;
}

/* Transit Stats */
.transit-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item.highlight {
    grid-column: 1 / -1;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
}

.stat-item .label {
    font-size: 12px;
    color: #666;
}

.stat-item .value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Map Popup */
.map-popup {
    display: none;
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 280px;
    z-index: 20;
}

.map-popup.active {
    display: block;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #ff9800;
    border-radius: 12px 12px 0 0;
    color: white;
}

.popup-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.popup-content {
    padding: 16px;
}

.popup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.popup-item .label {
    font-size: 13px;
    color: #666;
}

.popup-item .value {
    font-size: 14px;
    font-weight: 600;
}

.popup-item .value.congested {
    color: #c62828;
}

.traffic-bar {
    display: flex;
    width: 150px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    font-size: 10px;
}

.bar-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.bar-section.smooth {
    background: #4caf50;
}

.bar-section.slow {
    background: #ff9800;
}

.bar-section.congested {
    background: #f44336;
}

/* Responsive */
@media (max-width: 1024px) {
    .realtime-panel {
        width: 280px;
    }
    
    .data-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .left-sidebar {
        width: 60px;
    }
    
    .nav-item span {
        font-size: 9px;
    }
    
    .main-content {
        margin-left: 60px;
        max-width: calc(100% - 60px - 80px);
    }
    
    .right-panel {
        right: 8px;
    }
    
    .tool-btn {
        width: 56px;
        height: 56px;
    }
    
    .api-nav {
        display: none;
    }
}

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

.data-card {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ==========================================
   청계산 실시간 대시보드 스타일
   ========================================== */

/* 청계산 카드 - 서울시 스타일 */
.cheonggyesan-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cheonggyesan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cheonggyesan-card:hover .card-image {
    transform: scale(1.05);
}

.card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-badge.normal { color: #4caf50; }
.card-badge.busy { color: #ff9800; }
.card-badge.full { color: #f44336; }

.card-content {
    padding: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-category {
    font-size: 12px;
    color: #666;
    background: #f5f5f5;
    padding: 4px 10px;
    border-radius: 12px;
}

.card-location {
    font-size: 12px;
    color: #999;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 8px 0 12px 0;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-icon {
    font-size: 16px;
}

.stat-label {
    font-size: 13px;
    color: #666;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #4caf50;
}

/* 청계산 실시간 패널 */
.cheonggyesan-realtime-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.cheonggyesan-realtime-panel h2 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.last-update {
    font-size: 13px;
    color: #999;
    margin-bottom: 20px;
}

/* 실시간 데이터 그리드 */
.realtime-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.rt-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.rt-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.rt-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.rt-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.rt-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.rt-value .realtime-status {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 4px;
}

.rt-value .realtime-status.normal,
.rt-value .realtime-status.smooth {
    background: #e8f5e9;
    color: #2e7d32;
}

.rt-value .realtime-status.busy,
.rt-value .realtime-status.slow {
    background: #fff3e0;
    color: #ef6c00;
}

.rt-value .realtime-status.full,
.rt-value .realtime-status.congested {
    background: #ffebee;
    color: #c62828;
}

.rt-progress {
    margin-top: 12px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #4caf50;
    transition: width 0.5s ease;
}

/* 돌발상황 섹션 */
.incidents-section {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.incidents-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.incident-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.no-incident {
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
    color: #999;
    text-align: center;
    font-size: 14px;
}

.incident-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffebee;
    border-radius: 8px;
    border-left: 4px solid #f44336;
}

.incident-item .incident-type {
    font-size: 12px;
    font-weight: 600;
    color: #f44336;
    padding: 2px 8px;
    background: white;
    border-radius: 4px;
}

.incident-item .incident-title {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.incident-item .incident-time {
    font-size: 12px;
    color: #999;
}

/* CCTV 모달 */
.cctv-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    max-width: 800px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #4a6fa5;
    color: white;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    position: relative;
}

.modal-body img {
    width: 100%;
    height: auto;
    display: block;
}

.cctv-controls {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.live-badge {
    background: #f44336;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

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

/* 지도 마커 스타일 */
.map-marker {
    text-align: center;
}

.map-marker .marker-icon {
    font-size: 32px;
    background: white;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.map-marker .marker-label {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.map-marker .marker-population {
    background: #4caf50;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-top: 4px;
}

.parking-marker .p-icon {
    background: #2196f3;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.parking-marker .p-count {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ev-marker .ev-icon {
    background: #ff9800;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* 반응형 */
@media (max-width: 1024px) {
    .realtime-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .realtime-grid {
        grid-template-columns: 1fr;
    }
    
    .cheonggyesan-realtime-panel {
        padding: 16px;
    }
    
    .rt-card {
        padding: 16px;
    }
    
    .rt-value {
        font-size: 20px;
    }
}
