/* Global Styles */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* Main Layout Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.app-header {
    background-color: #343a40;
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.app-header .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.75);
}

.app-header .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.app-header small {
    color: #adb5bd;
}

/* Main Content Area */
.main-content {
    position: relative;
    flex: 1;
    overflow: hidden;
}

/* Map Container */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 350px;
    min-width: 350px;
    max-width: 600px;
    background-color: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(10px);
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 500;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
}

.sidebar.hidden {
    transform: translateX(100%);
}

/* Sidebar resize handle */
.sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    background: linear-gradient(to right, #e9ecef 60%, #dee2e6 100%);
    z-index: 10;
    transition: background 0.2s;
}
.sidebar-resize-handle:hover {
    background: linear-gradient(to right, #dee2e6 60%, #adb5bd 100%);
}

.sidebar-header {
    padding: 1rem;
    background-color: white;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

#layer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#layer-list .list-group-item {
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    padding: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block !important;
}

#layer-list .list-group-item.dragging {
    opacity: 0.5;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#layer-list .list-group-item.drag-over {
    border-top: 3px solid #007bff;
}

.drag-handle {
    color: #6c757d;
    margin-right: 0.5rem;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}



.layer-buttons {
    display: flex;
    gap: 0.25rem;
}

.visibility-toggle {
    margin-left: 0.5rem;
    margin-right: 0.25rem;
}

.clickable-layer {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-layer:hover {
    background-color: #f8f9fa !important;
}

.clickable-layer .layer-name {
    color: #007bff;
}

.clickable-layer:hover .layer-name {
    color: #0056b3;
}

/* New layer layout styles */
.layer-item-content {
    width: 100%;
}

.layer-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.layer-name {
    flex: 1;
    margin-left: 0.5rem;
    color: #007bff;
    font-size: 0.9rem;
}

.layer-controls-row {
    display: flex;
    align-items: center;
    margin-left: 1.75rem; /* Align with layer name (drag handle width + margin) */
}

.layer-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Settings Dropdown */
.settings-dropdown {
    position: relative;
}

.settings-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: #495057;
    border-radius: 0.25rem;
}

.settings-btn:hover {
    background-color: #e9ecef;
}

.settings-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.settings-menu.show {
    display: block;
}

.settings-menu button {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
}

.settings-menu button:hover {
    background-color: #f8f9fa;
}

.settings-menu button i {
    width: 1.25rem;
    margin-right: 0.5rem;
}

.settings-divider {
    margin: 0.5rem 0;
    border: 0;
    border-top: 1px solid #dee2e6;
}

.settings-menu button.text-danger:hover {
    background-color: #f8d7da;
    color: #721c24 !important;
}

/* Converter Panel */
.converter-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 2px solid #dee2e6;
    display: none;
    flex-direction: column;
    z-index: 500;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.converter-panel.show {
    display: flex;
    z-index: 999;
}

.converter-header {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

.converter-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.converter-header-actions {
    display: flex;
    gap: 0.5rem;
}

.converter-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.resize-handle {
    height: 5px;
    background-color: #dee2e6;
    cursor: ns-resize;
    position: relative;
}

.resize-handle:hover {
    background-color: #007bff;
}

/* Converter Toggle Button */
.converter-toggle-btn {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Sidebar Floating Toggle Button */
.sidebar-floating-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border-radius: 50% !important;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-floating-toggle:hover {
    transform: scale(1.1);
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1080;
    max-width: 350px;
}

/* Form Controls */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control, .form-select {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    font-size: 0.875rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.btn-sm {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}

.btn i {
    margin-right: 0.25rem;
}

/* Dropzone */
.dropzone {
    border: 2px dashed #ccc;
    border-radius: 0.25rem;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #007bff;
    background-color: #e9f5ff;
}

/* Progress Container */
.progress-container {
    display: none;
    margin-top: 1rem;
}

.progress {
    height: 1.5rem;
    border-radius: 0.25rem;
}

/* Nav Tabs */
.nav-tabs .nav-link {
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Modal Adjustments */
.modal-content {
    border-radius: 0.5rem;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Alert Styles */
.alert {
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Converter Form Layout */
.converter-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.converter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
    
    .converter-form-row {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2rem;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 350px;
        min-width: 350px;
    }
    
    .sidebar-floating-toggle {
        top: 0.5rem;
        right: 0.5rem;
        width: 45px;
        height: 45px;
    }
    
    .converter-toggle-btn {
        bottom: 0.5rem;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        background-color: rgba(248, 249, 250, 0.98);
    }
}

/* Help Modal Styles */
.help-section {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.help-section h6 {
    color: #495057;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.help-section ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.help-section li {
    margin-bottom: 0.25rem;
    color: #6c757d;
}

.example-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.example-buttons .btn {
    text-align: left;
    border-style: dashed;
}

.modal-xl .modal-dialog {
    max-width: 90%;
}

kbd {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.1875rem 0.375rem;
    font-size: 0.75em;
    border-radius: 0.2rem;
    border: 1px solid #adb5bd;
}
