/* ==========================================
   서울시 실시간 돌발정보 테스트베드 CSS
   ========================================== */

:root {
    --primary: #1a3a5c;
    --primary-light: #2c5282;
    --primary-lighter: #3b6ea5;
    --accent: #2196F3;
    --accent-light: #64B5F6;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
    --radius: 10px;
    --radius-sm: 6px;
}

* {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
}

/* ---- Navbar ---- */
.bg-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: var(--shadow-md);
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.brand-title {
    display: block;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
}

.brand-subtitle {
    font-size: 11px;
    opacity: .75;
    letter-spacing: 0.5px;
}

/* ---- Tab Navigation ---- */
.tab-nav-wrapper {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab-nav-wrapper .nav-tabs {
    border-bottom: none;
}

.tab-nav-wrapper .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 20px;
    font-weight: 500;
    font-size: 14px;
    transition: all .2s;
    border-radius: 0;
}

.tab-nav-wrapper .nav-link:hover {
    color: var(--primary);
    border-bottom-color: var(--border-color);
    background: none;
}

.tab-nav-wrapper .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
    background: none;
    font-weight: 600;
}

/* ---- Main Content ---- */
.main-content {
    padding: 20px 0;
    min-height: calc(100vh - 160px);
}

/* ---- Stat Cards ---- */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-total { border-left-color: var(--accent); }
.stat-accident { border-left-color: #EF4444; }
.stat-construction { border-left-color: #F59E0B; }
.stat-control { border-left-color: #8B5CF6; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-total .stat-icon { background: #EBF5FF; color: var(--accent); }
.stat-accident .stat-icon { background: #FEF2F2; color: #EF4444; }
.stat-construction .stat-icon { background: #FFFBEB; color: #F59E0B; }
.stat-control .stat-icon { background: #F5F3FF; color: #8B5CF6; }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

/* ---- Cards ---- */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ---- Map ---- */
#map {
    height: 420px;
    width: 100%;
    border-radius: 0;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    font-family: 'Pretendard', sans-serif;
}

.incident-popup {
    min-width: 220px;
}

.incident-popup .popup-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

.incident-popup .popup-location {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.incident-popup .popup-content {
    font-size: 12px;
    color: #555;
    line-height: 1.4;
}

.incident-popup .popup-time {
    font-size: 11px;
    color: #888;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #eee;
}

/* Map marker pulse */
.marker-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(0,0,0,.3);
}

/* ---- Tables ---- */
.table {
    font-size: 13px;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 16px;
    vertical-align: middle;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: #edf2f7 !important;
}

.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.type-badge.accident { background: #FEE2E2; color: #DC2626; }
.type-badge.construction { background: #FEF3C7; color: #D97706; }
.type-badge.event { background: #DBEAFE; color: #2563EB; }
.type-badge.weather { background: #D1FAE5; color: #059669; }
.type-badge.control { background: #EDE9FE; color: #7C3AED; }
.type-badge.other { background: #F3F4F6; color: #6B7280; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.active { background: #DCFCE7; color: #16A34A; }
.status-badge.cleared { background: #F3F4F6; color: #6B7280; }

/* ---- API Test ---- */
.response-viewer {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--radius-sm);
    padding: 20px;
    font-size: 13px;
    line-height: 1.6;
    max-height: 600px;
    overflow: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.response-viewer code {
    color: inherit;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ---- Service Info ---- */
.info-item {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item strong {
    color: var(--text-secondary);
    font-size: 12px;
}

.info-item span {
    font-weight: 500;
}

.code-block {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    font-size: 13px;
    overflow-x: auto;
}

.code-block code {
    color: inherit;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

.step-guide {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.step-number {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.step-content p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.notice-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notice-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: var(--text-secondary);
}

.notice-list li:last-child {
    border-bottom: none;
}

.notice-list li::before {
    content: '\2022';
    color: var(--accent);
    font-weight: bold;
    margin-right: 8px;
}

/* ---- Pagination ---- */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ---- Loading ---- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.spinner-wrapper {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---- Footer ---- */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 14px 0;
    margin-top: 30px;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ---- Request History ---- */
.history-item {
    font-size: 12px;
    padding: 8px 16px !important;
    cursor: pointer;
    transition: background .15s;
}

.history-item:hover {
    background: #f8fafc;
}

.history-item .history-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.history-item .history-status.success { background: #22C55E; }
.history-item .history-status.error { background: #EF4444; }

/* ---- Buttons ---- */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-lighter);
    border-color: var(--primary-lighter);
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .main-content {
        padding: 12px 0;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

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

    .stat-value {
        font-size: 22px;
    }

    #map {
        height: 300px;
    }

    .tab-nav-wrapper .nav-link {
        padding: 10px 12px;
        font-size: 13px;
    }

    .tab-nav-wrapper .nav-link i {
        display: none;
    }
}

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

.stat-card, .card {
    animation: fadeIn .4s ease-out;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---- Chart Container ---- */
canvas {
    max-width: 100%;
}
