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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: white;
    color: #1e293b;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Zaglavlje */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 100;
    height: 56px;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 100%;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.logo-subtitle {
    font-size: 11px;
    color: #64748b;
    font-weight: 400;
}

.nav {
    display: flex;
    gap: 32px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover {
    color: #1e293b;
}

.nav-link.active {
    color: #0064e8;
    border-bottom-color: #0064e8;
}

.header-right {
    display: flex;
    align-items: center;
}

.design-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

/* Container */
.container {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 0;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
    overflow: hidden;
    transition: transform 0.3s ease;
    padding: 20px 16px;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 20px;
    color: #94a3b8;
}

.sidebar-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.search-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 13px;
    background: transparent;
    color: #1e293b;
}

.search-input::placeholder {
    color: #cbd5e1;
}

.sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.layer-category {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    border-radius: 4px;
    transition: background 0.2s;
}

.category-header:hover {
    background: #e2e8f0;
}

.category-header svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #0064e8;
}

.category-header span:nth-of-type(1) {
    flex: 1;
    text-align: left;
}

.category-count {
    font-size: 12px;
    color: #94a3b8;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.expand-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.2s;
}

.category-header[data-expanded="false"] .expand-icon {
    transform: rotate(-90deg);
}

.category-items {
    padding-left: 8px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.2s, opacity 0.2s;
}

.category-items.collapsed {
    max-height: 0;
    opacity: 0;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 13px;
    color: #475569;
}

.layer-item:hover {
    background: #e2e8f0;
}

.layer-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0064e8;
}

.layer-name {
    flex: 1;
    user-select: none;
}

.layer-menu {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.layer-menu:hover {
    background: #cbd5e1;
    color: #475569;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

.footer-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.footer-text {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 8px;
}

.footer-link {
    font-size: 12px;
    color: #0064e8;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.footer-link:hover {
    opacity: 0.8;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.sidebar-toggle {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 50;
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.map-search {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    width: 280px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.map-search svg {
    width: 16px;
    height: 16px;
    color: #94a3b8;
    flex-shrink: 0;
}

.map-search .search-input {
    font-size: 13px;
}

.map {
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 0;
    background: #f0ebe3;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.zoom-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.zoom-btn svg {
    width: 18px;
    height: 18px;
}

/* Legenda */
.legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 30;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-width: 180px;
}

.legend-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #475569;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-line {
    width: 16px;
    height: 2px;
    flex-shrink: 0;
}

.legend-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
}

/* Map Attribution */
.map-attribution {
    position: absolute;
    bottom: 6px;
    right: 12px;
    font-size: 10px;
    color: #94a3b8;
    z-index: 10;
    pointer-events: none;
}

/* Object Popup */
.object-popup {
    position: absolute;
    bottom: 20px;
    right: 70px;
    z-index: 35;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    display: none;
}

.object-popup.visible {
    display: block;
    animation: popupSlide 0.2s ease-out;
}

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

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #1e293b;
}

.popup-category {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: #0064e8;
    padding: 3px 8px;
    border-radius: 3px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.popup-meta {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 12px;
}

.popup-meta strong {
    color: #1e293b;
    font-weight: 500;
}

.popup-link {
    font-size: 12px;
    color: #0064e8;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.popup-link:hover {
    opacity: 0.8;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 32px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #1e293b;
}

.modal-content h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

.modal-content p {
    font-size: 14px;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 12px;
}

.modal-content strong {
    font-weight: 600;
    color: #1e293b;
}

.modal-content em {
    font-style: italic;
    color: #64748b;
}

/* Kataloški popis */
.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.catalog-item {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.catalog-item:hover {
    background: #f1f5f9;
    border-color: #0064e8;
}

.catalog-name {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.catalog-category {
    font-size: 12px;
    color: #94a3b8;
}

.catalog-view-btn {
    font-size: 12px;
    color: #0064e8;
    margin-top: 8px;
    cursor: pointer;
    text-decoration: none;
}

/* Leaflet overrides */
.leaflet-control-attribution {
    background: transparent !important;
    border: none !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: #0064e8;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        height: auto;
        z-index: 60;
        transform: translateX(-100%);
        width: 280px;
        border-radius: 0 8px 8px 0;
    }

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

    .sidebar-close {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .map-search {
        width: calc(100% - 60px);
    }

    .nav {
        display: none;
    }

    .design-label {
        display: none;
    }

    .legend {
        bottom: 70px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
    }

    .zoom-controls {
        bottom: 20px;
        right: 12px;
    }

    .object-popup {
        bottom: 70px;
        right: 12px;
        width: calc(100% - 24px);
        max-width: 280px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
