:root {
    --primary-color: #2563eb;
    /* Blue 600 */
    --primary-hover: #1d4ed8;
    --secondary-color: #1e293b;
    --accent-color: #38bdf8;
    /* Sky 400 */

    --bg-dark: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
    height: -webkit-fill-available;
    width: 100vw;
}

#app-container {
    position: relative;
    width: 100%;
    /* Layered fallbacks: --real-vh (JS, works on all browsers) > dvh > vh */
    height: 100vh;
    height: 100dvh;
    height: calc(var(--real-vh, 1vh) * 100);
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--real-vh, 1vh) * 100);
    z-index: 1;
}

/* Glassmorphism Classes */
.glass-header,
.glass-panel,
.glass-drawer,
.glass-modal {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Floating Header */
.glass-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 64px;
    border-radius: var(--radius-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 24px;
    justify-content: space-between;
}

.header-content {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* User Actions */
.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    cursor: pointer;
}

.auth-icon-mobile {
    display: none;
}

/* Drawer Extensions */
.left-drawer {
    left: 0;
    right: auto;
    border-radius: 0 20px 20px 0;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.left-drawer.hidden {
    transform: translateX(-100%);
    display: flex !important;
    /* Force display flex but use transform to hide */
    pointer-events: none;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
    flex: 1;
    /* fill remaining height after the drawer header */
    overflow-y: auto;
    /* scroll within the nav if content is taller than screen */
    overflow-x: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item svg {
    color: var(--text-secondary);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item:hover svg {
    color: var(--accent-color);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-item.active svg {
    color: var(--primary-color);
}

/* Search Overlay */
.search-overlay {
    position: absolute;
    top: 100px;
    left: 20px;
    width: 300px;
    /* Or responsive */
    padding: 12px;
    border-radius: var(--radius-md);
    z-index: 1000;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    /* background: rgba(255,255,255,0.05); */
    border-radius: var(--radius-sm);
    padding: 4px 8px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-size: 0.95rem;
}

.search-icon {
    color: var(--text-secondary);
}

/* Results Card (Bottom) */
.bottom-card {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 20px;
    z-index: 1000;
}

.results-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.result-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.value-container {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.unit-select {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.divider {
    width: 1px;
    background: var(--glass-border);
    margin: 0 20px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
    width: 54px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: var(--radius-md) !important;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}

.fluid {
    width: 100%;
}

/* Modal / Drawer */
.hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-modal {
    width: 90%;
    max-width: 400px;
    padding: 24px;
    border-radius: var(--radius-lg);
}

.glass-modal h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: white;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.input-group.error input {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.error-text {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 6px;
    display: block;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn-google {
    background: white;
    color: #444;
    gap: 12px;
    margin-top: 12px;
}

.btn-google:hover {
    background: #f1f5f9;
}

/* Sidebar Drawer */
.glass-drawer {
    position: fixed;
    /* fixed so it's always relative to the viewport, not parent */
    top: 0;
    width: 320px;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--real-vh, 1vh) * 100);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* clip content so nothing bleeds outside the background */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.right-drawer {
    right: 0;
    border-radius: 20px 0 0 20px;
    transform: translateX(0);
}

.right-drawer.hidden {
    transform: translateX(100%);
    display: flex !important;
    pointer-events: none;
}

.drawer-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.saved-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.saved-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.saved-item h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.saved-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

#results-card:not(.hidden) {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.btn-mode {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.9rem;
    gap: 8px;
}

.btn-mode.active {
    background: var(--primary-color);
    color: white;
}

.btn-mode:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Map Controls */
.map-controls {
    position: absolute;
    right: 20px;
    top: 104px;
    /* Under header */
    bottom: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

#btn-location {
    background: var(--secondary-color);
    color: var(--text-primary);
}

#btn-location:hover {
    background: var(--primary-color);
}

/* Layers Panel Styles */
#layers-panel {
    position: absolute;
    right: 80px;
    top: 104px;
    bottom: auto;
    width: 200px;
    padding: 16px;
    border-radius: var(--radius-lg);
    z-index: 1000;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateX(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

#layers-panel h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.layer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.layer-item.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
}

.layer-preview {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.layer-preview.satellite {
    background-image: url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/10/380/600');
    /* Sample Satellite tile */
}

.layer-preview.street {
    background-image: url('https://a.tile.openstreetmap.org/10/512/341.png');
    /* Sample Street tile */
}

.layer-item span {
    font-weight: 500;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    #layers-panel {
        right: 70px;
        bottom: 240px;
    }
}

/* Save Modal Preview */
.measurement-preview {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: row;
    /* Side by side if possible */
    gap: 20px;
    justify-content: center;
    border: 1px solid var(--glass-border);
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-item span:first-child {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 4px;
}

.preview-value #save-preview-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-color);
}

.preview-value #save-preview-unit {
    font-weight: 600;
    color: var(--text-primary);
}

/* State-based Visibility */
.results-header .result-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mode-distance #result-area {
    opacity: 0.2;
    pointer-events: none;
    transform: scale(0.9);
}

.mode-area #result-distance {
    /* distance is usually perimeter in area mode, so maybe don't hide it entirely but de-emphasize */
    opacity: 0.4;
    transform: scale(0.95);
}

/* Leaflet Customization */
.leaflet-container {
    background: var(--bg-dark);
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--glass-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--secondary-color) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    margin-right: 20px !important;
    /* Align with .map-controls */
    margin-bottom: 20px !important;
}

.leaflet-control-zoom a {
    width: 54px !important;
    height: 44px !important;
    line-height: 44px !important;
    background: transparent !important;
    /* Handled by container */
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Attribution Styling */
.leaflet-control-attribution {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 2px 8px !important;
    font-size: 0.7rem !important;
}

@media (max-width: 768px) {
    .leaflet-control-zoom {
        margin-right: 10px !important;
        margin-bottom: 10px !important;
    }
}

.leaflet-control-attribution a {
    color: var(--accent-color) !important;
    text-decoration: none !important;
}

.leaflet-control-attribution a:hover {
    text-decoration: underline !important;
}

/* Mobile Scroll Hint */
.scroll-hint {
    display: none;
}

@media (max-width: 768px) {
    .scroll-hint {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 14px 0 10px;
        color: var(--text-secondary);
        font-size: 0.75rem;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        font-weight: 500;
        animation: scrollBounce 2s ease-in-out infinite;
    }

    .scroll-hint svg {
        opacity: 0.6;
    }
}

@keyframes scrollBounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    50% {
        transform: translateY(5px);
        opacity: 1;
    }
}

/* Static Pages Support */
.static-page {
    background: var(--bg-dark);
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
}

.static-page #app-container {
    padding-top: 100px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.content-area {
    width: 90%;
    max-width: 800px;
    padding: 40px;
    border-radius: var(--radius-lg);
    margin: 0 auto;
}

.content-area section {
    margin-bottom: 32px;
}

.content-area h2 {
    margin-bottom: 12px;
    color: var(--primary-color);
}

.content-area p {
    line-height: 1.6;
    color: var(--text-secondary);
}

.seo-thumbnail {
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Profile Specific */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.avatar-container {
    position: relative;
    display: inline-block;
}

.large-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.large-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.avatar-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.profile-info h2 {
    margin: 0 0 8px 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-info p {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.profile-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.danger-zone {
    margin-top: 48px;
    padding: 32px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.02));
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.danger-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.danger-header h3 {
    color: #ef4444;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.danger-content {
    margin-left: 36px;
}

.danger-content p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.danger-actions {
    margin: 20px 0;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Action buttons refinement for profile/dialogs */

.action-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.action-buttons .btn:hover {
    transform: translateY(-2px);
}

.small-note {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Mobile Promo */
.mobile-promo {
    text-align: center;
    padding: 20px 0;
}

.app-buttons {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.play-store-badge img {
    height: 80px;
    width: auto;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.play-store-badge:hover img {
    transform: scale(1.05) translateY(-2px);
}

.app-preview {
    margin: 40px auto;
    max-width: 360px;
    padding: 30px;
    background: #000;
    border-radius: 48px;
    position: relative;
    box-shadow:
        0 40px 100px -20px rgba(0, 0, 0, 0.8),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-preview::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.app-screenshot {
    width: 100%;
    display: block;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

.app-preview:hover {
    transform: translateY(-10px) scale(1.02);
}

.features-list {
    text-align: left;
    margin-top: 50px;
}

/* Leaflet Overrides */
/* Mobile Responsive Styles */
@media (max-width: 768px) {

    /* Map: slightly shorter than screen so user sees content peek below.
       --real-vh is set by JS to window.innerHeight/100 — the only reliable
       fix for Chrome Android where 100vh > actual visible area. */
    #map {
        height: 95vh;
        /* oldest browsers */
        height: 95dvh;
        /* modern browsers */
        height: calc(var(--real-vh, 1vh) * 95);
        /* Chrome Android fix */
        border-radius: 0 0 24px 24px;
    }

    /* App container matches map height so scroll starts at map bottom */
    #app-container {
        height: 95vh;
        height: 95dvh;
        height: calc(var(--real-vh, 1vh) * 95);
        overflow: visible;
    }

    /* Header Adjustments */
    .glass-header {
        top: 10px;
        left: 10px;
        right: 10px;
        height: 56px;
        padding: 0 12px;
    }

    .header-left {
        gap: 8px;
    }

    .logo h1 {
        font-size: 1rem;
        display: none;
    }

    .logo svg {
        display: none;
    }

    .auth-icon-mobile {
        display: block;
    }

    @media (min-width: 480px) {
        .logo h1 {
            display: block;
        }
    }

    .user-actions {
        gap: 6px;
    }

    @media (max-width: 400px) {
        .glass-header {
            left: 5px;
            right: 5px;
            padding: 0 8px;
        }

        .header-left {
            gap: 4px;
        }
    }

    #btn-show-saved .btn-text,
    #auth-btn .btn-text {
        display: none;
        /* Icon only or shortened text */
    }

    #btn-show-saved svg,
    #auth-btn svg {
        margin-right: 0 !important;
    }

    .btn {
        padding: 8px 12px;
    }

    /* Search Bar Adjustment */
    .search-overlay {
        top: 72px;
        left: 10px;
        right: 10px;
        width: auto;
    }

    /* Bottom Results Card */
    .bottom-card {
        bottom: 20px;
        width: calc(100% - 20px);
        padding: 16px;
    }

    .results-header {
        margin-bottom: 16px;
    }

    .value {
        font-size: 1.25rem;
    }

    .divider {
        margin: 0 10px;
    }

    .mode-switcher {
        margin-bottom: 12px;
    }

    .btn-mode {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Map Controls (Location & Layers) */
    .map-controls {
        right: 10px;
        top: 130px;
        /* Under search overlay */
        bottom: auto;
        flex-direction: column-reverse;
    }

    #layers-panel {
        right: 70px;
        top: 130px;
        bottom: auto;
    }

    /* Drawers */
    .glass-drawer {
        width: 100%;
        max-width: none;
        border-radius: 0;
    }

    .left-drawer {
        left: 0;
        right: auto;
        border-radius: 0;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .left-drawer.hidden {
        left: -100%;
        transform: none;
    }

    .right-drawer {
        right: 0;
        border-radius: 0;
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .right-drawer.hidden {
        right: -100%;
        transform: none;
    }

    /* Modals */
    .glass-modal {
        width: 95%;
        padding: 20px;
    }

    .measurement-preview {
        flex-direction: column;
        gap: 12px;
    }

    /* Static Pages */
    .content-area {
        width: 100%;
        padding: 20px 16px;
        margin: 0;
        border-radius: 0;
    }

    .static-page #app-container {
        padding-top: 80px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .profile-info h2 {
        font-size: 1.5rem;
    }

    .profile-status {
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .danger-zone {
        padding: 24px;
        margin-top: 32px;
    }

    .danger-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        margin-bottom: 12px;
    }

    .danger-content {
        margin-left: 0;
        text-align: center;
    }

    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .action-buttons .btn:not(.btn-icon) {
        width: 100%;
        order: 2;
        /* Move Save button to bottom */
    }

    .action-buttons .btn-icon {
        flex: 1;
        /* Allow them to stretch into rectangles */
        order: 1;
        /* Keep Undo/Clear at top */
    }

    /* Solution Pages Mobile Overrides */
    .solution-hero h1,
    .solution-hero h2 {
        font-size: 1.8rem;
        margin-bottom: 16px;
    }

    .solution-hero p {
        font-size: 1rem;
    }

    .content-area {
        width: 100%;
        border-radius: 0;
        padding: 24px 16px;
    }

    .features-grid,
    .info-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .feat-card,
    .info-card {
        padding: 24px;
    }

    .site-footer {
        padding: 48px 16px;
        margin-top: 48px;
    }

    .footer-links {
        gap: 16px 24px;
    }
}

/* Landscape Mobile Fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .glass-header {
        height: 48px;
        top: 5px;
    }

    .bottom-card {
        bottom: 10px;
        padding: 10px;
    }

    .results-header {
        margin-bottom: 8px;
    }

    .map-controls {
        top: 60px;
        bottom: auto;
    }
}

/* Auth Card (for standalone pages) */
.auth-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 450px;
    width: 100%;
    margin: 40px auto;
    text-align: center;
    backdrop-filter: blur(10px);
}

.auth-card-header {
    margin-bottom: 32px;
}

.auth-icon {
    width: 80px;
    height: 80px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-card-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-card-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-form {
    text-align: left;
}

.divider-text {
    text-align: center;
    margin: 24px 0;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.divider-text::before,
.divider-text::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: var(--glass-border);
}

.divider-text::before {
    left: 0;
}

.divider-text::after {
    right: 0;
}

.btn-google {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    gap: 12px;
}

.btn-google:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 8px;
    transition: all 0.2s;
    text-align: center;
}

.btn-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.btn-outline {
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.small-note {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 16px;
    font-style: italic;
}

.danger-zone {
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 24px;
    background: rgba(239, 68, 68, 0.02);
}

.danger-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* Decorative Background Glows */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    animation: glowFloat 20s infinite alternate ease-in-out;
}

.bg-glow-1 {
    top: -200px;
    right: -100px;
    background: var(--primary-color);
}

.bg-glow-2 {
    bottom: -200px;
    left: -100px;
    background: var(--accent-color);
    animation-delay: -5s;
}

@keyframes glowFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 100px) scale(1.1);
    }
}

.danger-header h3 {
    color: #ef4444;
    margin: 0;
}

.danger-content p {
    margin-bottom: 20px;
}

.danger-actions {
    margin-bottom: 16px;
}

/* --- Premium Design Upgrades --- */

/* Entrance Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-header,
.stat-card,
.danger-zone,
.auth-card,
.deletion-info-card {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

/* Enhanced Glass Panels */
.glass-panel {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Pro Stat Cards */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-value {
    font-size: 1.5rem;
    background: linear-gradient(to bottom, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Premium Danger Zone */
.danger-zone {
    border: 1px solid rgba(239, 68, 68, 0.15);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.03) 0%, rgba(15, 23, 42, 0) 100%);
    box-shadow: 0 10px 30px -15px rgba(239, 68, 68, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Deletion Info Upgrades */
.deletion-info-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.info-header svg {
    filter: drop-shadow(0 0 8px var(--primary-color));
}

/* Badge Glow */
.status-indicator {
    box-shadow: 0 0 12px #10b981;
}

/* --- Deletion Info (Public) --- */
.deletion-info-card {
    margin-top: 48px;
    padding: 32px;
    border-radius: var(--radius-lg);
}

.info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.info-header h3 {
    margin: 0 !important;
    font-size: 1.25rem;
    color: var(--text-primary) !important;
    letter-spacing: -0.02em;
}

.info-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.info-content ul {
    margin-bottom: 24px;
    padding-left: 0;
    list-style: none;
}

.info-content li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-content li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.info-content strong {
    color: var(--text-primary);
}

.info-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    transition: all 0.2s;
}

.info-content a:hover {
    border-bottom-color: var(--accent-color);
}

/* Profile Outline (Initial State) */
.profile-outline-card {
    padding: 32px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.2);
    margin-bottom: 24px;
    text-align: center;
}

.outline-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    justify-content: center;
}

.outline-avatar {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.outline-content {
    flex: 0;
    min-width: 150px;
}

.skeleton-line {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    margin-bottom: 10px;
}

.skeleton-line.long {
    width: 100%;
}

.skeleton-line.short {
    width: 60%;
}

.outline-hint {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.data-safety-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #10b981;
    font-weight: 600;
}

/* Pro Identity Icons */
.auth-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.auth-icon-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.2;
    animation: authPulse 3s infinite ease-out;
    z-index: -1;
}

@keyframes authPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Glowing Buttons */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.btn-glow:hover::before {
    opacity: 1;
}

/* Info Grid Layout */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.info-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-box-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.mini-icon {
    width: 40px;
    height: 40px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-safety-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #10b981;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Drawer Solutions SEO Block */
.drawer-solutions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 20px;
    padding-right: 20px;
}

.drawer-solutions h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    opacity: 0.7;
}

.drawer-solutions ul {
    list-style: none;
    padding: 0;
}

.drawer-solutions li {
    margin-bottom: 12px;
}

.drawer-solutions a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: block;
}

.drawer-solutions a:hover {
    color: var(--primary-color);
}

/* Solution Landing Pages */
.solution-hero {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.solution-hero h1,
.solution-hero h2,
.gradient-text {
    font-size: 2.5rem;
    margin-bottom: 24px;
    background: linear-gradient(to right, #fff, var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.solution-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 64px;
}

.feat-card {
    padding: 32px;
    transition: transform 0.3s ease;
}

.feat-card:hover {
    transform: translateY(-5px);
}

.feat-card h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.feat-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.solution-cta {
    text-align: center;
    padding: 48px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, transparent 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(37, 99, 235, 0.1);
}

.solution-cta p {
    font-size: 1.25rem;
    margin-bottom: 24px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Info Cards Grid (used in rich content) */
.info-cards-grid {
    margin: 32px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.info-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.info-card h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.info-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Industries Grid (used in index SEO) */
.industries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.industry-item {
    padding: 16px;
    border-left: 3px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.02);
}

.industry-item strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.industry-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Rich Content Section */
.content-rich-section {
    margin: 64px 0;
    padding-top: 48px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.content-rich-section h2 {
    font-size: 1.75rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.content-rich-section h3 {
    font-size: 1.4rem;
    margin: 40px 0 16px;
    color: var(--primary-color);
}

/* Site Footer */
.site-footer {
    width: 100%;
    margin-top: 80px;
    padding: 64px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    box-sizing: border-box;
}

.site-footer p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

/* FAQ Styles */
.faq-grid {
    display: grid;
    gap: 24px;
    margin-top: 32px;
}

.faq-card {
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease;
}

.faq-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

.faq-card h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.faq-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    color: var(--text-primary);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    pointer-events: auto;
    animation: toast-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

.toast.hiding {
    opacity: 0;
    transform: translateX(40px);
}

.toast-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
}

.toast-message {
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 480px) {
    #toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        bottom: auto;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }
}