/* ========================================
   SAMAWA WebGIS - Modern Futuristic Styles
   Matching Portal ATR BPN Theme
   ======================================== */

:root {
    /* ATR BPN Color Palette - Same as Portal */
    --primary-dark: #1a3a5c;
    --primary: #234b73;
    --primary-light: #2d5d8a;

    /* Accent Colors */
    --gold: #d4a84b;
    --gold-light: #e8c36d;
    --gold-dark: #b8923f;

    /* Secondary Colors */
    --sky-blue: #87ceeb;
    --sky-blue-light: #a5daef;
    --green: #2e8b57;
    --green-light: #3da06a;
    --brown: #8b4513;

    /* Neutrals */
    --bg-dark: #0a1628;
    --bg-darker: #060e18;
    --bg-panel-dark: rgba(26, 58, 92, 0.85);
    --bg-panel-light: rgba(255, 255, 255, 0.95);
    --bg-light: #f0f4f8;
    --text-dark: #e0e0e0;
    --text-light: #1a3a5c;
    --border-dark: rgba(255, 255, 255, 0.1);
    --border-light: rgba(26, 58, 92, 0.15);

    /* Glass Effect */
    --glass-bg: rgba(26, 58, 92, 0.25);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 16px;

    /* Effects */
    --glow-gold: 0 0 20px rgba(212, 168, 75, 0.3);
    --glow-blue: 0 0 20px rgba(135, 206, 235, 0.3);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.15);

    /* Typography */
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Inter', sans-serif;

    /* Transitions */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
    --radius: 16px;
    --radius-sm: 10px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Base Themes */
body.dark-mode {
    background-color: var(--bg-dark);
    color: var(--text-dark);
    --bg-panel: var(--bg-panel-dark);
    --border-color: var(--border-dark);
    --text-color: var(--text-dark);
    --accent-primary: var(--sky-blue);
    --accent-secondary: var(--gold);
}

body.light-mode {
    background-color: var(--bg-light);
    color: var(--text-light);
    --bg-panel: var(--bg-panel-light);
    --border-color: var(--border-light);
    --text-color: var(--text-light);
    --accent-primary: var(--primary);
    --accent-secondary: var(--gold-dark);
}

/* Layout */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* ========================================
   Sidebar - Glassmorphism Effect
   ======================================== */
.sidebar {
    width: 380px;
    min-width: 380px;
    background: var(--bg-panel);
    backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--glass-border);
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: 70px 1fr 60px;
    grid-template-areas:
        "header header"
        "nav content"
        "footer footer";
    z-index: 1000;
    box-shadow: var(--shadow-soft);
}

.sidebar-header {
    grid-area: header;
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(135deg, rgba(26, 58, 92, 0.3), rgba(212, 168, 75, 0.1));
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.3rem;
}

.logo i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--sky-blue), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-primary);
    letter-spacing: 1px;
}

/* Navigation */
.sidebar-nav {
    grid-area: nav;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    border-right: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.1);
}

.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1.2rem;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-btn:hover {
    background: rgba(135, 206, 235, 0.15);
    color: var(--sky-blue);
    transform: translateX(2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--sky-blue), var(--primary-light));
    color: white;
    box-shadow: var(--glow-blue);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    right: -6px;
    width: 3px;
    height: 20px;
    background: var(--gold);
    border-radius: 2px;
}

/* Sidebar Content */
.sidebar-content {
    grid-area: content;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

.panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    padding: 24px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    visibility: hidden;
    transform: translateX(10px);
}

.panel.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(0);
}

/* Sidebar Footer */
.sidebar-footer {
    grid-area: footer;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.05);
}

.coords-display {
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: var(--sky-blue);
}

/* ========================================
   Map Container
   ======================================== */
.map-container {
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
}

/* ========================================
   Components
   ======================================== */
h3 {
    margin-top: 0;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-size: 1.1rem;
}

h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border-radius: 2px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sky-blue), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(135, 206, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(135, 206, 235, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--sky-blue);
    color: var(--sky-blue);
}

.full-width {
    width: 100%;
}

/* Tool Buttons */
.tool-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: rgba(135, 206, 235, 0.15);
    border-color: var(--sky-blue);
    color: var(--sky-blue);
    transform: scale(1.05);
}

.tool-btn.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border-color: var(--gold);
    color: white;
    box-shadow: var(--glow-gold);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.1);
}

.upload-area:hover {
    border-color: var(--sky-blue);
    background: rgba(135, 206, 235, 0.08);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--sky-blue);
    margin-bottom: 15px;
    opacity: 0.7;
}

/* Inputs */
input,
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    font-family: var(--font-secondary);
    box-sizing: border-box;
    margin-bottom: 12px;
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--sky-blue);
    box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Layer List */
.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.layer-item:hover {
    border-color: var(--sky-blue);
    background: rgba(135, 206, 235, 0.08);
    transform: translateX(4px);
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.layer-info i {
    color: var(--gold);
    font-size: 1.1rem;
}

/* Toggle Switch - Modern Style */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: var(--transition);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background: linear-gradient(135deg, var(--sky-blue), var(--primary-light));
    border-color: var(--sky-blue);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* ========================================
   Modals - Glassmorphism
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 14, 24, 0.8);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--glass-blur));
    padding: 28px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 1300px;
    height: 85%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: rgba(247, 37, 133, 0.2);
    border-color: #f72585;
    color: #f72585;
}

.print-layout {
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex-grow: 1;
    display: flex;
    gap: 24px;
    overflow: hidden;
}

.print-controls {
    width: 260px;
    flex-shrink: 0;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 12px;
}

.print-controls::-webkit-scrollbar {
    width: 6px;
}

.print-controls::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.print-controls::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.form-group input,
.form-group select {
    width: 100%;
}

.print-preview-area {
    flex-grow: 1;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    box-shadow: var(--shadow-soft);
}

/* ========================================
   Theme Toggle
   ======================================== */
.icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(212, 168, 75, 0.15);
    border-color: var(--gold);
    color: var(--gold);
}

body.dark-mode .light-icon {
    display: none;
}

body.dark-mode .dark-icon {
    display: inline-block;
}

body.light-mode .light-icon {
    display: inline-block;
}

body.light-mode .dark-icon {
    display: none;
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(135, 206, 235, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(135, 206, 235, 0.5);
}

/* ========================================
   Tool Groups
   ======================================== */
.tool-group {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.tool-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 12px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.coord-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ========================================
   Print Layout - Landscape
   ======================================== */
.print-layout-landscape {
    display: grid !important;
    grid-template-columns: 4fr 1fr;
    gap: 6px;
    width: 900px;
    height: 600px;
    margin: 0;
    overflow: hidden;
}

.print-map-section {
    display: flex;
    flex-direction: column;
}

.print-info-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.print-info-section {
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-darker), var(--primary-dark));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.loading-progress {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ========================================
   Mobile Toggle Button
   ======================================== */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.mobile-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-blue);
}

.mobile-toggle.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

/* ========================================
   Mobile Responsive - Tablet (max 1024px)
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 320px;
        min-width: 320px;
    }

    .panel {
        padding: 16px;
    }

    .panel h3 {
        font-size: 1rem;
    }
}

/* ========================================
   Mobile Responsive - Phone (max 768px)
   ======================================== */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 320px;
        height: 100%;
        min-width: unset;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        grid-template-columns: 50px 1fr;
        grid-template-rows: 60px 1fr 50px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 0 15px;
    }

    .logo {
        font-size: 1.1rem;
        gap: 8px;
    }

    .logo i {
        font-size: 1.2rem;
    }

    .sidebar-nav {
        padding-top: 15px;
    }

    .nav-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .sidebar-content {
        overflow-y: auto;
    }

    .panel {
        padding: 15px;
    }

    .panel h3 {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }

    .sidebar-footer {
        padding: 0 12px;
        font-size: 0.75rem;
    }

    .coords-display {
        font-size: 0.7rem;
    }

    /* Map Container */
    .map-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }

    #map {
        height: 100%;
        width: 100%;
    }

    /* Layer Controls */
    .layer-item {
        padding: 10px;
        margin-bottom: 8px;
    }

    .layer-item label {
        font-size: 0.85rem;
    }

    .layer-checkbox-custom {
        width: 18px;
        height: 18px;
    }

    /* Basemap */
    .basemap-option {
        padding: 10px;
        font-size: 0.85rem;
    }

    /* Upload Area */
    .upload-area {
        padding: 20px;
    }

    .upload-area i {
        font-size: 2rem;
    }

    .upload-area p {
        font-size: 0.85rem;
    }

    /* Work Tools */
    .tool-group {
        margin-bottom: 15px;
    }

    .tool-group label {
        font-size: 0.85rem;
    }

    #coord-input {
        font-size: 0.85rem;
    }

    .action-buttons {
        gap: 8px;
    }

    .tool-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Buttons */
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* Overlay for sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Bottom Drawer Mobile */
    .bottom-drawer {
        max-height: 60vh;
    }

    .drawer-body {
        max-height: 50vh;
    }

    /* Modal Mobile */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
    }

    .modal-content.print-layout {
        flex-direction: column;
    }

    .print-controls {
        width: 100%;
        max-height: 40vh;
        overflow-y: auto;
    }

    .print-preview-area {
        width: 100%;
        min-height: 200px;
    }

    /* Leaflet Controls */
    .leaflet-control-zoom {
        margin-top: 70px !important;
        margin-right: 10px !important;
    }

    .leaflet-control-zoom a {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
        font-size: 18px !important;
    }
}

/* ========================================
   Mobile Responsive - Small Phone (max 480px)
   ======================================== */
@media (max-width: 480px) {
    .mobile-toggle {
        width: 45px;
        height: 45px;
        top: 10px;
        left: 10px;
        font-size: 1.1rem;
    }

    .sidebar {
        max-width: 280px;
        grid-template-columns: 45px 1fr;
        grid-template-rows: 55px 1fr 45px;
    }

    .logo span {
        font-size: 0.95rem;
    }

    .nav-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .panel {
        padding: 12px;
    }

    .panel h3 {
        font-size: 0.9rem;
    }

    .layer-item label {
        font-size: 0.8rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .tool-btn {
        width: 36px;
        height: 36px;
    }

    /* Bottom Drawer Small */
    .bottom-drawer {
        max-height: 50vh;
    }

    .drawer-header {
        padding: 10px 12px;
    }

    .drawer-title {
        font-size: 0.9rem;
    }

    .drawer-body {
        padding: 12px;
        max-height: 40vh;
    }

    /* Leaflet Controls */
    .leaflet-control-zoom {
        margin-top: 60px !important;
    }

    .leaflet-control-zoom a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 16px !important;
    }
}

/* ========================================
   Touch-friendly Improvements
   ======================================== */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .nav-btn,
    .tool-btn,
    .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .layer-item {
        padding: 12px;
    }

    .basemap-option {
        padding: 12px;
    }

    /* Remove hover effects that don't work well on touch */
    .nav-btn:hover,
    .tool-btn:hover,
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }

    /* Active states for touch */
    .nav-btn:active,
    .tool-btn:active,
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

/* ========================================
   User Location Marker
   ======================================== */
.user-location-marker {
    background: transparent;
}

.marker-pulse {
    width: 20px;
    height: 20px;
    background: #4285F4;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    position: relative;
}

.marker-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: rgba(66, 133, 244, 0.4);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        width: 20px;
        height: 20px;
        opacity: 0.8;
    }

    100% {
        width: 60px;
        height: 60px;
        opacity: 0;
    }
}

/* Custom Geolocation Control */
.leaflet-control-custom {
    background: white;
    padding: 0;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    width: 32px;
    /* Set fixed width to match Zoom control on desktop */
    height: 32px;
}

.leaflet-control-locate {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #333;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.2s;
    background-color: #fff;
}

.leaflet-control-locate:hover {
    background-color: #f4f4f4;
    color: var(--primary);
}

.leaflet-control-locate.active {
    color: #1a73e8;
}

.leaflet-control-locate.loading {
    animation: spin 1s linear infinite;
}

/* Fix for Touch Devices */
.leaflet-touch .leaflet-control-locate {
    width: 30px;
    height: 30px;
    line-height: 30px;
}

/* Ensure mobile layout compatibility with standard controls */
.leaflet-touch .leaflet-control-custom {
    border: 2px solid rgba(0, 0, 0, 0.2);
    background-clip: padding-box;
    width: 34px;
    height: 34px;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 20mm;
        /* Printable area: 257mm x 170mm, centered on A4 landscape */
    }

    /* Hide everything except the print area */
    body * {
        visibility: hidden;
    }

    .print-preview-area,
    .print-preview-area * {
        visibility: visible;
    }

    /* Fill the printable area (257x170mm set by @page margin) */
    .print-preview-area {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        border: none;
        background: white;
        overflow: hidden;
    }

    /* Layout fills the full printable area */
    .print-layout-landscape {
        width: 100% !important;
        height: 100% !important;
        transform: none !important;
        display: grid !important;
        grid-template-columns: 4fr 1fr;
        gap: 1.5mm;
        padding: 1.5mm;
        border: 0.5mm solid #000 !important;
        box-sizing: border-box;
        margin: 0;
        overflow: hidden;
    }

    /* Info panel fits within right column */
    .print-info-panel {
        gap: 1.5mm !important;
        overflow: hidden !important;
    }

    /* Info sections font scaling for print */
    .print-info-section {
        font-size: 6pt !important;
        padding: 1.5mm !important;
    }

    .print-info-section h2 {
        font-size: 9pt !important;
        margin: 0 !important;
    }

    .print-info-section p,
    .print-info-section td,
    .print-info-section span {
        font-size: 6pt !important;
    }

    /* Compass image size for print */
    .print-info-section img {
        width: 18mm !important;
        height: 18mm !important;
    }

    /* Hide UI controls */
    .modal-header,
    .print-controls,
    .bottom-drawer,
    .drawer-overlay,
    .sidebar,
    .mobile-toggle,
    .sidebar-overlay {
        display: none !important;
    }

    /* Ensure map fills its container */
    #print-map-preview {
        width: 100% !important;
        height: 100% !important;
    }

    /* Preserve colors in print */
    .print-layout-container,
    .print-layout-container *,
    .print-layout-landscape,
    .print-info-section,
    #print-map-preview {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    body {
        text-rendering: optimizeLegibility;
    }
}