/* ============================================================
   Norges Kart - Frontend Styles
   Version: 1.4.0
   ============================================================ */

/* ---- Map container ---- */
.norges-kart-container {
    width: 100%;
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* ---- Filter buttons (map) ---- */
.norges-kart-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.kart-filter-btn {
    padding: 0.5rem 1.25rem;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    color: #333;
}

.kart-filter-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.kart-filter-btn.active {
    background: #2271b1;
    color: #ffffff;
    border-color: #2271b1;
}

/* ---- Map element ---- */
.norges-kart-map {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ---- Leaflet popup ---- */
.leaflet-popup-content-wrapper {
    border-radius: 4px;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
}

.norges-kart-popup {
    padding: 1rem;
}

.norges-kart-popup h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.norges-kart-popup p {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

.norges-kart-popup a {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #2271b1;
    color: #ffffff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.norges-kart-popup a:hover {
    background: #135e96;
}

/* ---- Custom marker ---- */
.norges-kart-marker {
    width: 12px;
    height: 12px;
    background: #2271b1;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

.norges-kart-marker:hover {
    transform: scale(1.3);
    background: #135e96;
}

/* Pulsating sonar effect */
.norges-kart-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #2271b1;
    opacity: 0.4;
    transform: translate(-50%, -50%);
    animation: sonar-pulse 3s ease-out infinite;
}

/* Highlighted marker when table row is active */
.norges-kart-marker.nk-marker-highlight {
    background: #e05b3b !important;
    border-color: #fff !important;
    transform: scale(1.6);
    z-index: 9999 !important;
}

@keyframes sonar-pulse {
    0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.4; }
    50%  { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 0; }
}

/* ---- Cluster styles ---- */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(229, 115, 115, 0.6) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(229, 115, 115, 0.85) !important;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster {
    box-shadow: 0 3px 8px rgba(0,0,0,0.2) !important;
}

/* ---- Leaflet controls ---- */
.leaflet-control-zoom a { color: #333; }
.leaflet-bar a { border-bottom: 1px solid #ddd; }

/* ---- Single project map ---- */
.kart-prosjekt-container {
    width: 100%;
    margin: 2rem 0;
}

.kart-prosjekt-map {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kart-prosjekt-marker {
    width: 20px;
    height: 20px;
    background: #2271b1;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    position: relative;
}

.kart-prosjekt-marker:hover {
    transform: scale(1.2);
    background: #135e96;
}

.kart-prosjekt-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #2271b1;
    opacity: 0.5;
    transform: translate(-50%, -50%);
    animation: sonar-pulse 3s ease-out infinite;
}

/* ============================================================
   NORGES KART TABELL (NY i v1.4.0)
   ============================================================ */

.nk-tabell-wrapper {
    width: 100%;
    margin: 2.5rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Tabell filter-knapper ---- */
.nk-tabell-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.nk-tabell-filter-btn {
    padding: 0.45rem 1.2rem;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.18s ease;
    color: #333;
    line-height: 1.4;
}

.nk-tabell-filter-btn:hover {
    background: #f5f5f5;
    border-color: #aaa;
}

.nk-tabell-filter-btn.active {
    background: #1a3a5c;
    color: #ffffff;
    border-color: #1a3a5c;
}

/* ---- Scrollbar for bred tabell ---- */
.nk-tabell-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ---- Tabellen selv ---- */
.nk-tabell {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fff;
}

/* Header */
.nk-tabell thead {
    background: #1a3a5c;
    color: #ffffff;
}

.nk-tabell thead th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border: none;
    position: relative;
}

/* Sortable column header */
.nk-sortable {
    cursor: pointer;
    user-select: none;
}

.nk-sortable:hover {
    background: #2a4f78;
}

.nk-sort-icon {
    display: inline-block;
    margin-left: 0.4rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Body rows */
.nk-tabell tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.12s ease;
}

.nk-tabell tbody tr:last-child {
    border-bottom: none;
}

.nk-tabell tbody tr:nth-child(even) {
    background: #fafafa;
}

.nk-tabell tbody tr:hover,
.nk-tabell tbody tr.nk-rad-klikkbar:hover {
    background: #f0f6ff;
}

/* Clickable row */
.nk-rad-klikkbar {
    cursor: pointer;
}

/* Active / selected row */
.nk-tabell tbody tr.nk-rad-aktiv {
    background: #ddeeff !important;
    box-shadow: inset 3px 0 0 #2271b1;
}

/* Project name cell */
.nk-prosjekt-navn {
    font-weight: 500;
}

.nk-prosjekt-link {
    color: #2271b1;
    text-decoration: none;
    border-bottom: 1px dashed #99c0e0;
    transition: color 0.15s, border-color 0.15s;
}

.nk-rad-klikkbar:hover .nk-prosjekt-link {
    color: #135e96;
    border-bottom-color: #135e96;
    border-bottom-style: solid;
}

/* All cells */
.nk-tabell td {
    padding: 0.7rem 1rem;
    color: #333;
    vertical-align: middle;
    border: none;
}

/* ---- Tabell footer (teller) ---- */
.nk-tabell-footer {
    padding: 0.6rem 0.2rem;
    font-size: 0.8rem;
    color: #888;
    text-align: right;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .norges-kart-filters,
    .nk-tabell-filters {
        gap: 0.35rem;
    }
    
    .kart-filter-btn,
    .nk-tabell-filter-btn {
        padding: 0.4rem 0.9rem;
        font-size: 0.82rem;
    }
    
    .nk-tabell thead th,
    .nk-tabell td {
        padding: 0.6rem 0.75rem;
    }
    
    .nk-tabell {
        font-size: 0.82rem;
    }
    
    .norges-kart-popup {
        padding: 0.75rem;
    }
    
    .norges-kart-popup h3 {
        font-size: 1rem;
    }
}
