/* Add Data Tab Navigation */
.add-data-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    margin: 0;
    padding: 0;
}

.add-data-tab-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.add-data-tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.add-data-tab-btn.active {
    background: white;
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 500;
}

.add-data-tab-content {
    display: none;
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.add-data-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* User Input Tab Styles */
.user-input-section {
    padding: 20px;
}

.user-input-section h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.1em;
}

.input-type-selection {
    margin-bottom: 20px;
}

.input-type-selection label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.input-type-buttons {
    display: flex;
    gap: 10px;
}

.input-type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.input-type-btn:hover {
    background: #f0f0f0;
}

.input-type-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.input-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.input-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.input-info .form-group {
    margin-bottom: 15px;
}

.input-info .form-group:last-child {
    margin-bottom: 0;
}

.input-info label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.input-info input,
.input-info textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.drawn-items-list {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.drawn-items-list h5 {
    margin: 0 0 10px 0;
    color: #333;
}

#drawnItemsContainer {
    max-height: 200px;
    overflow-y: auto;
}

.save-controls {
    text-align: center;
}

.drawing-instructions {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    padding: 10px;
    margin: 15px 0;
}

.instruction-text {
    margin: 0;
    color: #1976d2;
    font-size: 0.9em;
}

/* Coordinate Editor Styles */
.coordinate-editor-content {
    padding: 15px;
}

.coordinate-editor-content h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
}

.editor-info-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.editor-info-section .form-group {
    margin-bottom: 12px;
}

.editor-info-section .form-group:last-child {
    margin-bottom: 0;
}

.coordinates-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px;
    margin-bottom: 8px;
}

.coordinates-section h4 {
    margin: 0 0 4px 0;
    color: #555;
    font-size: 0.85em;
    font-weight: 600;
}

.coordinates-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.coordinate-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-bottom: 1px solid #eee;
}

.coordinate-item:last-child {
    border-bottom: none;
}

.coord-index {
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    min-width: 20px;
    text-align: center;
}

.coord-lat,
.coord-lng {
    flex: 1;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.85em;
}

.coord-delete {
    padding: 4px 8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

.coord-delete:hover {
    background: #c82333;
}

.coordinate-actions {
    display: flex;
    gap: 10px;
}

.editor-save-section {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* File Upload Styles */
.file-upload-section {
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #0056b3;
    background: #f0f8ff;
}

.upload-area.drag-over {
    border-color: #28a745;
    background: #f8fff8;
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
    color: #007bff;
}

.upload-text {
    margin-bottom: 20px;
}

.upload-text p {
    margin: 5px 0;
    color: #495057;
}

.upload-btn {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: white;
    transition: background-color 0.2s ease;
}

.upload-btn:hover {
    background: #0056b3;
}

.file-info {
    background: #e8f5e8;
    border: 1px solid #4CAF50;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.file-icon {
    font-size: 1.5em;
    color: #4CAF50;
}

.file-name {
    font-weight: 500;
    color: #2e7d2e;
    flex: 1;
}

.file-size {
    font-size: 0.9em;
    color: #666;
}

.file-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* CSV Preview Styles */
.csv-preview {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.csv-preview h4 {
    margin: 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-size: 1em;
    color: #2c3e50;
}

.preview-table {
    max-height: 300px;
    overflow: auto;
    padding: 15px;
}

.preview-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.preview-table th,
.preview-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.preview-table th {
    background: #f8f9fa;
    font-weight: 500;
    color: #495057;
    position: sticky;
    top: 0;
}

/* Tab Placeholder Styles */
.tab-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.tab-placeholder h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.tab-placeholder p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Data Type Selector Styles */
.data-type-selector {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.data-type-selector label {
    display: inline-block;
    margin-right: 8px;
    font-weight: bold;
    font-size: 0.9em;
    color: #495057;
}

.data-type-selector select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 0.9em;
    min-width: 200px;
}

.data-type-selector select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Validation Section Styles */
.validation-section {
    margin: 10px 0;
    text-align: left;
}

.validate-btn {
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.validate-btn:hover {
    background: #138496;
}

.validate-btn:active {
    transform: scale(0.98);
}

.validate-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Add Data Tab Styles */
.add-data-container {
    display: flex;
    height: calc(100vh - 120px);
    position: relative;
    background-color: #f5f5f5;
}

#addDataMap {
    flex: 1;
    height: 100%;
    position: relative;
}

.add-data-sidebar {
    width: 800px;
    background: white;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.add-data-panels {
    display: flex;
    height: 100%;
}

.add-data-left-panel {
    width: 400px;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.add-data-right-panel {
    width: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: #2c3e50;
}

.table-query-section {
    padding: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.selected-table-info {
    background: #e8f5e8;
    border: 1px solid #4CAF50;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.selected-table-info h4 {
    margin: 0 0 5px 0;
    color: #2e7d2e;
    font-size: 1.1em;
}

.selected-table-info p {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 0.9em;
}

.table-search .form-group {
    margin-bottom: 15px;
}

.table-search label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.table-data-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.no-data-message, .loading-message {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.loading-message {
    color: #3498db;
}

.table-data-item {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.table-data-item:hover {
    background-color: #f8f9fa;
}

.table-data-item.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.data-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.data-item-icon {
    font-size: 1.2em;
}

.data-item-name {
    font-weight: 500;
    color: #2c3e50;
}

.data-item-coords {
    font-size: 0.9em;
    color: #666;
    margin-left: auto;
}

.data-item-info {
    font-size: 0.85em;
    color: #888;
    margin-left: 28px;
}

.coordinate-editor {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.no-selection-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

.coord-editor-header {
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.coord-editor-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 5px 0;
}

.coord-editor-info {
    font-size: 0.9em;
    color: #666;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.coordinate-list {
    margin-top: 20px;
}

.coordinate-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.coordinate-section h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1em;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.coordinate-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.coordinate-input {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.coordinate-input label {
    font-size: 0.9em;
    font-weight: 500;
    color: #555;
}

.coordinate-input input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.2s ease;
}

.coordinate-input input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.coordinate-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.coord-action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.coord-action-btn.save-btn {
    background: #28a745;
    color: white;
}

.coord-action-btn.save-btn:hover {
    background: #218838;
}

.coord-action-btn.cancel-btn {
    background: #6c757d;
    color: white;
}

.coord-action-btn.cancel-btn:hover {
    background: #545b62;
}

/* Search Results Styles */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.search-results-header {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-weight: 500;
}

.search-results-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1em;
}

.search-results-list {
    padding: 0;
}

.search-result-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.result-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.result-icon {
    font-size: 1.2em;
}

.result-name {
    font-weight: 500;
    color: #2c3e50;
    flex: 1;
}

.result-count {
    font-size: 0.9em;
    color: #666;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
}

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

.result-workspace,
.result-geometry,
.result-description {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 3px;
}

.result-description {
    color: #888;
    font-style: italic;
}

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.detail-btn {
    padding: 6px 12px;
    font-size: 0.85em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: white;
    transition: background-color 0.2s ease;
}

.detail-btn:hover {
    background: #0056b3;
}

/* Table Data List in Editor */
.table-data-list-editor {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 15px 0;
}

.table-data-item-editor {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.table-data-item-editor:hover {
    background-color: #f8f9fa;
}

.table-data-item-editor.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.table-data-item-editor:last-child {
    border-bottom: none;
}

/* Loading and Error Messages */
.loading-message {
    color: #3498db;
    font-style: italic;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
}

.error-message h4 {
    color: #721c24;
    margin: 0 0 10px 0;
}

.error-message p {
    color: #721c24;
    margin: 0 0 15px 0;
}

/* CSV Data Styles */
.csv-data-list-editor {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 15px 0;
}

.csv-data-item {
    border-bottom: 1px solid #eee;
    padding: 12px 15px;
}

.csv-data-item:last-child {
    border-bottom: none;
}

.csv-data-item .data-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
}

.csv-data-item .data-item-name {
    font-weight: 500;
    color: #2c3e50;
}

.csv-data-item .data-item-info {
    font-size: 0.85em;
    color: #666;
    margin-left: auto;
}

.data-row-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-left: 28px;
    padding: 8px 0;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px 12px;
}

.data-field {
    font-size: 0.85em;
    color: #495057;
}

.data-field strong {
    color: #2c3e50;
}

/* User Tab Search Form Adjustments */
#addDataUserTab .search-form-container {
    margin-bottom: 20px;
}

#addDataUserTab .form-row {
    margin-bottom: 15px;
}

#addDataUserTab .search-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Responsive design for add data */
@media (max-width: 1200px) {
    .add-data-sidebar {
        width: 600px;
    }
    
    .add-data-left-panel,
    .add-data-right-panel {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .add-data-container {
        flex-direction: column;
    }
    
    .add-data-sidebar {
        width: 100%;
        height: 50%;
        border-left: none;
        border-top: 1px solid #ddd;
    }
    
    .add-data-panels {
        flex-direction: column;
    }
    
    .add-data-left-panel,
    .add-data-right-panel {
        width: 100%;
        height: 50%;
    }
    
    .add-data-left-panel {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
}

/* CC_ File Mapping Results Styles */
.cc-mapping-results {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.cc-mapping-results h4 {
    color: #007bff;
    margin-bottom: 10px;
    font-size: 16px;
}

.cc-data-preview {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.cc-mapped-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cc-mapped-table th {
    background: #e9ecef;
    padding: 8px 4px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cc-mapped-table td {
    padding: 6px 4px;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.cc-mapped-table tr:hover {
    background: #f5f5f5;
}

.cc-mapped-table td:first-child {
    font-weight: 600;
    color: #6c757d;
}

.more-data-notice {
    margin-top: 10px;
    color: #6c757d;
    font-style: italic;
    text-align: center;
}