/* --- 1. Variables & Base Settings --- */
:root {
    --primary-color: #4f46e5;
    /* Indigo-600 */
    --primary-hover: #4338ca;
    /* Indigo-700 */
    --accent-color: #8b5cf6;
    /* Violet-500 */
    --text-primary: #111827;
    /* Gray-900 */
    --text-secondary: #4b5563;
    /* Gray-600 */
    --text-light: #9ca3af;
    /* Gray-400 */

    --bg-glass: rgba(255, 255, 255, 0.90);
    --bg-glass-heavy: rgba(255, 255, 255, 0.95);
    --bg-surface: #ffffff;

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);

    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-main: 'Inter', 'Prompt', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;

    --z-map: 1;
    --z-panel: 1000;
    --z-controls: 1100;
    --z-modal: 5000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: #f3f4f6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes route-flow {
    to {
        stroke-dashoffset: -40px;
    }
}

/* Utilities */
.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* --- 2. Map Container --- */
#map-container {
    position: fixed;
    inset: 0;
    z-index: var(--z-map);
}

#mapid {
    width: 100%;
    height: 100%;
    background-color: #e5e7eb;
}

/* --- 3. Sidebar (Panel Left) --- */
.floating-panel {
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#panel-left {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 360px;
    height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    z-index: var(--z-panel);
    transform: translateX(calc(-100% - 2rem));
    /* Hiddeen by default */
    padding: 0;
    /* Clear padding, manage in children */
    overflow: hidden;
}

#panel-left.is-visible {
    transform: translateX(0);
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-top h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-top h2 i {
    font-size: 1.4rem;
}

#back-to-categories {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    /* JS toggles this */
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

#back-to-categories:hover {
    color: var(--primary-color);
}

/* Tabs */
#sidebar-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: var(--radius-md);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.tab-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: var(--shadow-soft);
}

/* List */
#building-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 1rem;
}

#building-list::-webkit-scrollbar {
    width: 6px;
}

#building-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

#building-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.list-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.list-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(79, 70, 229, 0.2);
}

.list-item.active {
    background: #eef2ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.item-icon {
    font-size: 1.4rem;
    color: #9ca3af;
    transition: color 0.2s;
}

.list-item:hover .item-icon,
.list-item.active .item-icon {
    color: var(--primary-color);
}

.item-name {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Placeholder */
.placeholder-item {
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.7;
    pointer-events: none;
    padding: 2rem;
    box-shadow: none;
    background: transparent;
}

#favorites-empty-placeholder {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-light);
    text-align: center;
}

/* --- 4. Search & Top Controls --- */
#top-right-controls {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: var(--z-controls);
    display: flex;
    align-items: center;
    gap: 1rem;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

#top-right-controls>* {
    pointer-events: auto;
}

#search-container {
    position: relative;
    width: 320px;
}

#search-input {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 20px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bg-surface);
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

#search-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2), var(--shadow-lg);
    border-color: var(--primary-color);
}

.search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.25rem;
    pointer-events: none;
}

#search-clear-btn {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    display: none;
}

#search-clear-btn:hover {
    color: var(--text-secondary);
}

#search-results {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    padding: 8px;
    animation: slideUp 0.2s ease-out;
}

.search-result-item {
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.search-result-item:hover {
    background: #f3f4f6;
}

.search-result-item i {
    font-size: 1.25rem;
    color: var(--text-light);
}

.search-result-item span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.search-result-subtext {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 0 !important;
    margin-top: 2px;
}

/* Action Buttons (Desktop) */
.top-control-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

.top-control-btn:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.15);
}

#lang-toggle-btn-desktop {
    height: 52px;
    padding: 0 1.5rem;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    font-family: var(--font-mono);
    transition: all 0.2s;
}

#lang-toggle-btn-desktop:hover {
    color: var(--primary-color);
}

/* Menu Toggle */
#main-menu-toggle {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: white;
    border: none;
    z-index: 2000;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#main-menu-toggle:hover {
    background: var(--primary-hover);
    transform: rotate(90deg);
}

/* --- 5. Mobile Nav --- */
#mobile-nav {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: var(--z-controls);
    display: none;
    /* Hidden on desktop */
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

#mobile-nav button {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
}

#mobile-nav button i {
    font-size: 1.6rem;
    margin-bottom: 2px;
}

#mobile-nav button.active,
#mobile-nav button:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* --- 6. Route Summary --- */
#route-summary-container {
    position: fixed;
    top: 6rem;
    /* Below controls */
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-controls);
    font-family: var(--font-mono);
    display: none;
    animation: slideUp 0.3s;
}

#route-summary-container.visible {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- 7. Modals --- */
.modal-overlay,
#info-modal,
#share-modal,
#lang-select-modal,
#rating-modal,
#gmaps-redirect-modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    /* Gray-900 with opacity */
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.is-visible {
    display: flex !important;
}

.modal-content,
.rating-content,
.lang-select-content {
    background: white;
    width: 90%;
    max-width: 480px;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.modal-body .input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.modal-body input,
.modal-body textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.modal-body button {
    padding: 10px 16px;
    border: none;
    background: #f3f4f6;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-body button:hover {
    background: #e5e7eb;
}

/* MODIFIED: Share Modal Styles */
#share-modal .modal-content {
    background: white;
    padding: 32px;
    border-radius: 24px;
    max-width: 90%;
    width: 480px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

#share-modal .modal-header {
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
}

#share-modal .modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

#share-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Social Share Section */
#share-social-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 700;
    margin-bottom: 12px;
    display: block;
    text-align: center;
}

#share-social-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
}

.social-btn {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.social-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

.social-btn.facebook {
    background: linear-gradient(135deg, #1877F2, #0C5DC7);
}

.social-btn.twitter {
    background: linear-gradient(135deg, #1DA1F2, #0C85D0);
}

.social-btn.line {
    background: linear-gradient(135deg, #06C755, #00B900);
}

/* Share Link & Embed Section */
#share-url-label,
#embed-code-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

#share-modal .input-group {
    display: flex;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 6px;
    transition: all 0.2s;
}

#share-modal .input-group:focus-within {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#share-modal input[type="text"],
#share-modal textarea {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    width: 100%;
}

#share-modal button {
    background: white;
    border: 1px solid #e5e7eb;
    color: var(--text-primary);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#share-modal button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

#share-modal small {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.share-divider {
    display: none;
}

/* Hide old divider */
/* --- 8. Leaflet Customization & Map Elements --- */
.leaflet-popup-content-wrapper {
    background: transparent;
    /* Wrapper is now transparent */
    box-shadow: none;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    /* Reset margin */
    min-width: 300px;
    max-width: 340px;
    background: transparent;
}

.leaflet-popup-tip-container {
    display: none;
}

/* Hide the tip for a cleaner floating card look */
.leaflet-container a.leaflet-popup-close-button {
    top: 12px;
    right: 12px;
    color: white;
    /* White close button for dark header */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
    transition: all 0.2s;
    text-shadow: none;
    z-index: 10;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.4);
    color: white;
}

/* New Premium Popup Styles */
.wugo-popup-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    /* Deep shadow */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.wugo-popup-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    padding: 24px 20px 20px;
    color: white;
    position: relative;
}

.wugo-popup-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    padding-right: 30px;
    /* Space for close button */
    letter-spacing: -0.01em;
}

.wugo-popup-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Body */
.wugo-popup-body {
    padding: 20px;
    background: white;
    max-height: 200px;
    overflow-y: auto;
}

.wugo-popup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wugo-popup-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wugo-popup-list li i {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.wugo-popup-desc {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Footer & Buttons */
.wugo-popup-footer {
    padding: 16px 20px;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 12px;
    align-items: center;
}

.wugo-actions-group {
    display: flex;
    gap: 8px;
}

.wugo-btn-primary {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
    transition: all 0.2s;
}

.wugo-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
}

.wugo-btn-secondary {
    background: white;
    border: 1px solid #e5e7eb;
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wugo-btn-secondary:hover {
    border-color: var(--text-light);
    background: #f3f4f6;
    color: var(--text-primary);
}

.wugo-btn-secondary.is-active {
    color: #f59e0b;
    /* Amber for favorite */
    border-color: #fcd34d;
    background: #fffbeb;
}

/* Map Markers & Lines */
.leaflet-routing-animated-line {
    stroke-dasharray: 20, 20;
    stroke-linecap: round;
    animation: route-flow 1s linear infinite;
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.6));
}

@keyframes route-flow {
    to {
        stroke-dashoffset: -40px;
    }
}

/* Modern Navigation Arrow (True Triangle) */
.user-heading-marker {
    background: transparent;
    border: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    will-change: transform;
    /* Optimize for rotation */
}

/* The Arrow Head */
.user-heading-marker::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%) rotate(0deg);
    /* Centered and pointing up by default */
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 30px solid var(--primary-color);
    /* The Arrow Color */
    border-radius: 4px;
    /* Slight roundness */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    z-index: 10;
}

/* The White "Center" or Detail on the arrow for depth */
.user-heading-marker::after {
    content: '';
    position: absolute;
    top: 5px;
    /* Offset slightly to be inside the arrow */
    left: 0;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    z-index: 11;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Hide default grey dashed lines from Routing Machine */
/* Target paths with stroke-dasharray that are NOT our animate line */
.leaflet-overlay-pane path[stroke-dasharray]:not(.leaflet-routing-animated-line) {
    stroke: transparent !important;
    fill: transparent !important;
    display: none !important;
}

/* Also hide specific routing connection lines if they use default styling */
.leaflet-routing-alt,
.leaflet-routing-geocoders,
.leaflet-routing-collapse-btn {
    display: none !important;
    /* Hide LRM default control UI elements if any leak through */
}

/* Directional Arrow (Triangle) - Added via JS or CSS shape if preferred,
   but circle is often more stable. Let's try a distinct Directional Arrow for 'Heading'
   if rotation is active */

.user-heading-arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 24px solid var(--primary-color);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    position: absolute;
    top: -12px;
    left: -10px;
}

.kml-name-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-primary) !important;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 13px;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
    pointer-events: none;
}

.leaflet-control-rotate {
    top: 80px;
    right: 1.5rem;
    position: fixed !important;
    border: none !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: 8px !important;
}

/* Directions Panel (Sidebar mode) */
#directions-panel {
    /* Manual reuse of floating-panel styles */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 360px;
    z-index: 1001;
    transform: translateX(calc(-100% - 2rem));
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-surface);
    /* Solid bg for inputs readability */
}

#directions-panel.is-visible {
    transform: translateX(0);
}

.directions-input-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.directions-input-group i {
    color: var(--text-light);
    font-size: 1.25rem;
}

.directions-input-group input {
    border: none;
    background: transparent;
    flex: 1;
    font-weight: 500;
}

.get-directions-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
    transition: all 0.2s;
}

.get-directions-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* --- 9. Responsive --- */
@media (max-width: 1024px) {
    #panel-left {
        width: 100%;
        top: auto;
        bottom: 0;
        left: 0;
        height: 60vh;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s;
    }

    #panel-left.is-visible {
        transform: translateY(0);
    }

    #top-right-controls {
        top: 1.5rem;
        left: 16px;
        right: 16px;
        width: auto;
        justify-content: space-between;
    }

    #search-container {
        flex: 1;
        width: auto;
    }

    #mobile-nav {
        display: flex;
    }

    .top-control-btn,
    #lang-toggle-btn-desktop {
        display: none;
    }

    /* Show only search bar on top */

    /* Move main menu toggle to right of search bar or hide it */
    #main-menu-toggle {
        top: 1.5rem;
        left: auto;
        right: 1.5rem;
        display: none;
        /* Hide custom toggle, rely on bottom nav for features */
    }
}

/* --- Improved Star Rating UI --- */

/* Container for the stars */
#rating-stars-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    /* Add space between stars */
    margin: 25px 0 15px;
    /* Add vertical spacing */
    padding: 10px;
    background: #f9fafb;
    /* Light background to frame the stars */
    border-radius: 16px;
}

/* Individual Star Styling */
#rating-stars-container .star {
    font-size: 2.8rem;
    /* Significantly larger */
    color: #e5e7eb;
    /* Default gray (inactive) */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
    padding: 2px;
    /* Increase touch target area */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Hover Effect */
#rating-stars-container .star:hover {
    transform: scale(1.25);
    /* Pop effect on hover */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

/* Hover State (fill up to the hovered star) */
#rating-stars-container .star.hovered {
    color: #ffd700;
    /* Gold */
}

/* Active State (fill up to the selected rating) */
#rating-stars-container .star.active {
    color: #fbbf24;
    /* Amber-500 */
}

/* When the container is 'selected', hovering shouldn't change colors (handled by JS, but we ensure style holds) */
#rating-stars-container.selected .star {
    cursor: default;
    transform: none;
}

/* --- Modern User Location Popup --- */
.custom-user-popup .leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    background: transparent;
}

.custom-user-popup .leaflet-popup-tip-container {
    width: 20px;
    height: 10px;
}

.custom-user-popup .leaflet-popup-tip {
    background: white;
    box-shadow: none;
}

.custom-user-popup .leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
    line-height: 1.5;
}

.custom-user-popup a.leaflet-popup-close-button {
    color: white !important;
    top: 12px !important;
    right: 12px !important;
    font-size: 18px !important;
    width: 24px !important;
    height: 24px !important;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    transition: background 0.2s;
}

.custom-user-popup a.leaflet-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.4);
    color: white;
}

.user-popup-card {
    min-width: 260px;
    font-family: 'Inter', 'Prompt', sans-serif;
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.user-popup-header {
    background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    position: relative;
}

.user-popup-header i {
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px;
    border-radius: 8px;
}

.user-popup-body {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.user-popup-coords {
    background: #f3f4f6;
    color: #4b5563;
    padding: 6px 14px;
    border-radius: 9999px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
}

.user-popup-coords i {
    color: #6b7280;
}

.user-popup-actions {
    width: 100%;
}

.btn-share-modern {
    width: 100%;
    background: white;
    border: 1px solid #e5e7eb;
    color: #374151;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-share-modern:hover {
    background-color: #f9fafb;
    border-color: #4f46e5;
    color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-share-modern:active {
    transform: translateY(0);
}

/* --- Custom Alert & Modal Styles (Unified) --- */
.alert-content,
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    /* More rounded */
    padding: 32px 24px;
    text-align: center;
    max-width: 90%;
    width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.warning-icon i,
.modal-icon-large i {
    font-size: 4rem;
    color: #f59e0b;
    /* Amber */
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(245, 158, 11, 0.2));
    display: inline-block;
}

.modal-icon-large i {
    color: #4f46e5;
    /* Blue for Gmaps */
    filter: drop-shadow(0 4px 6px rgba(79, 70, 229, 0.25));
}

#alert-modal-title,
#gmaps-modal-title {
    font-size: 1.35rem;
    /* Larger */
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.3;
}

#alert-modal-message,
#gmaps-modal-message {
    font-size: 1rem;
    color: #6b7280;
    /* Softer gray */
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-button-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-action-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    /* Match modal roundness */
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-action-button.primary {
    background: #4f46e5;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.modal-action-button.primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.modal-action-button.secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.modal-action-button.secondary:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Explicitly target the gmaps modal elements by ID just in case */
#gmaps-redirect-btn {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#gmaps-redirect-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

#gmaps-redirect-btn i {
    color: #DB4437;
    /* Google Red */
    font-size: 1.4rem;
}

/* --- Ultra Minimal Context Menu (Icon Only) - FINAL CLEAN --- */
.context-menu-popup-minimal .leaflet-popup-content-wrapper {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 0;
    overflow: hidden;
}

.context-menu-popup-minimal .leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
    min-width: 100px;
    /* Compact */
}

/* Hide the triangle tip completely */
.context-menu-popup-minimal .leaflet-popup-tip-container {
    display: none;
}

/* Flex container for icons */
.context-menu-minimal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    gap: 12px;
    background: white;
}

/* Circular Icon Buttons */
.ctx-icon-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    outline: none;
}

.ctx-icon-btn i {
    font-size: 24px;
    color: #a855f7;
    /* Purple */
    display: block;
}

.ctx-icon-btn:hover {
    background-color: #f3e8ff;
}

/* Vertical Divider Line */
.ctx-divider {
    width: 1px;
    height: 24px;
    background-color: #e5e7eb;
}

/* Pulse Animation for User Marker */
.user-location-marker {
    background: #4f46e5;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    cursor: auto !important;
}

.user-location-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    background: rgba(79, 70, 229, 0.4);
    border-radius: 50%;
    opacity: 0;
    animation: user-pulse 3s infinite ease-out;
    pointer-events: none;
    z-index: -1;
}

@keyframes user-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* --- 8. Glassmorphism Map Popup (Modern Redesign) --- */
.leaflet-popup-glass .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    padding: 0 !important;
}

.leaflet-popup-glass .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.85) !important;
    box-shadow: none !important;
}

.leaflet-popup-glass .leaflet-popup-content {
    margin: 10px !important;
    line-height: 1.5;
}

.glass-popup-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 8px;
}

.wugo-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: wugo-spin 0.8s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes wugo-spin {
    to {
        transform: rotate(360deg);
    }
}

.glass-popup-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.glass-popup-subtext {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 400;
}