/* --- UI COMPONENTS & SIDEBAR --- */
/* Extracted from style.css */

/* Sidebar Container */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 3000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow-y: auto;
    padding: 60px 15px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}

#sidebar.active {
    transform: translateX(0);
}

/* Buttons */
button {
    width: 100%;
    background: #2a2a2a;
    color: #eee;
    border: 1px solid #444;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    touch-action: manipulation;
}

button:hover {
    background: #333;
    border-color: #666;
}

button:active {
    transform: scale(0.98);
}

button.selected {
    background: #0066ff;
    border-color: #0056b3;
    color: white;
}

button.alert {
    background: #441111;
    border-color: #ff4444;
    color: #ff8888;
}

/* Hamburger Menu */
#menu-btn {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 3100;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

#menu-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Recenter Button */
#recenter-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0088ff;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 136, 255, 0.4);
    z-index: 2500;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}

#recenter-btn.visible {
    transform: translateX(-50%) translateY(0);
}

#recenter-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* Panels & Typography */
.panel {
    position: relative;
    width: 100%;
    background: transparent;
    padding: 0 0 15px 0;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffd700;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 4px;
}

h4 {
    margin: 12px 0 6px 0;
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

/* Inputs & Rows */
select,
input[type=text],
input[type=range] {
    width: 100%;
    background: #222;
    color: #eee;
    border: 1px solid #444;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

.toggle-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.toggle-btn {
    flex: 1;
    text-align: center;
}

.status-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 6px;
}

.val {
    color: #00ff99;
    font-weight: bold;
    font-family: monospace;
}

.pref-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.pref-row span {
    font-size: 12px;
    color: #888;
}

.pref-row select {
    width: 65%;
    margin-bottom: 0;
    padding: 4px;
}

label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    cursor: pointer;
}

.hint {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* --- TURN VISUALS --- */
#step-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    /* Flex, but hidden by transform/opacity */
    align-items: center;
    gap: 15px;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 250px;
}

#step-box.visible {
    transform: translateX(-50%) translateY(0);
}

#step-icon {
    font-size: 32px;
}

#step-details {
    display: flex;
    flex-direction: column;
}

#step-road {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}

#step-dist {
    font-size: 14px;
    color: #00ff99;
    font-weight: 500;
}

/* --- SPEED LIMIT SIGN --- */
#speed-limit-sign {
    position: absolute;
    right: -60px;
    /* Shift nicely to the right of the step box */
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 54px;
    background: white;
    border: 3px solid black;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.limit-caption {
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 8px;
    font-weight: 900;
    color: black;
    text-transform: uppercase;
    line-height: 8px;
    text-align: center;
    margin-top: 2px;
}

#speed-limit-val {
    font-family: 'Arial', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: black;
    line-height: 24px;
    margin-top: 2px;
}

/* --- SEARCH BAR --- */
/* --- SEARCH BAR --- */
#search-container {
    position: fixed;
    top: 20px;
    left: 70px; /* Moved right to clear menu */
    width: 320px;
    z-index: 2500;
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 8px; /* Space between bar and button */
    /* Shadow removed from here, applied to row */
}

/* Wrapper for Input + Search Button */
.search-bar-row {
    display: flex;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 6px;
}

#search-input {
    flex: 1;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid #444;
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: white;
    padding: 12px;
    font-size: 14px;
    margin: 0;
    backdrop-filter: blur(5px);
}

#search-btn {
    width: 50px;
    background: #0066ff;
    border: 1px solid #0056b3;
    border-radius: 0 6px 6px 0;
    color: white;
    font-size: 16px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-pick-gps {
    width: 100%;
    background: rgba(0, 50, 0, 0.85);
    color: #00ff00;
    border: 1px solid #00aa00;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: background 0.2s;
}

#btn-pick-gps:hover {
    background: rgba(0, 80, 0, 0.95);
}

#btn-pick-gps.active {
    background: #00ff00;
    color: black;
    box-shadow: 0 0 15px #00ff00;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 13px;
    color: #ddd;
}

.search-item:hover {
    background: #004488;
    color: white;
}

.item-name {
    font-weight: bold;
    color: white;
    margin-bottom: 2px;
}

.item-desc {
    font-size: 11px;
    color: #999;
}

/* --- LOCATION PANEL (Bottom Sheet) --- */
#location-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    /* Hidden */
    width: 90%;
    max-width: 400px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 15px;
    z-index: 2600;
    color: white;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 80vh;
    overflow-y: auto;
}

#location-panel.visible {
    transform: translateX(-50%) translateY(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.panel-header h3 {
    margin: 0;
    border: none;
    color: #00ff99;
}

.close-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    color: #888;
    font-size: 24px;
    margin: 0;
}

.loc-section {
    margin-bottom: 15px;
}

.loc-val {
    font-size: 14px;
    color: white;
    margin-top: 5px;
    line-height: 1.4;
}

.loc-list {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nearby-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.nearby-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.loc-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.loc-actions button {
    margin: 0;
    flex: 1;
}