/* style.css
   Layout styles: define main application layout, panels, and map container (works with theme.css).
*/
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
}  

/* =========================================================
   Application layout
   ========================================================= */

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    position: relative;
}

/* =========================================================
   Side panels
   Fixed-width containers for metadata and charts
   ========================================================= */

.panel {
    width: var(--panel-width);
    height: 100%;
    background: var(--panel-bg);
    box-sizing: border-box;
    padding: 14px 12px;
    flex-shrink: 0;
    z-index: var(--panel-z);
    box-shadow: var(--panel-shadow);
    display: flex;
    flex-direction: column;
    min-height: 0;
} 

#panel-left {
    border-right: 1px solid #ddd;
}

/* =========================================================
   Panel tabs (left panel tab navigation)
   ========================================================= */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 10px;
}

.panel-tab {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    padding: 10px 0 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #adadad;
    letter-spacing: 0.0em;
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
    border-bottom: 2px solid transparent;
}

.panel-tab.active {
    color: #263138;
    border-bottom-color: var(--accent-color, #4a90e2);
}

.tab-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tab-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* =========================================================
   Map viewport
   Canvas for rendering, SVG for interaction overlay
   ========================================================= */

#map-wrapper {
    position: relative;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

/* =========================================================
   Lock hint toast
   ========================================================= */

.lock-toast {
    position: fixed;
    left: calc(50% + (var(--panel-width) / 2));
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;

    background: rgba(255, 255, 255, 0.95);
    color: #555555;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    z-index: 1200;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 270px;
    text-align: center;

    transition: opacity 0.12s ease;
}

.lock-toast.show {
    opacity: 1;
}

.lock-toast-btn {
    padding: 7px 16px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.lock-toast-btn:hover {
    background: #357abd;
}

.lock-toast-btn:active {
    background: #2a5a8f;
}

.lock-toast-checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
}

.lock-toast-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4a90e2;
    margin: 0;
    padding: 0;
}

.lock-toast-checkbox-label {
    font-size: 11px;
    color: #888;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

#mapCanvas,
#overlay {
    position: absolute;
    left: 0;
    top: 0;
}

/* =========================================================
   Search box
   Location search and navigation
   ========================================================= */

.search-container {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 100;
    width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    padding-right: 38px;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 2px 12px rgba(74, 144, 226, 0.3);
}

.search-input::placeholder {
    color: #999;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    display: none;
}

.search-clear-btn.show {
    display: block;
}

.search-clear-btn:hover {
    color: #333;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 43px;
    margin-top: 84px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 101;
    width: 355px;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
    font-size: 13px;
    color: #333;
}

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

.search-suggestion-item:hover {
    background-color: #f5f5f5;
}

/* =========================================================
   Symbol style selector (radio buttons)
   Top-right control for choosing symbol display style
   ========================================================= */

.symbol-selector {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(208, 208, 208, 0.6);
    border-radius: 4px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-width: 160px;
}

.selector-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radio-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 4px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.radio-item:hover {
    opacity: 0.8;
}

.radio-item input[type="radio"] {
    margin: 0;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #4a90e2;
    flex-shrink: 0;
}

.radio-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-title {
    font-size: 12px;
    font-weight: 500;
    color: #333;
}

.radio-item input[type="radio"]:checked + .radio-content .radio-title {
    color: #4a90e2;
    font-weight: 600;
}

.radio-desc {
    font-size: 12px;
    color: #777;
    line-height: 1.3;
}

/* =========================================================
   Map display toggles
   Control visibility of map layers
   ========================================================= */

.map-toggles {
    position: absolute;
    top: 64px;
    left: 16px;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    max-width: 520px;
    gap: 3px 10px;
}

.toggle-break {
    flex-basis: 100%;
    height: 0;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: background 0.2s;
    user-select: none;
}

.toggle-item:hover {
    background: rgba(255, 255, 255, 0.95);
}

.toggle-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* =========================================================
   Zoom controls
   Map navigation buttons
   ========================================================= */

.zoom-controls {
    position: absolute;
    top: 140px;
    left: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zoom-group {
    display: flex;
    flex-direction: column;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    font-size: 19px;
    font-weight: 600;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
    padding: 0;
    line-height: 1;
}

.zoom-group .zoom-btn:not(:last-child) {
    border-bottom: 1px solid #d0d0d0;
}

.zoom-btn:hover {
    background: rgba(74, 144, 226, 0.1);
    color: #4a90e2;
}

.zoom-reset:hover {
    background: rgba(250, 252, 255, 0.9) !important;
    border-color: #4a90e2 !important;
    color: #4a90e2;
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-reset:active {
    transform: scale(0.95);
}

.zoom-reset {
    width: 34px;
    height: 34px;
    border: 1px solid #d0d0d0 !important;
    border-radius: 3px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.zoom-reset svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* =========================================================
   Loading overlay
   Blocks interaction during initialization
   ========================================================= */

#loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--loading-overlay-bg);
    z-index: 1000;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    pointer-events: all;
}

.loading-box {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 32px 48px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#mobile-entry-gate {
    display: none;
}

#loading-overlay.gate-mode .spinner,
#loading-overlay.gate-mode .loading-text {
    display: none;
}

#loading-overlay.gate-mode .loading-box {
    width: min(92vw, 380px);
    padding: 20px 20px 18px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d0d0d0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    align-items: stretch;
}

#loading-overlay.gate-mode #mobile-entry-gate {
    display: block;
    font-family: inherit;
    font-size: 13px;
}

/* =========================================================
   Loading icon
   Rotating animation (GPU-friendly)
   ========================================================= */

.spinner {
    width: var(--spinner-size);
    height: var(--spinner-size);
    margin-bottom: 14px;

    background-image: url("../assets/icon.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    animation: spin 1.2s linear infinite;
} 

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   Loading text
   ========================================================= */

.loading-text {
    font-size: 14px;
    color: #ffffff;
    letter-spacing: 0.2px;
    font-weight: 500;
}

/* =========================================================
   Panel resizer handle
   ========================================================= */

#panel-resizer {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    z-index: 20;
}

#mobile-entry-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

.mobile-entry-linkline {
    margin: 10px 0 0;
    font-size: 13px;
    color: #777;
    line-height: 1.5;
    word-break: break-all;
}

.mobile-entry-linkline a {
    color: var(--link-color);
    text-decoration: underline;
}

.mobile-entry-linkline a:hover {
    color: #4a90e2;
}

#mobile-entry-btn {
    margin-top: 14px;
    display: block;
    width: auto;
    min-width: 92px;
    height: 30px;
    padding: 0 14px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.95);
    color: #666;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#mobile-entry-btn:hover {
    background: rgba(74, 144, 226, 0.1);
    border-color: #4a90e2;
    color: #4a90e2;
}

#mobile-entry-btn:active {
    background: rgba(74, 144, 226, 0.16);
}
