/**
 * Database Export Styles
 * REQ-4.x: Export section styling
 */

/* ========================================
   MAIN LAYOUT
   ======================================== */
.database-export-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    padding: 1.5rem 0;
    min-height: calc(100vh - 150px);
}

.panel-left {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.panel-center {
    min-width: 0;
}

/* ========================================
   PANELS
   ======================================== */
.column-selector-panel,
.filters-panel,
.saved-configs-panel,
.column-order-panel {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--theme-primary, #0a5fb3);
}

/* ========================================
   EXPORT HEADER
   ======================================== */
.export-header {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========================================
   DATA INFO CARD
   ======================================== */
.data-info-card {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.info-item i {
    color: var(--theme-primary, #0a5fb3);
}

/* ========================================
   PREVIEW SECTION
   ======================================== */
.preview-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.preview-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
}

.empty-preview {
    padding: 4rem 2rem;
    text-align: center;
}

.data-preview-table {
    max-height: 600px;
    overflow: auto;
}

.data-preview-table table {
    font-size: 0.875rem;
}

.data-preview-table th {
    position: sticky;
    top: 0;
    background: var(--theme-primary, #0a5fb3);
    color: white;
    z-index: 10;
}

.table-footer {
    background: #f8f9fa;
    border-top: 2px solid #dee2e6;
}

/* ========================================
   COLUMN ITEMS
   ======================================== */
.column-item {
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    transition: background-color 0.2s;
}

.column-item:hover {
    background: #f8f9fa;
}

.category-title {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.column-category {
    margin-bottom: 1rem;
}

.column-category:last-child {
    margin-bottom: 0;
}

/* ========================================
   SORTABLE COLUMNS
   ======================================== */
.sortable-columns-list {
    min-height: 100px;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px dashed #dee2e6;
}

.sortable-column-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 0.375rem;
    cursor: move;
    transition: all 0.2s;
}

.sortable-column-item:hover {
    border-color: var(--theme-primary, #0a5fb3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.column-drag-handle {
    cursor: grab;
    color: #6c757d;
    margin-right: 0.5rem;
}

.column-drag-handle:active {
    cursor: grabbing;
}

.column-order-number {
    font-weight: 700;
    color: var(--theme-primary, #0a5fb3);
    margin-right: 0.5rem;
}

.column-name {
    flex-grow: 1;
}

.sortable-ghost {
    opacity: 0.4;
    background: #e9ecef;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@@media (max-width: 1200px) {
    .database-export-layout {
        grid-template-columns: 1fr;
    }
    
    .panel-left {
        position: static;
        max-height: none;
    }
    
    .export-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .export-actions {
        flex-direction: column;
    }
}
.data-preview-table table {
    font-size: 0.82rem;
}

.data-preview-table th,
.data-preview-table td {
    padding: 0.45rem 0.6rem;
    vertical-align: middle;
}

.data-preview-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* ========================================
   SORTABLE.JS - ORDEN DE COLUMNAS
   ======================================== */
.sortable-list {
    min-height: 100px;
}

.column-order-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.column-order-item:hover {
    background: #e9ecef;
    border-color: #3b82f6;
}

.column-order-item::before {
    content: '⋮⋮';
    color: #9ca3af;
    font-weight: bold;
}

.sortable-ghost {
    opacity: 0.4;
    background: #dbeafe;
    border-color: #3b82f6;
}

/* ========================================
   MODAL FIX - Z-INDEX
   ======================================== */
.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1050 !important;
}

.modal.show {
    display: block !important;
}
