/* Custom styles for Field Mapping Tool */

/* General styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.card {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
    font-weight: 600;
}

/* Field mapping styles */
.field-item {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.field-item:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.field-item.selected {
    background-color: #cfe2ff;
    border-color: #0d6efd !important;
}

/* New mapping interface styles */
.mapping-row {
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent !important;
}

.mapping-row:hover {
    border-color: #dee2e6 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mapping-row.has-mapping {
    border-color: #198754 !important;
    background-color: #f8fff9 !important;
}

.source-field-selection {
    position: relative;
}

.manual-entry-container {
    animation: slideDown 0.3s ease-out;
}

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

.target-field-info {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.source-field-dropdown {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.source-field-dropdown:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.manual-entry-input {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.manual-entry-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Map and Table View Styles */
#map {
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
}

.nav-tabs .nav-link {
    border-radius: 0.375rem 0.375rem 0 0;
    border: 1px solid transparent;
    color: #6c757d;
}

.nav-tabs .nav-link:hover {
    border-color: #e9ecef #e9ecef #dee2e6;
    color: #495057;
}

.nav-tabs .nav-link.active {
    color: #495057;
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

.tab-content {
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
}

#dataTable {
    margin-bottom: 0;
}

#dataTable th {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

#dataTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Data Info Header Styles */
.card.bg-light {
    background-color: #f8f9fa !important;
    border: 1px solid #e9ecef;
}

.card.bg-light .card-title {
    color: #495057;
    font-weight: 600;
}

/* Responsive adjustments for map */
@media (max-width: 768px) {
    #map {
        height: 300px !important;
    }
    
    .mapping-row {
        margin-bottom: 1rem;
    }
    
    .target-field-info {
        min-height: auto;
        margin-bottom: 0.5rem;
    }
}

.mapping-item {
    background-color: #f8f9fa;
    transition: all 0.2s ease-in-out;
}

.mapping-item:hover {
    background-color: #e9ecef;
}

/* Badge styles */
.badge {
    font-size: 0.75em;
}

/* Button styles */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

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

/* Form styles */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Alert styles */
.alert {
    border-radius: 0.5rem;
    border: none;
}

/* Table styles */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* Sticky table headers - freeze headers when scrolling */
.table-responsive {
    position: relative;
}

/* Make all table header cells sticky */
.table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 1020 !important;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

.table thead.table-light th {
    background-color: #f8f9fa !important;
}

.table thead.bg-white th,
.table thead.sticky-top.bg-white th {
    background-color: #fff !important;
}

/* Ensure sticky headers work in scrollable containers */
.table-responsive[style*="overflow"] thead th,
.table-responsive[style*="max-height"] thead th,
.table-responsive[style*="overflow-y"] thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 1020 !important;
}

/* Specific fix for dataTable */
#dataTable thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 1020 !important;
    background-color: #fff !important;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Fix for view-agency-data tables - ensure sticky headers work */
.accordion-body > div[style*="overflow"] {
    position: relative !important;
}

.accordion-body > div[style*="overflow"] table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
}

.accordion-body > div[style*="overflow"] table thead th.sticky-header,
.accordion-body > div[style*="overflow"] table thead th {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    background-color: #f8f9fa !important;
    background-clip: padding-box !important;
    border-bottom: 2px solid #dee2e6 !important;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1) !important;
}

/* Also target any table in accordion-body with scrolling container */
.accordion-body div[style*="max-height"] table thead th {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    background-color: #f8f9fa !important;
}

/* Code styles */
code {
    background-color: #f8f9fa;
    color: #e83e8c;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .field-item {
        margin-bottom: 0.5rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
}

/* Animation for field mapping */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mapping-item {
    animation: slideIn 0.3s ease-out;
}

/* Status indicators */
.status-success {
    color: #198754;
}

.status-warning {
    color: #ffc107;
}

.status-danger {
    color: #dc3545;
}

.status-info {
    color: #0dcaf0;
}

/* Drag and drop styles */
.drag-over {
    background-color: #e3f2fd !important;
    border-color: #2196f3 !important;
}

.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Modal styles */
.modal-content {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.5rem 0.5rem 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Statistics cards */
.stat-card {
    transition: transform 0.2s ease-in-out;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* Connection test results */
.connection-success {
    border-left: 4px solid #198754;
}

.connection-error {
    border-left: 4px solid #dc3545;
}

/* Field type badges */
.badge-string { background-color: #6c757d; }
.badge-integer { background-color: #0d6efd; }
.badge-float { background-color: #fd7e14; }
.badge-date { background-color: #20c997; }
.badge-boolean { background-color: #6f42c1; }
.badge-geometry { background-color: #e83e8c; }
