/* ==========================================================================
   FreeHunt Live Telemetri Portal - Premium Dark Outdoor Design System
   ========================================================================== */

:root {
    --bg-base: #0a0d14;
    --bg-surface: #111827;
    --bg-surface-elevated: #1f2937;
    --bg-card: rgba(26, 36, 54, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 107, 53, 0.35);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --color-orange-hunt: #ff6b35;
    --color-orange-glow: rgba(255, 107, 53, 0.4);
    --color-emerald: #10b981;
    --color-emerald-glow: rgba(16, 185, 129, 0.3);
    --color-amber: #f59e0b;
    --color-danger: #ef4444;
    --color-danger-glow: rgba(239, 68, 68, 0.5);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px var(--color-orange-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   Header / Top Navigation
   ========================================================================== */
#top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    height: 52px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #131b2e 0%, #0e1422 100%);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    flex-wrap: nowrap;
    overflow: hidden;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    cursor: default;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

/* Grön: Ansluten & Live telemetri */
.logo-icon.status-connected {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.logo-icon.status-connected svg {
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.6));
}

/* Röd: Frånkopplad / Anslutningsfel */
.logo-icon.status-error {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: #ef4444;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
    animation: status-error-pulse 1.8s infinite ease-in-out;
}

.logo-icon.status-error svg {
    filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.8));
}

@keyframes status-error-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(0.96); }
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-tag {
    font-size: 0.65rem;
    padding: 2px 7px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-full);
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: live-pulse 2s infinite ease-in-out;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.96); }
}

.subtext {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-emerald);
}

.status-indicator.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--color-danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.poll-timer {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    height: 36px;
    box-sizing: border-box;
    white-space: nowrap;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-action.pulse-highlight {
    background: linear-gradient(135deg, #ff6b35 0%, #ea580c 100%);
    color: #ffffff;
    box-shadow: 0 0 12px var(--color-orange-glow);
}

.btn-action.pulse-highlight:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(255, 107, 53, 0.6);
}

.btn-action.secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

.btn-action.small {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.btn-action.primary {
    background: var(--color-orange-hunt);
    color: #ffffff;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

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

.mobile-only {
    display: none;
}

/* ==========================================================================
   Main Layout: Sidebar & Map
   ========================================================================== */
#main-content {
    display: flex;
    flex: 1;
    height: calc(100vh - 61px);
    position: relative;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 360px;
    min-width: 320px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 24, 39, 0.6);
}

.search-box {
    position: relative;
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    padding: 9px 34px 9px 12px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--color-orange-hunt);
    box-shadow: 0 0 0 2px var(--color-orange-glow);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    display: none;
}

.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-base);
    padding: 3px;
    border-radius: var(--radius-md);
}

.tab-btn {
    flex: 1;
    padding: 6px 4px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Quick Summary Cards */
.telemetry-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
}

.summary-card.barking-alert.active {
    border-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.12);
    animation: alert-flash 1.5s infinite;
}

@keyframes alert-flash {
    0%, 100% { box-shadow: 0 0 10px var(--color-danger-glow); }
    50% { box-shadow: 0 0 2px transparent; }
}

.summary-icon {
    font-size: 1.25rem;
}

.summary-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-title {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Device List in Sidebar */
.devices-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.devices-list::-webkit-scrollbar {
    width: 5px;
}
.devices-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    flex-shrink: 0 !important;
    min-height: fit-content;
}

.device-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.device-card.selected {
    border-color: var(--color-orange-hunt);
    box-shadow: 0 0 15px var(--color-orange-glow);
    background: rgba(255, 107, 53, 0.08);
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.device-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.device-avatar.dog {
    background: rgba(255, 107, 53, 0.15);
    border-color: var(--border-highlight);
}

.device-avatar.hunter {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.device-name-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.device-id-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.device-battery {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
}

.battery-icon {
    display: inline-block;
    width: 12px;
    height: 6px;
    border: 1px solid currentColor;
    border-radius: 1px;
    position: relative;
}
.battery-icon::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 1px;
    width: 2px;
    height: 3px;
    background: currentColor;
    border-radius: 0 1px 1px 0;
}

.device-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 8px;
    border-radius: var(--radius-md);
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-num {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bark-badge {
    color: var(--color-amber);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bark-badge.active {
    color: var(--color-danger);
    font-weight: 700;
    animation: bark-tag-pulse 1s infinite alternate;
}

@keyframes bark-tag-pulse {
    from { color: #f87171; }
    to { color: #dc2626; }
}

.sidebar-footer {
    padding: 12px 16px;
    background: var(--bg-base);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gateway-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   Map Container & Leaflet Styling
   ========================================================================== */
#map-container {
    flex: 1;
    position: relative;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    background: #191a1a;
}

/* Kartkontroll knappar */
.map-overlay-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
}

.layer-selector-card {
    display: flex;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card);
}

.layer-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.layer-btn.active {
    background: var(--color-orange-hunt);
    color: #ffffff;
    font-weight: 600;
}

/* Info-kort för vald enhet */
.selected-card {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    box-sizing: border-box;
    background: rgba(17, 24, 39, 0.94);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    padding: 16px;
    z-index: 1000;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(14px);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.selected-card.hidden {
    display: none;
}

.close-card-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
}

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

.card-avatar {
    font-size: 1.6rem;
}

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.sel-type {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px;
    border-radius: var(--radius-md);
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-val {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
}

.highlight-bark {
    color: var(--color-orange-hunt);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.card-actions .btn-action {
    flex: 1 1 calc(50% - 6px);
    padding: 8px 10px;
    font-size: 0.84rem;
    white-space: nowrap;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.card-actions #btn-card-hunter-logout {
    flex: 1 1 100% !important;
    width: 100% !important;
    margin-top: 4px;
    padding: 8px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Leaflet Custom Markers & Animations
   ========================================================================== */

.custom-device-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-inner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #111827;
    border: 2px solid var(--color-orange-hunt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    position: relative;
    transition: transform 0.2s ease;
}

.marker-inner.hunter {
    border-color: var(--color-emerald);
}

/* Riktning/Kurs pil */
.marker-heading-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid var(--color-orange-hunt);
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
}

.marker-inner.hunter .marker-heading-arrow {
    border-bottom-color: var(--color-emerald);
}

/* Namnbricka under markör */
.marker-label-tag {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 13, 20, 0.85);
    color: var(--text-primary);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    border: 1px solid var(--border-color);
    pointer-events: none;
}

/* Skall-indikator puls (Radar wave) */
.bark-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--color-danger);
    opacity: 0;
    pointer-events: none;
    animation: bark-ripple 1.4s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

.bark-pulse-ring:nth-child(2) {
    animation-delay: 0.5s;
}

@keyframes bark-ripple {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
        border-color: var(--color-orange-hunt);
    }
    100% {
        transform: scale(2.8);
        opacity: 0;
        border-color: var(--color-danger);
    }
}

/* Spår / Polyline popups */
.trail-popup {
    font-family: var(--font-sans);
    font-size: 0.78rem;
}

.leaflet-popup-content-wrapper {
    background: rgba(17, 24, 39, 0.95);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.leaflet-popup-tip {
    background: rgba(17, 24, 39, 0.95);
}

/* Loading Spinner */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-orange-hunt);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto 10px auto;
}

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

.loading-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 30px 0;
}

/* Responsivitet för mobila enheter */
@media (max-width: 768px) {
    /* Dölj desktop-knappar i toppmenyn på mobil då de redan finns i bottenraden */
    #btn-my-gps,
    #btn-header-sighting,
    #btn-fit-bounds {
        display: none !important;
    }

    .mobile-only {
        display: flex;
    }

    #sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        transform: translateX(-100%);
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.7);
    }

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

    .selected-card {
        position: fixed !important;
        bottom: 74px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: 440px !important;
        margin: 0 auto !important;
        z-index: 3600 !important;
        box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.75) !important;
    }
}

/* ==========================================================================
   Rename Modal & Inline Edit Button
   ========================================================================== */
.btn-rename-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    margin-left: 4px;
}

.btn-rename-icon:hover {
    color: var(--color-orange-hunt);
    background: rgba(255, 107, 53, 0.15);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-dialog {
    background: #161f30;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    padding: 22px;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.8), 0 0 20px var(--color-orange-glow);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus {
    border-color: var(--color-orange-hunt);
    box-shadow: 0 0 0 3px var(--color-orange-glow);
}

.field-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.field-hint code {
    font-family: var(--font-mono);
    color: var(--color-orange-hunt);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 3px;
    word-break: break-all;
}

.type-selector {
    display: flex;
    gap: 10px;
}

.type-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.84rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.type-option input[type="radio"] {
    accent-color: var(--color-orange-hunt);
}

.type-option:has(input:checked) {
    border-color: var(--color-orange-hunt);
    background: rgba(255, 107, 53, 0.1);
    color: var(--text-primary);
    font-weight: 600;
}

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

/* ==========================================================================
   Color Palette for Dog Trails
   ========================================================================== */
.color-palette {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.custom-color-picker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.custom-color-picker:hover {
    border-color: var(--color-orange-hunt);
}

.custom-color-picker input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Lock Screen & Authentication Styles
   ========================================================================== */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #172238 0%, #0a0d14 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(12px);
}

.lock-card {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    width: 90%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 25px var(--color-orange-glow);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lock-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: rgba(255, 107, 53, 0.15);
    border: 1px solid var(--border-highlight);
    color: var(--color-orange-hunt);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.lock-icon svg {
    width: 32px;
    height: 32px;
}

.lock-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.lock-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.lock-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lock-form input {
    padding: 11px 14px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lock-form input:focus {
    border-color: var(--color-orange-hunt);
    box-shadow: 0 0 0 3px var(--color-orange-glow);
}

.full-width {
    width: 100%;
}

.lock-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lock-divider::before,
.lock-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.lock-divider span {
    padding: 0 10px;
}

/* QR Code Modal Styles */
.qr-dialog {
    max-width: 460px;
    text-align: center;
}

.qr-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 18px;
}

.qr-container {
    background: #ffffff;
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-container img,
.qr-container canvas {
    max-width: 100%;
    height: auto;
}

.qr-link-box {
    display: flex;
    width: 100%;
    gap: 8px;
    margin-bottom: 14px;
}

.qr-link-box input {
    flex: 1;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.hunt-badge-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

/* Hunter GPS Status Box in Modal */
.gps-status-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 18px;
}

.gps-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.gps-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.gps-dot.active {
    background: var(--color-emerald);
    box-shadow: 0 0 8px var(--color-emerald);
    animation: live-pulse 1.8s infinite;
}

.gps-accuracy-sub {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 18px;
}

/* ==========================================================================
   DataEnheter & Dolda Enheter (Admin)
   ========================================================================== */
.device-avatar.data-device {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.3);
}

.marker-inner.data-device {
    border-color: #94a3b8 !important;
    background: #0f172a;
    border-style: dashed !important;
}

.marker-inner.data-device .marker-heading-arrow {
    display: none;
}

.marker-inner.hidden-entity {
    opacity: 0.8;
}

.device-card.is-hidden-device {
    border-left: 3px solid #64748b;
    background: rgba(15, 23, 42, 0.45);
}

.hidden-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.35);
    margin-left: 6px;
    vertical-align: middle;
}

/* ==========================================================================
   Jaktmarker & POIs (Jaktpass, Jakttorn, Samlingsplatser)
   ========================================================================== */

/* Toggle-knapp för POIs i kartans överkant */
.poi-toggle-btn {
    padding: 6px 12px;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.poi-toggle-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    color: #ffffff;
}

.poi-toggle-btn.active {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

/* Placeringsbanner för Admin */
.poi-placement-banner {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 2px solid var(--color-orange-hunt);
    border-radius: 999px;
    padding: 8px 18px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 107, 53, 0.3);
    animation: bannerPulse 2s infinite ease-in-out;
}

@keyframes bannerPulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 107, 53, 0.3); }
    50% { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 107, 53, 0.6); }
}

.placement-banner-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #f8fafc;
}

.poi-placement-mode,
.poi-placement-mode #map,
.poi-placement-mode .leaflet-container {
    cursor: crosshair !important;
}

/* Leaflet Custom DivIcon för POIs */
.poi-div-icon {
    background: transparent !important;
    border: none !important;
}

.custom-poi-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-poi-marker:hover {
    transform: scale(1.18);
    z-index: 9999 !important;
}

.poi-marker-inner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #111827;
    border: 2px solid #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.poi-marker-inner .poi-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Specifika färger per typ */
.custom-poi-marker.poi-stand .poi-marker-inner {
    border-color: #10b981;
    background: radial-gradient(circle, #132e22 0%, #111827 100%);
}

.custom-poi-marker.poi-tower .poi-marker-inner {
    border-color: #3b82f6;
    background: radial-gradient(circle, #152238 0%, #111827 100%);
}

.custom-poi-marker.poi-gathering .poi-marker-inner {
    border-color: #10b981;
    background: radial-gradient(circle, #132e22 0%, #111827 100%);
}

.custom-poi-marker.poi-saltstone .poi-marker-inner {
    border-color: #06b6d4;
    background: radial-gradient(circle, #132d36 0%, #111827 100%);
}

.custom-poi-marker.poi-tracks .poi-marker-inner {
    border-color: #a855f7;
    background: radial-gradient(circle, #2a1538 0%, #111827 100%);
}

.custom-poi-marker.poi-other .poi-marker-inner {
    border-color: #94a3b8;
    background: radial-gradient(circle, #1e293b 0%, #111827 100%);
}

/* Etikett under märket */
.poi-label-tag {
    margin-top: 3px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(4px);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    white-space: nowrap;
    font-size: 0.68rem;
    font-weight: 600;
    color: #f8fafc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Popup-styling för POIs */
.poi-popup-card {
    min-width: 190px;
    color: #f8fafc;
}

.poi-popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.poi-popup-icon {
    font-size: 1.3rem;
}

.poi-popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: #f8fafc;
}

.poi-popup-badge {
    font-size: 0.7rem;
    color: var(--color-orange-hunt);
    font-weight: 600;
}

.poi-popup-desc {
    font-size: 0.8rem;
    color: #cbd5e1;
    margin: 6px 0;
    line-height: 1.4;
}

.poi-popup-coords {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: #94a3b8;
    margin-top: 6px;
}

.poi-popup-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Passkytt som besitter jaktpass eller torn - Tydlig Neon Orange ring & glow */
.marker-inner.hunter.on-stand {
    border-color: #ff5500 !important;
    background: radial-gradient(circle, #381500 0%, #111827 100%) !important;
    border-width: 2.5px !important;
    box-shadow: 0 0 16px rgba(255, 85, 0, 0.9), 0 0 6px #ff5500, 0 4px 10px rgba(0, 0, 0, 0.8) !important;
}

.marker-inner.hunter.on-stand .marker-heading-arrow {
    border-bottom-color: #ff5500 !important;
}

.device-avatar.hunter.on-stand {
    border-color: #ff5500 !important;
    background: rgba(255, 85, 0, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 85, 0, 0.6) !important;
}

/* ==========================================================================
   Admin Jaktmarks- & POI-Administratör (Modal & Listor)
   ========================================================================== */
.modal-dialog.modal-large {
    max-width: 680px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.modal-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.modal-tab.active {
    background: rgba(255, 107, 53, 0.15);
    border-color: rgba(255, 107, 53, 0.4);
    color: var(--color-orange-hunt);
}

.modal-tab-body {
    flex: 1;
    overflow-y: auto;
}

.mgr-tab-pane {
    display: none;
}

.mgr-tab-pane.active {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mgr-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mgr-search-box {
    flex: 1;
}

.mgr-search-box input {
    width: 100%;
    padding: 9px 14px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.mgr-search-box input:focus {
    border-color: var(--color-orange-hunt);
}

.mgr-filter-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.mgr-chip {
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.mgr-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.mgr-chip.active {
    background: var(--color-orange-hunt);
    color: #ffffff;
    border-color: var(--color-orange-hunt);
}

.mgr-poi-list-container {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.mgr-poi-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.mgr-poi-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.25);
}

.mgr-poi-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.mgr-poi-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    border: 2px solid #ef4444;
    font-size: 1.1rem;
}

.mgr-poi-avatar.poi-tower { border-color: #3b82f6; }
.mgr-poi-avatar.poi-stand { border-color: #10b981; }
.mgr-poi-avatar.poi-gathering { border-color: #10b981; }
.mgr-poi-avatar.poi-saltstone { border-color: #06b6d4; }
.mgr-poi-avatar.poi-tracks { border-color: #a855f7; }
.mgr-poi-avatar.poi-other { border-color: #94a3b8; }

.mgr-poi-details {
    overflow: hidden;
}

.mgr-poi-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mgr-poi-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    font-family: var(--font-mono);
}

.mgr-poi-actions {
    display: flex;
    gap: 6px;
    margin-left: 10px;
}

.mgr-poi-btn {
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #f1f5f9;
    transition: all 0.15s;
}

.mgr-poi-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.mgr-poi-btn.danger-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
}

.mgr-select {
    width: 100%;
    padding: 10px 12px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ==========================================================================
   Besatt jaktpass eller torn (Ersätter jägarens ikon med Neon Orange ring)
   ========================================================================== */
.custom-poi-marker.is-occupied {
    z-index: 9990 !important;
}

.custom-poi-marker.is-occupied .poi-marker-inner {
    border-color: #ff5500 !important;
    background: radial-gradient(circle, #381500 0%, #111827 100%) !important;
    border-width: 2.5px !important;
    box-shadow: 0 0 18px rgba(255, 85, 0, 0.95), 0 0 6px #ff5500, 0 4px 12px rgba(0, 0, 0, 0.8) !important;
    animation: occupiedPulse 2.5s infinite ease-in-out;
}

@keyframes occupiedPulse {
    0%, 100% {
        box-shadow: 0 0 16px rgba(255, 85, 0, 0.9), 0 0 5px #ff5500, 0 4px 10px rgba(0, 0, 0, 0.8);
    }
    50% {
        box-shadow: 0 0 24px rgba(255, 85, 0, 1), 0 0 10px #ff6600, 0 4px 14px rgba(0, 0, 0, 0.9);
    }
}

.custom-poi-marker.is-occupied .poi-label-tag {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: #ff5500 !important;
    color: #ffedd5 !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(255, 85, 0, 0.45) !important;
    max-width: 180px !important;
}

/* ==========================================================================
   Mobile Bottom Bar & Expandable Sidebar Tabs
   ========================================================================== */
.sidebar-top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0b1120;
    border-bottom: 1px solid var(--border-color);
    padding: 4px 8px 0;
}

.sidebar-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}

.sidebar-nav-tab {
    background: transparent;
    border: none;
    border-bottom: 2.5px solid transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-nav-tab:hover {
    color: var(--text-primary);
}

.sidebar-nav-tab.active {
    color: var(--color-orange-hunt);
    border-bottom-color: var(--color-orange-hunt);
}

.sidebar-tab-pane {
    display: none;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

.sidebar-tab-pane.active {
    display: flex;
}

.chat-badge, .nav-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
}

/* ==========================================================================
   Jaktchatt Styles
   ========================================================================== */
.chat-header {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--border-color);
}

.chat-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.chat-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 40px 10px;
}

.chat-msg {
    max-width: 86%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.35;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-msg.is-other {
    align-self: flex-start;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.chat-msg.is-me {
    align-self: flex-end;
    background: #c2410c;
    border: 1px solid #ea580c;
    color: #ffffff;
}

.chat-msg.is-sighting {
    align-self: stretch;
    max-width: 100%;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fef3c7;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.chat-msg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    margin-bottom: 2px;
}

.chat-sender-name {
    font-weight: 700;
    color: #38bdf8;
}

.chat-msg.is-me .chat-sender-name {
    color: #fed7aa;
}

.chat-msg.is-sighting .chat-sender-name {
    color: #f59e0b;
}

.chat-time {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.chat-msg.is-me .chat-time {
    color: rgba(255, 255, 255, 0.75);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #0f172a;
    border-top: 1px solid var(--border-color);
}

.chat-input-area input {
    flex: 1;
    padding: 9px 12px;
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.85rem;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--color-orange-hunt);
}

/* ==========================================================================
   Avstånd & Riktning (Kompasskurs)
   ========================================================================== */
.dist-bearing-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.78rem;
    color: #38bdf8;
    font-weight: 600;
}

.bearing-arrow {
    display: inline-block;
    font-size: 0.85rem;
    transform-origin: center center;
    transition: transform 0.3s ease;
}

.cardinal-dir {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
}

/* ==========================================================================
   Snabb Viltobservation Modal
   ========================================================================== */
.sighting-dialog {
    max-width: 440px;
}

.sighting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.sighting-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    background: #0f172a;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sighting-btn:hover, .sighting-btn:active {
    transform: translateY(-2px) scale(1.02);
    border-color: #f59e0b;
    background: #1e293b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.sighting-btn.animal-vildsvin:hover, .sighting-btn.animal-vildsvin:active {
    border-color: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.sighting-emoji {
    font-size: 2.3rem;
    line-height: 1;
}

.sighting-name {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

/* ==========================================================================
   Viltmarkör på Leaflet-kartan
   ========================================================================== */
.custom-sighting-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sighting-marker-inner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #3d2305 0%, #111827 100%);
    border: 2.5px solid #f59e0b;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.9), 0 4px 12px rgba(0, 0, 0, 0.7);
    animation: sightingPulse 2.5s infinite ease-in-out;
}

.sighting-marker-inner .sighting-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.sighting-label-tag {
    margin-top: 3px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #f59e0b;
    color: #fef3c7;
    font-weight: 700;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes sightingPulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(245, 158, 11, 0.8), 0 0 4px #f59e0b;
    }
    50% {
        box-shadow: 0 0 22px rgba(245, 158, 11, 1), 0 0 8px #fbbf24;
    }
}

/* ==========================================================================
   Mobilvy & Bottenrad (Mobile Bottom Bar)
   ========================================================================== */
#mobile-bottom-bar {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    #mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        z-index: 3500;
        justify-content: space-around;
        align-items: center;
        padding: 0 4px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    }

    .mobile-nav-btn {
        background: transparent;
        border: none;
        color: #94a3b8;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        flex: 1;
        height: 100%;
        cursor: pointer;
        position: relative;
        padding: 4px 0;
        transition: all 0.15s ease;
    }

    .mobile-nav-btn:active {
        transform: scale(0.94);
    }

    .mobile-nav-btn.active {
        color: var(--color-orange-hunt);
    }

    /* Mobil GPS-nål (Röd när AV, Grön när PÅ) */
    .mobile-gps-pin {
        display: inline-block;
        transition: color 0.25s ease, filter 0.25s ease, transform 0.25s ease;
    }

    #btn-mobile-gps.gps-active {
        color: #10b981 !important;
    }

    #btn-mobile-gps.gps-active .mobile-gps-pin {
        color: #10b981;
        filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.85));
    }

    #btn-mobile-gps.gps-inactive {
        color: #ef4444;
    }

    #btn-mobile-gps.gps-inactive .mobile-gps-pin {
        color: #ef4444;
        filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.6));
    }

    .mobile-nav-btn .nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    .mobile-nav-btn .nav-label {
        font-size: 0.65rem;
        font-weight: 600;
    }

    .mobile-nav-btn.highlight-sighting {
        color: #fef08a;
    }

    .mobile-nav-btn.highlight-sighting .nav-icon {
        background: linear-gradient(135deg, #f59e0b, #ea580c);
        color: white;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        box-shadow: 0 2px 10px rgba(245, 158, 11, 0.5);
        margin-top: -6px;
    }

    .mobile-nav-btn .nav-badge {
        position: absolute;
        top: 4px;
        right: calc(50% - 18px);
    }

    /* Sidopanel i mobilläge (Expanderbar låda) */
    #sidebar {
        position: fixed;
        top: 0;
        bottom: 60px;
        left: 0;
        width: 86%;
        max-width: 360px;
        z-index: 3800;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.85);
        display: flex;
        flex-direction: column;
    }

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

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 3700;
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .selected-card {
        position: fixed !important;
        bottom: 74px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: 440px !important;
        margin: 0 auto !important;
        z-index: 3600 !important;
        box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.75) !important;
    }

    .leaflet-bottom {
        bottom: 66px !important;
    }
}

/* ==========================================================================
   Admin Right-side Sidebar / Drawer
   ========================================================================== */
.admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 320px;
    max-width: 90vw;
    background: #111827;
    border-left: 1px solid var(--border-highlight);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.85);
    z-index: 4500;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-sidebar.open {
    transform: translateX(0);
}

.admin-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: rgba(17, 24, 39, 0.95);
    border-bottom: 1px solid var(--border-color);
}

.admin-sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-crown-icon {
    font-size: 1.6rem;
}

.admin-sidebar-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.admin-subtext {
    font-size: 0.72rem;
    color: #ff6b35;
    font-weight: 600;
}

.admin-sidebar-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex: 1;
}

.admin-menu-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.admin-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.admin-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.admin-menu-btn.pulse-highlight {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15) 0%, rgba(234, 88, 12, 0.25) 100%);
    border-color: rgba(255, 107, 53, 0.5);
}

.admin-menu-btn.pulse-highlight strong {
    color: #ffedd5;
}

.admin-menu-btn.danger-btn {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
}

.admin-menu-btn.danger-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: #ef4444;
}

.admin-menu-btn.danger-btn strong {
    color: #ef4444;
}

.admin-btn-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.admin-btn-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-btn-text strong {
    font-size: 0.88rem;
    font-weight: 600;
}

.admin-btn-text small {
    font-size: 0.72rem;
    color: var(--text-muted);
}


/* =================================
   Jägar-logout / Avsluta Jakt Knappar & Overlay
   ================================= */
.btn-logout-hunter {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.38) !important;
    color: #fca5a5 !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    transition: all var(--transition-fast) !important;
    cursor: pointer !important;
}

.btn-logout-hunter:hover {
    background: rgba(239, 68, 68, 0.28) !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.35) !important;
}

.btn-logout-hunter:active {
    transform: scale(0.96);
}

.btn-action.danger {
    background: rgba(239, 68, 68, 0.16) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
    font-weight: 600 !important;
}

.btn-action.danger:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.35) !important;
}

#hunt-ended-overlay {
    background: rgba(10, 15, 29, 0.88);
    backdrop-filter: blur(16px);
}

.btn-end-hunter-icon {
    background: transparent;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: all var(--transition-fast);
}

.btn-end-hunter-icon:hover {
    opacity: 1;
    transform: scale(1.18);
    background: rgba(239, 68, 68, 0.2);
}
