/* Modals & Dialogs */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 10, 30, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    display: grid;
    grid-template-columns: 1.2fr 1px 0.8fr;
    max-width: 1000px;
    width: 90%;
    max-height: 90vh; /* Dodane ograniczenie wysokości */
    margin: 5vh auto;
    background-color: rgba(13, 31, 61, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(100, 150, 255, 0.1);
    position: relative;
    animation: fadeInUp 0.6s ease-out;
    overflow-y: auto; /* Dodane przewijanie */
}

.vertical-divider {
    width: 1px;
    background: linear-gradient(
            to bottom,
            transparent,
            rgba(100, 150, 255, 0.1),
            transparent
    );
    height: 100%;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    color: #a3b8da;
    cursor: pointer;
    z-index: 1;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #e2e8f0;
}

.modal-show {
    display: block;
}

/* Search Modal */
.search-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 10, 30, 0.5); /* Темно-синий полупрозрачный */
    display: none;
    z-index: 1000;
}

.search-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #152a47;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    z-index: 1001;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.search-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    color: #e2e8f0;
}

.address-item {
    padding: 10px;
    border-bottom: 1px solid #2d4268;
    cursor: pointer;
    transition: background 0.3s;
}

.address-item:hover {
    background: #1d3456;
}

.address-main {
    font-weight: bold;
    margin-bottom: 5px;
}

.address-details {
    font-size: 0.9em;
    color: #a3b8da; /* Светло-синий для деталей */
}

.error {
    color: #ef4444;
    padding: 10px;
}

.loading {
    color: #4a72c4; /* Синий для загрузки */
    padding: 10px;
}

.results-count {
    padding: 10px;
    color: #4a72c4;
    border-bottom: 1px solid #2d4268;
}

.search-title {
    background: #152a47;
    padding: 1px 15px;
    width: 100%;
    color: #e2e8f0;
    font-weight: 500;
    margin-bottom: 15px;
    max-width: 90vw;
    box-sizing: border-box;
}

/* WMS Dialog */
.wms-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.wms-dialog-content {
    color: #e2e8f0;
    background: #152a47;
    padding: 20px;
    border-radius: 12px;
    width: 400px;
    min-width: 300px;
    max-width: 90vw;
    position: relative;
    margin: 0 auto;
    box-sizing: border-box;
}

.wms-url-input {
    box-sizing: border-box;
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #3b6ef6; /* Более синий акцент */
    border-radius: 8px;
    background: #1a305a;
    color: #fff;
    margin-bottom: 10px;
}

.load-wms-btn {
    width: 100%;
    padding: 10px;
    background: #3b6ef6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.close-dialog-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

/* WMS Layers Modal */
.wms-layers-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.wms-layers-content {
    background: #152a47;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

/* GML Dialog */
.gml-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.gml-file-input {
    box-sizing: border-box;
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #3b6ef6;
    border-radius: 8px;
    background: #1a305a;
    color: #fff;
}

.load-gml-btn {
    width: 100%;
    padding: 10px;
    background: #3b6ef6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

.load-gml-btn:hover {
    background: #184bb8;
}

/* WMS Links Modal */
.wms-links-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.wms-links-content {
    background: #152a47;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    color: #e2e8f0;
}

.wms-link-item {
    padding: 15px;
    border-bottom: 1px solid #203759; /* Синяя разделительная линия */
    margin-bottom: 10px;
}

.wms-link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-decoration: none;
    margin-left: 10px;
}

.info-btn:hover {
    background-color: #374151;
}

.wms-link-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #6b9fff;
    flex-grow: 1;
}

.wms-link-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.wms-link-btn,
.add-wms-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.wms-link-btn {
    background: #184bb8;
    color: white;
    text-decoration: none;
}

.add-wms-btn {
    background: #1e58d7;
    color: white;
}

.wms-link-btn:hover,
.add-wms-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.close-modal-btn:hover {
    color: #a3b8da;
}

/* WFS Dialog */
.wfs-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.wfs-dialog-content {
    background: #152a47;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    color: #e2e8f0;
}

.wfs-url-input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #3b6ef6;
    border-radius: 8px;
    background: #1a305a;
    color: #fff;
}

.load-wfs-btn {
    width: 100%;
    padding: 10px;
    background: #3b6ef6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

/* Import Dialog */
.import-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

/* Edit Panel */
.edit-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    background: #152a47;
    color: #e2e8f0;
    z-index: 1000;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

.edit-panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.edit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-edit-panel {
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 24px;
    cursor: pointer;
}

/* Draggable Popup */
.draggable-popup {
    position: absolute;
    width: 350px;
    background-color: #152a47;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
    color: #e2e8f0;
}

.draggable-popup.dragging {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    opacity: 0.95;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #1a305a;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid #203759;
}

.popup-header h3 {
    margin: 0;
    font-size: 16px;
    color: #6b9fff;
}

.popup-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #e2e8f0;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.popup-close-btn:hover {
    background-color: #1d3456;
    color: #fff;
}

.popup-content {
    padding: 15px;
}

.popup-content p {
    margin: 8px 0;
    font-size: 14px;
}

.popup-content strong {
    color: #93c5ff;
}

.popup-content a {
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
    color: white;
}

.draggable-popup .favorite-btn,
.draggable-popup .searchWms-btn {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    border: none;
    border-radius: 4px;
    background-color: #102447;
    color: #ffffff;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.draggable-popup .searchWms-btn {
    background-color: #1a305a;
}

.draggable-popup .favorite-btn:hover {
    background-color: #1a305a;
}

.draggable-popup .searchWms-btn:hover {
    background-color: #1d3456;
}

.draggable-popup .favorite-btn.active {
    background-color: #e53935;
}

.draggable-popup .favorite-btn.active:hover {
    background-color: #c62828;
}

.draggable-popup .favorite-btn i {
    color: #ff4136;
}

/* Feature Info Popup */
.feature-info-popup {
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.feature-info-item {
    margin-bottom: 10px;
}

.feature-info-row {
    margin: 5px 0;
    font-size: 14px;
}

.feature-info-row strong {
    color: #6b9fff;
    margin-right: 5px;
}

/* Profile Popup */
.profile-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 600px;
    width: 80%;
    max-height: 95dvh;
    background-color: #1a365d;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    overflow-y: auto;
    color: white;
    margin: 20px; /* Dodany margin jako zabezpieczenie */
}


.profile-popup-container {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.profile-popup-header {
    padding: 20px;

}

.close-profile-popup-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #e2e8f0;
    z-index: 10;
}

.close-profile-popup-btn:hover {
    color: #f87171;
}

.hidden {
    display: none;
}

/* Media Query */
@media (max-width: 768px) {
    .modal-content {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr;
        margin: 5vh auto;
        width: 65%;
    }
    .login-form-section, .social-section{
        display: flex;
        flex-direction: column;
    }
    .modal-content {
        display: flex;
        flex-direction: column-reverse;
    }

    .vertical-divider {
        display: none;
    }

    .login-form-section,
    .social-section {
        padding: 20px;
    }
}