/* Serwent Bolag Frontend Styles */

.serwent-bolag-wrapper {
    --serwent-primary: #45b7a9;
    --serwent-secondary: #1c3857;
    --serwent-bg: #f2f5f7;
    --serwent-border: #e8eef2;
    --serwent-text: #1c3857;
    --serwent-text-light: #7a8a9a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--serwent-text);
}

/* Reset link styles */
.serwent-bolag-wrapper a,
.serwent-bolag-wrapper a:hover,
.serwent-bolag-wrapper a:focus,
.serwent-bolag-wrapper a:visited {
    text-decoration: none !important;
}

/* Country selector */
.serwent-country-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.serwent-country-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #fff;
    border: 2px solid var(--serwent-border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--serwent-secondary);
}

.serwent-country-btn:hover {
    border-color: var(--serwent-primary);
    background: rgba(69, 183, 169, 0.05);
}

.serwent-country-btn.active {
    border-color: var(--serwent-primary);
    background: var(--serwent-primary);
    color: #fff;
}

/* Flag */
.serwent-flag {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Sweden - Blue with yellow cross */
.serwent-flag.sweden {
    background: #006AA7;
}

.serwent-flag.sweden::before {
    content: '';
    position: absolute;
    left: 29%;
    top: 0;
    width: 17%;
    height: 100%;
    background: #FECC00;
}

.serwent-flag.sweden::after {
    content: '';
    position: absolute;
    top: 42%;
    left: 0;
    width: 100%;
    height: 17%;
    background: #FECC00;
}

/* Norway - Red with blue/white cross */
.serwent-flag.norway {
    background: #EF2B2D;
}

.serwent-flag.norway::before {
    content: '';
    position: absolute;
    left: 25%;
    top: 0;
    width: 25%;
    height: 100%;
    background: linear-gradient(to right,
        #fff 0%, #fff 20%,
        #002868 20%, #002868 80%,
        #fff 80%, #fff 100%);
}

.serwent-flag.norway::after {
    content: '';
    position: absolute;
    top: 37%;
    left: 0;
    width: 100%;
    height: 25%;
    background: linear-gradient(to bottom,
        #fff 0%, #fff 20%,
        #002868 20%, #002868 80%,
        #fff 80%, #fff 100%);
}

/* Denmark - Red with white cross */
.serwent-flag.denmark {
    background: #C8102E;
}

.serwent-flag.denmark::before {
    content: '';
    position: absolute;
    left: 29%;
    top: 0;
    width: 13%;
    height: 100%;
    background: #fff;
}

.serwent-flag.denmark::after {
    content: '';
    position: absolute;
    top: 44%;
    left: 0;
    width: 100%;
    height: 13%;
    background: #fff;
}

/* Main content */
.serwent-main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    min-height: 600px;
}

/* Sidebar */
.serwent-sidebar {
    background: #fff;
    display: flex;
    flex-direction: column;
}

.serwent-sidebar-header {
    padding: 24px;
}

.serwent-country-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--serwent-secondary);
    margin: 0 0 4px 0;
}

.serwent-company-count {
    font-size: 0.85rem;
    color: var(--serwent-text-light);
}

/* Search */
.serwent-search-box {
    padding: 0 24px 20px;
}

.serwent-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--serwent-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--serwent-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%237a8a9a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 14px center no-repeat;
    transition: all 0.2s ease;
}

.serwent-search-input:focus {
    outline: none;
    border-color: var(--serwent-primary);
    background-color: #fff;
}

/* Company list */
.serwent-company-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    max-height: 420px;
}

.serwent-company-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    margin-bottom: 4px;
}

.serwent-company-item:hover,
.serwent-company-item.active {
    background: var(--serwent-bg);
}

.serwent-company-item.active {
    border-left: 3px solid var(--serwent-primary);
}

.serwent-company-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--serwent-primary) 0%, #3a9a8e 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.serwent-company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 8px;
}

.serwent-logo-placeholder {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.serwent-company-info {
    flex: 1;
    min-width: 0;
}

.serwent-company-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--serwent-secondary);
    margin-bottom: 4px;
}

.serwent-company-location {
    font-size: 0.85rem;
    color: var(--serwent-text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.serwent-company-location svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Mini flags in list */
.serwent-flag-mini {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.serwent-flag-mini.sweden {
    background: #006AA7;
}

.serwent-flag-mini.sweden::before {
    content: '';
    position: absolute;
    left: 28%;
    top: 0;
    width: 17%;
    height: 100%;
    background: #FECC00;
}

.serwent-flag-mini.sweden::after {
    content: '';
    position: absolute;
    top: 42%;
    left: 0;
    width: 100%;
    height: 17%;
    background: #FECC00;
}

.serwent-flag-mini.norway {
    background: #EF2B2D;
}

.serwent-flag-mini.norway::before {
    content: '';
    position: absolute;
    left: 22%;
    top: 0;
    width: 25%;
    height: 100%;
    background: linear-gradient(to right,
        #fff 0%, #fff 20%,
        #002868 20%, #002868 80%,
        #fff 80%, #fff 100%);
}

.serwent-flag-mini.norway::after {
    content: '';
    position: absolute;
    top: 37%;
    left: 0;
    width: 100%;
    height: 25%;
    background: linear-gradient(to bottom,
        #fff 0%, #fff 20%,
        #002868 20%, #002868 80%,
        #fff 80%, #fff 100%);
}

.serwent-flag-mini.denmark {
    background: #C8102E;
}

.serwent-flag-mini.denmark::before {
    content: '';
    position: absolute;
    left: 28%;
    top: 0;
    width: 14%;
    height: 100%;
    background: #fff;
}

.serwent-flag-mini.denmark::after {
    content: '';
    position: absolute;
    top: 42%;
    left: 0;
    width: 100%;
    height: 16%;
    background: #fff;
}

.serwent-company-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(69, 183, 169, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--serwent-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.serwent-company-item:hover .serwent-company-arrow {
    opacity: 1;
}

/* Regional link */
.serwent-regional-link {
    padding: 16px 24px;
    border-top: 1px solid var(--serwent-border);
    background: var(--serwent-bg);
    margin-top: auto;
}

.serwent-regional-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--serwent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px;
    background: #fff;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.serwent-regional-btn:hover {
    background: var(--serwent-primary);
    color: #fff;
}

/* Map area */
.serwent-map-area {
    position: relative;
    background: var(--serwent-bg);
    min-height: 600px;
    height: 600px;
}

/* Leaflet map */
.serwent-leaflet-map {
    width: 100%;
    height: 100%;
    min-height: 600px;
    z-index: 1;
}

/* Custom marker styling */
.serwent-marker {
    background: transparent;
    border: none;
}

.serwent-marker-dot {
    width: 20px;
    height: 20px;
    background: var(--serwent-primary);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.serwent-marker-dot:hover {
    transform: scale(1.2);
}

/* Override Leaflet default styles */
.serwent-bolag-wrapper .leaflet-container {
    font-family: inherit;
}

.serwent-bolag-wrapper .leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255,255,255,0.8);
}

.serwent-bolag-wrapper .leaflet-control-zoom {
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.serwent-bolag-wrapper .leaflet-control-zoom a {
    background: #fff;
    color: var(--serwent-secondary);
    border: none;
}

.serwent-bolag-wrapper .leaflet-control-zoom a:hover {
    background: var(--serwent-bg);
}

/* Marker cluster styling */
.serwent-bolag-wrapper .marker-cluster {
    background: rgba(69, 183, 169, 0.3);
    border-radius: 50%;
}

.serwent-bolag-wrapper .marker-cluster div {
    background: var(--serwent-primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.serwent-bolag-wrapper .marker-cluster-small {
    width: 36px;
    height: 36px;
}

.serwent-bolag-wrapper .marker-cluster-small div {
    width: 28px;
    height: 28px;
    margin: 4px;
}

.serwent-bolag-wrapper .marker-cluster-medium {
    width: 44px;
    height: 44px;
}

.serwent-bolag-wrapper .marker-cluster-medium div {
    width: 34px;
    height: 34px;
    margin: 5px;
}

.serwent-bolag-wrapper .marker-cluster-large {
    width: 52px;
    height: 52px;
}

.serwent-bolag-wrapper .marker-cluster-large div {
    width: 40px;
    height: 40px;
    margin: 6px;
}

/* Map popup */
.serwent-map-popup {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    display: none;
    z-index: 100;
}

.serwent-map-popup.active {
    display: block;
    animation: serwentSlideUp 0.3s ease;
}

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

.serwent-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--serwent-bg);
    border-radius: 50%;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: var(--serwent-text-light);
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

.serwent-popup-close:hover {
    background: #e8eef2;
    color: var(--serwent-secondary);
}

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

.serwent-popup-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--serwent-primary) 0%, #3a9a8e 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    overflow: hidden;
}

.serwent-popup-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 6px;
}

.serwent-popup-title h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--serwent-secondary);
    margin: 0 0 4px 0;
}

.serwent-popup-title p {
    font-size: 0.9rem;
    color: var(--serwent-text-light);
    margin: 0;
}

.serwent-popup-description {
    font-size: 0.9rem;
    color: var(--serwent-text);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.serwent-popup-actions {
    display: flex;
    gap: 12px;
}

.serwent-popup-btn-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--serwent-primary);
    color: #fff;
    transition: all 0.2s ease;
}

.serwent-popup-btn-primary:hover {
    background: #3a9a8e;
    color: #fff;
}

/* Responsive */
@media (max-width: 1024px) {
    .serwent-main-content {
        grid-template-columns: 1fr;
    }

    .serwent-company-list {
        max-height: 300px;
    }

    .serwent-map-area {
        min-height: 400px;
    }

    .serwent-google-map,
    .serwent-map-placeholder {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .serwent-country-selector {
        flex-wrap: wrap;
    }

    .serwent-country-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    .serwent-flag {
        width: 24px;
        height: 24px;
    }

    .serwent-main-content {
        border-radius: 12px;
    }

    .serwent-map-popup {
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 16px;
    }
}

/* Custom city labels on map */
.serwent-city-label {
    background: transparent;
    border: none;
    text-align: center;
}

.serwent-city-label span {
    font-size: 11px;
    font-weight: 500;
    color: #555;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.9),
                 -1px -1px 2px rgba(255,255,255,0.9),
                 1px -1px 2px rgba(255,255,255,0.9),
                 -1px 1px 2px rgba(255,255,255,0.9);
    white-space: nowrap;
}

/* Map only mode */
.serwent-map-only .serwent-main-content {
    display: block;
    grid-template-columns: 1fr;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden;
}

.serwent-map-only .serwent-map-area {
    width: 100%;
    border-radius: 0 !important;
    overflow: hidden;
}

.serwent-map-only .serwent-leaflet-map,
.serwent-map-only .leaflet-container {
    border-radius: 0 !important;
}

.serwent-map-only .serwent-leaflet-map {
    width: 100%;
}
