/* Enhanced Mapping Interface Styles */

/* Global overflow fixes */
.container, .row, .col-12 {
    overflow-x: visible;
}

/* Mapping Progress */
.mapping-progress {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.mapping-progress h5 {
    font-weight: 600;
    margin-bottom: 12px;
}

/* Section Headers */
.mapping-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    overflow: visible;
    position: relative;
}

.section-header {
    border-bottom: 2px solid #f1f3f4;
    padding-bottom: 15px;
}

.section-header h4 {
    font-weight: 600;
    color: #2c3e50;
}

.mapping-tools .btn {
    margin-left: 8px;
}

/* Enhanced Table Styling */
.mapping-table {
    margin-bottom: 0;
    table-layout: fixed;
    width: 100%;
}

.table-responsive {
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: visible;
}

.table-header-custom {
    background: linear-gradient(135deg, #AD965F 0%, #b8a069 100%);
}

.mapping-th {
    background: transparent !important;
    color: white !important;
    font-weight: 600;
    border: none !important;
    padding: 16px 12px;
    text-align: center;
    font-size: 14px;
}

.mapping-th i {
    color: rgba(255,255,255,0.9);
}

/* Enhanced Table Rows */
.mapping-row {
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.mapping-row:hover {
    background-color: #f8f9fa;
    border-left-color: #AD965F;
    box-shadow: 0 2px 4px rgba(173, 150, 95, 0.1);
}

.mapping-td {
    padding: 16px 12px;
    vertical-align: middle;
    border-color: #e9ecef !important;
}

/* Variable Cell Styling */
.variable-cell {
    text-align: center;
}

.variable-name {
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid #e9ecef;
}

/* Enhanced Select Elements */
.enhanced-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #ffffff;
}

.enhanced-select:focus {
    border-color: #AD965F;
    box-shadow: 0 0 0 0.2rem rgba(173, 150, 95, 0.25);
    outline: none;
}

.enhanced-select:hover {
    border-color: #b8a069;
}

/* Enhanced Textarea */
.enhanced-textarea {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 80px;
}

.enhanced-textarea:focus {
    border-color: #AD965F;
    box-shadow: 0 0 0 0.2rem rgba(173, 150, 95, 0.25);
    outline: none;
}

.custom-query-container small {
    font-size: 12px;
    font-style: italic;
    margin-top: 5px;
    display: block;
}

/* Format Selection */
.format-selection {
    min-width: 200px;
}

/* Table Format Preview */
.table-format-preview {
    margin-top: 12px;
    overflow: hidden;
}

.preview-card {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    max-width: 150px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.preview-header {
    background-color: #AD965F;
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.preview-body {
    background-color: white;
    color: #333;
    padding: 8px 12px;
    font-size: 11px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

/* Theme Colors for Previews */
.preview-header.gold { background-color: #AD965F; }
.preview-header.green { background-color: #509664; }
.preview-header.blue { background-color: #2563EB; }
.preview-header.purple { background-color: #7C3AED; }
.preview-header.red { background-color: #DC2626; }

/* Status Badges */
.mapping-status {
    text-align: center;
}

.badge {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Enhanced Save Section */
.save-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin-top: 30px;
    border: 1px solid #e0e0e0;
}

.save-action-container {
    max-width: 500px;
    margin: 0 auto;
}

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

.enhanced-save-btn {
    background: linear-gradient(135deg, #AD965F 0%, #b8a069 100%);
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(173, 150, 95, 0.3);
    transition: all 0.3s ease;
    min-width: 280px;
}

.enhanced-save-btn:hover {
    background: linear-gradient(135deg, #b8a069 0%, #AD965F 100%);
    box-shadow: 0 6px 16px rgba(173, 150, 95, 0.4);
    transform: translateY(-2px);
}

.enhanced-save-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(173, 150, 95, 0.3);
}

.btn-content, .btn-spinner {
    transition: opacity 0.3s ease;
}

/* Alert Styling */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 14px;
    padding: 12px 16px;
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #000000;
}

.alert-success {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #000000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mapping-section {
        padding: 15px;
        margin-bottom: 20px;
        overflow: visible;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .mapping-tools {
        margin-top: 15px;
    }
    
    .mapping-tools .btn {
        margin: 0 4px 8px 0;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .table-responsive {
        font-size: 14px;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    
    .mapping-th {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .mapping-td {
        padding: 10px 8px;
    }
    
    .variable-name {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .enhanced-select, .enhanced-textarea {
        font-size: 13px;
        padding: 8px 10px;
    }
    
    .preview-card {
        max-width: 120px;
    }
    
    .enhanced-save-btn {
        font-size: 14px;
        padding: 12px 24px;
        min-width: 240px;
    }
    
    .mapping-row:hover {
        background-color: #f8f9fa;
        transform: none;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(173, 150, 95, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(173, 150, 95, 0); }
    100% { box-shadow: 0 0 0 0 rgba(173, 150, 95, 0); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mapping-section {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .mapping-progress {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #4a5568;
    }
    
    .mapping-row:hover {
        background-color: #4a5568;
    }
    
    .variable-name {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .enhanced-select, .enhanced-textarea {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .preview-body {
        background-color: #4a5568;
        color: #e2e8f0;
    }
}