/**
 * GeoView-2D 스타일시트.
 * 기존 sgp/bas CSS를 제품화하여 독립 배포 가능하게 정리한다.
 */

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

/* === Layout === */
.gv2d-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    font-family: 'Malgun Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #333;
}

/* === Sidebar === */
.gv2d-sidebar {
    width: 360px;
    height: 100%;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    position: relative;
    z-index: 10;
    overflow: hidden;
}
.gv2d-sidebar:not(.is-open) {
    width: 0;
    border-right: none;
}
.gv2d-sidebar-toggle {
    position: absolute;
    right: -32px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    z-index: 11;
}
.gv2d-sidebar-toggle-icon {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

/* === Map Area === */
.gv2d-map-area {
    flex: 1;
    position: relative;
    height: 100%;
}
.gv2d-map-canvas {
    width: 100%;
    height: 100%;
}

/* === Search Panel === */
.gv2d-search {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}
.gv2d-search-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}
.gv2d-search-title {
    font-size: 16px;
    font-weight: 700;
}
.gv2d-search-form {
    padding: 12px 20px;
}
.gv2d-input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}
.gv2d-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.gv2d-search-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

/* === Buttons === */
.gv2d-btn {
    height: 32px;
    padding: 0 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.gv2d-btn.primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.gv2d-btn.primary:hover { background: #1d4ed8; }
.gv2d-btn.secondary {
    background: #fff;
    color: #333;
}
.gv2d-btn.secondary:hover { background: #f5f5f5; }

/* === Search Tabs === */
.gv2d-search-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 20px;
}
.gv2d-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.gv2d-tab.active {
    color: #2563eb;
    font-weight: 700;
    border-bottom-color: #2563eb;
}

/* === Search Results === */
.gv2d-search-results {
    flex: 1;
    overflow-y: auto;
}
.gv2d-result-panel { display: none; }
.gv2d-result-panel.active { display: block; }
.gv2d-result-list {
    list-style: none;
    padding: 0;
}
.gv2d-result-list li {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}
.gv2d-result-list li:hover {
    background: #f8faff;
}

/* === Pagination === */
.gv2d-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
}
.gv2d-pagination button {
    min-width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.gv2d-pagination button.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* === Recent Keywords === */
.gv2d-recent {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
}
.gv2d-recent-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}
.gv2d-recent-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.gv2d-recent-list li {
    padding: 4px 10px;
    background: #f0f4ff;
    border-radius: 12px;
    font-size: 12px;
    color: #2563eb;
    cursor: pointer;
}

/* === Toolbar === */
.gv2d-toolbar {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
}
.gv2d-tool-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, box-shadow 0.2s;
}
.gv2d-tool-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.gv2d-tool-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.gv2d-toolbar-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* === Tool Icons === */
.gv2d-tool-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.gv2d-icon-basemap { background-image: url('/images/sgp/bas/icon/ico_basemap.svg'); }
.gv2d-icon-layers { background-image: url('/images/sgp/bas/icon/ico_layers.svg'); }
.gv2d-icon-measure { background-image: url('/images/sgp/bas/icon/ico_measure.svg'); }
.gv2d-icon-zoomin { background-image: url('/images/sgp/bas/icon/ico_zoomin.svg'); }
.gv2d-icon-zoomout { background-image: url('/images/sgp/bas/icon/ico_zoomout.svg'); }
.gv2d-icon-fitextent { background-image: url('/images/sgp/bas/icon/ico_fitextent.svg'); }
.gv2d-icon-location { background-image: url('/images/sgp/bas/icon/ico_location.svg'); }
.gv2d-icon-save { background-image: url('/images/sgp/bas/icon/ico_save.svg'); }
.gv2d-icon-print { background-image: url('/images/sgp/bas/icon/ico_print.svg'); }

/* === Footer === */
.gv2d-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 24px;
    font-size: 12px;
    z-index: 5;
}
.gv2d-footer-coord,
.gv2d-footer-scale,
.gv2d-footer-zoom {
    display: flex;
    align-items: center;
}
.gv2d-footer-label {
    color: #999;
    margin-right: 4px;
}
.gv2d-footer-value {
    color: #333;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* === OpenLayers Overrides === */
.ol-scale-line {
    bottom: 40px;
    left: 16px;
}
.ol-attribution {
    bottom: 40px;
    right: 16px;
}
