/* ============================================
   PROFESSIONAL DASHBOARD LAYOUT
   ============================================ */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    background: var(--bg-secondary);
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */

.dashboard-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 2000;
    transition: width var(--transition-base);
}

.sidebar-collapsed .dashboard-sidebar {
    width: 70px;
}

.sidebar-header {
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: var(--space-4) var(--space-2);
}

.sidebar-logo h2 {
    font-size: var(--text-lg);
    color: var(--color-primary);
    margin: 0;
    font-weight: var(--font-semibold);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-logo h2 {
    opacity: 0;
    width: 0;
}

.sidebar-logo img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: var(--space-2);
}

.sidebar-logo p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    margin-top: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-logo p {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.sidebar-section {
    margin-bottom: var(--space-4);
}

.sidebar-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-align: left;
    position: relative;
}

.sidebar-collapsed .sidebar-item {
    justify-content: center;
    padding: var(--space-3) var(--space-2);
    gap: 0;
}

.sidebar-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: hsl(120, 45%, 95%);
    color: var(--color-primary);
    font-weight: var(--font-semibold);
}

.sidebar-item svg {
    flex-shrink: 0;
}

.sidebar-item span {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-item span {
    opacity: 0;
    width: 0;
}

/* Tooltip for collapsed sidebar */
.sidebar-collapsed .sidebar-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary);
    color: white;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    white-space: nowrap;
    margin-left: var(--space-2);
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.sidebar-collapsed .sidebar-footer {
    padding: var(--space-4) var(--space-2);
}

.sidebar-collapsed .sidebar-footer .btn {
    padding: var(--space-3) var(--space-2);
    font-size: 0;
}

.sidebar-collapsed .sidebar-footer .btn::before {
    content: "🚪";
    font-size: var(--text-lg);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.dashboard-main {
    flex: 1;
    margin-left: 260px;
    transition: margin-left var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    padding: 0;
}

#mainContent {
    padding: var(--space-8) var(--space-10) calc(var(--space-10) + 3rem);
}

/* Rediseño premium de la barra de desplazamiento global */
.dashboard-main::-webkit-scrollbar {
    width: 8px;
}
.dashboard-main::-webkit-scrollbar-track {
    background: transparent;
}
.dashboard-main::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
.dashboard-main::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.sidebar-collapsed .dashboard-main {
    margin-left: 70px;
}

.view-header {
    margin-bottom: var(--space-8);
}

.view-header h1 {
    font-size: var(--text-3xl);
    color: var(--text-primary);
    margin: 0;
    margin-bottom: var(--space-2);
    font-weight: var(--font-bold);
}

.view-header p {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

/* ============================================
   UPLOAD ZONE (Mass Upload)
   ============================================ */

.upload-instructions {
    background: var(--bg-secondary);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-8);
}

.upload-instructions h3 {
    color: var(--text-primary);
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-lg);
}

.upload-instructions ol {
    margin: 0;
    padding-left: var(--space-6);
    color: var(--text-secondary);
}

.upload-instructions li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.upload-instructions code {
    background: white;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: var(--text-sm);
    color: var(--color-primary);
}

.upload-zone-wrapper {
    margin-bottom: var(--space-8);
}

.upload-zone {
    border: 3px dashed var(--border-medium);
    border-radius: var(--radius-xl);
    padding: var(--space-12);
    text-align: center;
    background: white;
    transition: all var(--transition-base);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--color-primary);
    background: hsl(120, 45%, 98%);
}

.upload-zone.dragover {
    border-color: var(--color-primary);
    background: hsl(120, 45%, 95%);
    transform: scale(1.02);
}

.upload-icon {
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

.upload-zone h3 {
    color: var(--text-primary);
    font-size: var(--text-xl);
    margin: 0 0 var(--space-2) 0;
}

.upload-zone p {
    color: var(--text-secondary);
    margin: 0 0 var(--space-6) 0;
}

/* Process Section */
#processSection {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
}

.process-header {
    margin-bottom: var(--space-6);
}

.process-header h3 {
    color: var(--text-primary);
    margin: 0 0 var(--space-4) 0;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transition: width var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
}

#progressText {
    display: block;
    list-style-position: inside;
    color: var(--text-secondary);
}

/* ============================================
   DATA TABLES
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table thead {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
}

.data-table thead th {
    padding: var(--space-4) var(--space-4);
    text-align: left;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-primary-dark);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody td {
    padding: var(--space-4) var(--space-4);
    font-size: var(--text-base);
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: flex-start;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success {
    background: hsl(120, 60%, 90%);
    color: hsl(120, 60%, 30%);
}

.badge-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.badge-warning {
    background: hsl(40, 90%, 90%);
    color: hsl(40, 90%, 30%);
}

.badge-danger {
    background: hsl(0, 70%, 95%);
    color: hsl(0, 70%, 40%);
}

/* ============================================
   ICON BUTTONS
   ============================================ */

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.btn-icon-danger {
    color: hsl(0, 70%, 50%);
}

.btn-icon-danger:hover {
    background: hsl(0, 70%, 50%);
    color: white;
    border-color: hsl(0, 70%, 50%);
}

.btn-icon-success {
    color: hsl(120, 60%, 40%);
}

.btn-icon-success:hover {
    background: hsl(120, 60%, 40%);
    color: white;
    border-color: hsl(120, 60%, 40%);
}

.process-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-item {
    background: var(--bg-secondary);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item.success {
    background: hsl(142, 71%, 95%);
    border-left: 4px solid hsl(142, 71%, 45%);
}

.stat-item.warning {
    background: hsl(38, 92%, 95%);
    border-left: 4px solid hsl(38, 92%, 50%);
}

.stat-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.stat-value {
    color: var(--text-primary);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.warnings-section {
    margin-bottom: var(--space-6);
}

.actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Mobile Header Styles */
.dashboard-mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .dashboard-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 var(--space-4);
        background: white;
        border-bottom: 1px solid var(--border-light);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1020;
    }

    .sidebar-toggle-mobile {
        background: transparent;
        border: none;
        color: var(--text-primary);
        padding: var(--space-2);
        cursor: pointer;
        border-radius: var(--radius-md);
    }

    .sidebar-toggle-mobile:active {
        background-color: var(--bg-secondary);
    }

    .dashboard-sidebar {
        transform: translateX(-260px);
        top: 0;
        /* Cover header when open if desired, or top: 60px to be below */
        z-index: 2000;
    }

    .dashboard-sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 0 100vh rgba(0, 0, 0, 0.5);
        /* Dim background */
    }

    .dashboard-main {
        margin-left: 0;
        padding: var(--space-6) var(--space-4);
        margin-top: 60px;
        /* Space for mobile header */
        height: auto;
        /* Let it flow */
        min-height: calc(100vh - 60px);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .upload-zone {
        padding: var(--space-8);
    }

    .process-stats {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }
}